Fixed #31196 -- Added support for PostGIS 3.

This commit is contained in:
Sergey Fedoseev 2020-01-20 00:01:08 +05:00 committed by Mariusz Felisiak
parent a6b4c07b6e
commit b9e2355eb0
4 changed files with 19 additions and 7 deletions

View File

@ -190,12 +190,14 @@ class AsGML(GeoFunc):
return super(AsGML, clone).as_sql(compiler, connection, **extra_context) return super(AsGML, clone).as_sql(compiler, connection, **extra_context)
class AsKML(AsGML): class AsKML(GeoFunc):
def as_sqlite(self, compiler, connection, **extra_context): output_field = TextField()
# No version parameter
clone = self.copy() def __init__(self, expression, precision=8, **extra):
clone.set_source_expressions(self.get_source_expressions()[1:]) expressions = [expression]
return clone.as_sql(compiler, connection, **extra_context) if precision is not None:
expressions.append(self._handle_param(precision, 'precision', int))
super().__init__(*expressions, **extra)
class AsSVG(GeoFunc): class AsSVG(GeoFunc):

View File

@ -144,6 +144,10 @@ Keyword Argument Description
__ https://developers.google.com/kml/documentation/ __ https://developers.google.com/kml/documentation/
.. versionchanged:: 3.1
The undocumented ``version`` parameter was removed.
``AsSVG`` ``AsSVG``
========= =========

View File

@ -12,7 +12,7 @@ Program Description Required
`PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 5.2, 5.1, 5.0, 4.x `PROJ.4`_ Cartographic Projections library Yes (PostgreSQL and SQLite only) 5.2, 5.1, 5.0, 4.x
:doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.4, 2.3, 2.2, 2.1, 2.0 :doc:`GDAL <../gdal>` Geospatial Data Abstraction Library Yes 2.4, 2.3, 2.2, 2.1, 2.0
:doc:`GeoIP <../geoip2>` IP-based geolocation library No 2 :doc:`GeoIP <../geoip2>` IP-based geolocation library No 2
`PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 2.5, 2.4, 2.3, 2.2 `PostGIS`__ Spatial extensions for PostgreSQL Yes (PostgreSQL only) 3.0, 2.5, 2.4, 2.3, 2.2
`SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3 `SpatiaLite`__ Spatial extensions for SQLite Yes (SQLite only) 4.3
======================== ==================================== ================================ =================================== ======================== ==================================== ================================ ===================================
@ -33,6 +33,7 @@ totally fine with GeoDjango. Your mileage may vary.
PostGIS 2.3.0 2016-09-26 PostGIS 2.3.0 2016-09-26
PostGIS 2.4.0 2017-09-30 PostGIS 2.4.0 2017-09-30
PostGIS 2.5.0 2018-09-23 PostGIS 2.5.0 2018-09-23
PostGIS 3.0.0 2019-10-20
SpatiaLite 4.3.0 2015-09-07 SpatiaLite 4.3.0 2015-09-07
.. note:: .. note::

View File

@ -116,6 +116,8 @@ Minor features
* Added the :class:`~django.contrib.gis.db.models.functions.AsWKB` and * Added the :class:`~django.contrib.gis.db.models.functions.AsWKB` and
:class:`~django.contrib.gis.db.models.functions.AsWKT` functions. :class:`~django.contrib.gis.db.models.functions.AsWKT` functions.
* Added support for PostGIS 3.
:mod:`django.contrib.humanize` :mod:`django.contrib.humanize`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -629,6 +631,9 @@ Miscellaneous
argument to be a string or bytes. Other types should be explicitly cast to argument to be a string or bytes. Other types should be explicitly cast to
one of these. one of these.
* The undocumented ``version`` parameter to the
:class:`~django.contrib.gis.db.models.functions.AsKML` function is removed.
.. _deprecated-features-3.1: .. _deprecated-features-3.1:
Features deprecated in 3.1 Features deprecated in 3.1