mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #30996 -- Added AsWKB and AsWKT GIS functions.
This commit is contained in:
parent
8929afb8ec
commit
a5855c8f0f
8 changed files with 89 additions and 4 deletions
|
@ -364,6 +364,8 @@ Function PostGIS Oracle MariaDB MySQL
|
|||
:class:`AsGML` X X X
|
||||
:class:`AsKML` X X
|
||||
:class:`AsSVG` X X
|
||||
:class:`AsWKB` X X X X X
|
||||
:class:`AsWKT` X X X X X
|
||||
:class:`Azimuth` X X (LWGEOM)
|
||||
:class:`BoundingCircle` X X
|
||||
:class:`Centroid` X X X X X
|
||||
|
|
|
@ -27,9 +27,9 @@ Measurement Relationships Operations Edi
|
|||
:class:`Distance` :class:`BoundingCircle` :class:`Intersection` :class:`MakeValid` :class:`AsGML` :class:`MemSize`
|
||||
:class:`GeometryDistance` :class:`Centroid` :class:`SymDifference` :class:`Reverse` :class:`AsKML` :class:`NumGeometries`
|
||||
:class:`Length` :class:`Envelope` :class:`Union` :class:`Scale` :class:`AsSVG` :class:`NumPoints`
|
||||
:class:`Perimeter` :class:`LineLocatePoint` :class:`SnapToGrid` :class:`GeoHash`
|
||||
.. :class:`PointOnSurface` :class:`Transform`
|
||||
.. :class:`Translate`
|
||||
:class:`Perimeter` :class:`LineLocatePoint` :class:`SnapToGrid` :class:`AsWKB`
|
||||
.. :class:`PointOnSurface` :class:`Transform` :class:`AsWKT`
|
||||
.. :class:`Translate` :class:`GeoHash`
|
||||
========================= ======================== ====================== ======================= ================== =====================
|
||||
|
||||
``Area``
|
||||
|
@ -168,6 +168,48 @@ Keyword Argument Description
|
|||
|
||||
__ https://www.w3.org/Graphics/SVG/
|
||||
|
||||
``AsWKB``
|
||||
=========
|
||||
|
||||
.. class:: AsWKB(expression, **extra)
|
||||
|
||||
.. versionadded:: 3.1
|
||||
|
||||
*Availability*: MariaDB, `MySQL
|
||||
<https://dev.mysql.com/doc/refman/en/gis-format-conversion-functions.html#function_st-asbinary>`__,
|
||||
Oracle, `PostGIS <https://postgis.net/docs/ST_AsBinary.html>`__, SpatiaLite
|
||||
|
||||
Accepts a single geographic field or expression and returns a `Well-known
|
||||
binary (WKB)`__ representation of the geometry.
|
||||
|
||||
Example::
|
||||
|
||||
>>> bytes(City.objects.annotate(wkb=AsWKB('point')).get(name='Chelyabinsk').wkb)
|
||||
b'\x01\x01\x00\x00\x00]3\xf9f\x9b\x91K@\x00X\x1d9\xd2\xb9N@'
|
||||
|
||||
__ https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry#Well-known_binary
|
||||
|
||||
``AsWKT``
|
||||
=========
|
||||
|
||||
.. class:: AsWKT(expression, **extra)
|
||||
|
||||
.. versionadded:: 3.1
|
||||
|
||||
*Availability*: MariaDB, `MySQL
|
||||
<https://dev.mysql.com/doc/refman/en/gis-format-conversion-functions.html#function_st-astext>`__,
|
||||
Oracle, `PostGIS <https://postgis.net/docs/ST_AsText.html>`__, SpatiaLite
|
||||
|
||||
Accepts a single geographic field or expression and returns a `Well-known text
|
||||
(WKT)`__ representation of the geometry.
|
||||
|
||||
Example::
|
||||
|
||||
>>> City.objects.annotate(wkt=AsWKT('point')).get(name='Chelyabinsk').wkt
|
||||
'POINT (55.137555 61.451728)'
|
||||
|
||||
__ https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry
|
||||
|
||||
``Azimuth``
|
||||
===========
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue