From 0a13b249e2e0e901d795f4198a3a5dfd1fc49554 Mon Sep 17 00:00:00 2001 From: Sergey Fedoseev Date: Sat, 1 Apr 2017 22:43:53 +0500 Subject: Fixed #26967 -- Added MySQL support for AsGeoJSON, GeoHash, IsValid functions, and isvalid lookup. --- docs/ref/contrib/gis/db-api.txt | 8 ++++---- docs/ref/contrib/gis/functions.txt | 26 +++++++++++++++++++------- docs/ref/contrib/gis/geoquerysets.txt | 20 ++++++++++++-------- docs/releases/2.0.txt | 6 +++++- 4 files changed, 40 insertions(+), 20 deletions(-) (limited to 'docs') diff --git a/docs/ref/contrib/gis/db-api.txt b/docs/ref/contrib/gis/db-api.txt index 09a49c8418..d0555ec145 100644 --- a/docs/ref/contrib/gis/db-api.txt +++ b/docs/ref/contrib/gis/db-api.txt @@ -341,7 +341,7 @@ Lookup Type PostGIS Oracle MySQL [#]_ SpatiaLite :lookup:`equals` X X X X C :lookup:`exact` X X X X B :lookup:`intersects` X X X X B -:lookup:`isvalid` X X X (LWGEOM) +:lookup:`isvalid` X X X (≥ 5.7.5) X (LWGEOM) :lookup:`overlaps` X X X X B :lookup:`relate` X X X C :lookup:`same_as` X X X X B @@ -372,7 +372,7 @@ functions are available on each spatial backend. Function PostGIS Oracle MySQL SpatiaLite ==================================== ======= ============== =========== ========== :class:`Area` X X X X -:class:`AsGeoJSON` X X +:class:`AsGeoJSON` X X (≥ 5.7.5) X :class:`AsGML` X X X :class:`AsKML` X X :class:`AsSVG` X X @@ -382,9 +382,9 @@ Function PostGIS Oracle MySQL Spat :class:`Distance` X X X (≥ 5.6.1) X :class:`Envelope` X X X :class:`ForceRHR` X -:class:`GeoHash` X X (LWGEOM) +:class:`GeoHash` X X (≥ 5.7.5) X (LWGEOM) :class:`Intersection` X X X (≥ 5.6.1) X -:class:`IsValid` X X X (LWGEOM) +:class:`IsValid` X X X (≥ 5.7.5) X (LWGEOM) :class:`Length` X X X X :class:`MakeValid` X X (LWGEOM) :class:`MemSize` X diff --git a/docs/ref/contrib/gis/functions.txt b/docs/ref/contrib/gis/functions.txt index fc22d43c30..b54feb03a1 100644 --- a/docs/ref/contrib/gis/functions.txt +++ b/docs/ref/contrib/gis/functions.txt @@ -56,8 +56,8 @@ geographic SRSes. .. class:: AsGeoJSON(expression, bbox=False, crs=False, precision=8, **extra) -*Availability*: `PostGIS `__, -SpatiaLite +*Availability*: MySQL (≥ 5.7.5), `PostGIS +`__, SpatiaLite Accepts a single geographic field or expression and returns a `GeoJSON `_ representation of the geometry. Note that the result is @@ -77,13 +77,17 @@ Keyword Argument Description ``crs`` Set this to ``True`` if you want the coordinate reference system to be included in the returned - GeoJSON. + GeoJSON. Ignored on MySQL. ``precision`` It may be used to specify the number of significant digits for the coordinates in the GeoJSON representation -- the default value is 8. ===================== ===================================================== +.. versionchanged:: 2.0 + + MySQL support was added. + ``AsGML`` ========= @@ -286,8 +290,8 @@ right-hand rule. .. class:: GeoHash(expression, precision=None, **extra) -*Availability*: `PostGIS `__, -SpatiaLite (LWGEOM) +*Availability*: MySQL (≥ 5.7.5), `PostGIS +`__, SpatiaLite (LWGEOM) Accepts a single geographic field or expression and returns a `GeoHash`__ representation of the geometry. @@ -295,6 +299,10 @@ representation of the geometry. The ``precision`` keyword argument controls the number of characters in the result. +.. versionchanged:: 2.0 + + MySQL support was added. + __ https://en.wikipedia.org/wiki/Geohash ``Intersection`` @@ -313,8 +321,8 @@ intersection between them. .. class:: IsValid(expr) -*Availability*: `PostGIS `__, -Oracle, SpatiaLite (LWGEOM) +*Availability*: MySQL (≥ 5.7.5), `PostGIS +`__, Oracle, SpatiaLite (LWGEOM) Accepts a geographic field or expression and tests if the value is well formed. Returns ``True`` if its value is a valid geometry and ``False`` otherwise. @@ -323,6 +331,10 @@ Returns ``True`` if its value is a valid geometry and ``False`` otherwise. SpatiaLite and Oracle support was added. +.. versionchanged:: 2.0 + + MySQL support was added. + ``Length`` ========== diff --git a/docs/ref/contrib/gis/geoquerysets.txt b/docs/ref/contrib/gis/geoquerysets.txt index d7135a7c39..d106191485 100644 --- a/docs/ref/contrib/gis/geoquerysets.txt +++ b/docs/ref/contrib/gis/geoquerysets.txt @@ -306,8 +306,8 @@ SpatiaLite ``Intersects(poly, geom)`` ``isvalid`` ----------- -*Availability*: `PostGIS `__, -Oracle, SpatiaLite +*Availability*: MySQL (≥ 5.7.5), `PostGIS +`__, Oracle, SpatiaLite Tests if the geometry is valid. @@ -315,17 +315,21 @@ Example:: Zipcode.objects.filter(poly__isvalid=True) -=================== ================================================================ -Backend SQL Equivalent -=================== ================================================================ -PostGIS, SpatiaLite ``ST_IsValid(poly)`` -Oracle ``SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(poly, 0.05) = 'TRUE'`` -=================== ================================================================ +========================== ================================================================ +Backend SQL Equivalent +========================== ================================================================ +MySQL, PostGIS, SpatiaLite ``ST_IsValid(poly)`` +Oracle ``SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(poly, 0.05) = 'TRUE'`` +========================== ================================================================ .. versionchanged:: 1.11 Oracle and SpatiaLite support was added. +.. versionchanged:: 2.0 + + MySQL support was added. + .. fieldlookup:: overlaps ``overlaps`` diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt index ee2117546b..0006ef4c45 100644 --- a/docs/releases/2.0.txt +++ b/docs/releases/2.0.txt @@ -62,7 +62,11 @@ Minor features :mod:`django.contrib.gis` ~~~~~~~~~~~~~~~~~~~~~~~~~ -* ... +* Added MySQL support for the + :class:`~django.contrib.gis.db.models.functions.AsGeoJSON` function, + :class:`~django.contrib.gis.db.models.functions.GeoHash` function, + :class:`~django.contrib.gis.db.models.functions.IsValid` function, and + :lookup:`isvalid` lookup. :mod:`django.contrib.messages` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.3