diff --git django/contrib/gis/db/backends/spatialite/operations.py django/contrib/gis/db/backends/spatialite/operations.py
index 449c527..a8b5220 100644
|
|
class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
|
133 | 133 | gis_terms += self.geometry_functions.keys() |
134 | 134 | self.gis_terms = dict([(term, None) for term in gis_terms]) |
135 | 135 | |
| 136 | # Spatialite 2.4.0-RC4 added AsGML and AsKML |
| 137 | if version >= (2, 4, 0): |
| 138 | self.gml = 'AsGML' |
| 139 | self.kml = 'AsKML' |
| 140 | |
136 | 141 | def check_aggregate_support(self, aggregate): |
137 | 142 | """ |
138 | 143 | Checks if the given aggregate name is supported (that is, if it's |
diff --git django/contrib/gis/tests/geoapp/tests.py django/contrib/gis/tests/geoapp/tests.py
index b7ce3b7..84ce53d 100644
|
|
class GeoModelTest(TestCase):
|
92 | 92 | |
93 | 93 | def test03a_kml(self): |
94 | 94 | "Testing KML output from the database using GeoQuerySet.kml()." |
95 | | # Only PostGIS supports KML serialization |
96 | | if not postgis: |
| 95 | # Only PostGIS and Spatialite support KML serialization |
| 96 | if not (postgis or (spatialite and connection.ops.spatial_version >= (2, 4, 0))): |
97 | 97 | self.assertRaises(NotImplementedError, State.objects.all().kml, field_name='poly') |
98 | 98 | return |
99 | 99 | |
… |
… |
class GeoModelTest(TestCase):
|
117 | 117 | |
118 | 118 | def test03b_gml(self): |
119 | 119 | "Testing GML output from the database using GeoQuerySet.gml()." |
120 | | if mysql or spatialite: |
| 120 | if mysql: |
121 | 121 | self.assertRaises(NotImplementedError, Country.objects.all().gml, field_name='mpoly') |
122 | 122 | return |
123 | 123 | |
… |
… |
class GeoModelTest(TestCase):
|
131 | 131 | if oracle: |
132 | 132 | # No precision parameter for Oracle :-/ |
133 | 133 | gml_regex = re.compile(r'^<gml:Point srsName="SDO:4326" xmlns:gml="http://www.opengis.net/gml"><gml:coordinates decimal="\." cs="," ts=" ">-104.60925\d+,38.25500\d+ </gml:coordinates></gml:Point>') |
134 | | for ptown in [ptown1, ptown2]: |
135 | | self.assertTrue(gml_regex.match(ptown.gml)) |
| 134 | elif spatialite: |
| 135 | # Spatialite has extra colon in SrsName |
| 136 | gml_regex = re.compile(r'^<gml:Point SrsName="EPSG::4326"><gml:coordinates decimal="\." cs="," ts=" ">-104.609251\d+,38.255001</gml:coordinates></gml:Point>') |
136 | 137 | else: |
137 | 138 | gml_regex = re.compile(r'^<gml:Point srsName="EPSG:4326"><gml:coordinates>-104\.60925\d+,38\.255001</gml:coordinates></gml:Point>') |
138 | | for ptown in [ptown1, ptown2]: |
139 | | self.assertTrue(gml_regex.match(ptown.gml)) |
| 139 | |
| 140 | for ptown in [ptown1, ptown2]: |
| 141 | self.assertTrue(gml_regex.match(ptown.gml)) |
| 142 | |
140 | 143 | |
141 | 144 | def test03c_geojson(self): |
142 | 145 | "Testing GeoJSON output from the database using GeoQuerySet.geojson()." |
diff --git docs/ref/contrib/gis/db-api.txt docs/ref/contrib/gis/db-api.txt
index fbced8e..871defe 100644
|
|
Method PostGIS Oracle SpatiaLite
|
311 | 311 | :meth:`GeoQuerySet.force_rhr` X |
312 | 312 | :meth:`GeoQuerySet.geohash` X |
313 | 313 | :meth:`GeoQuerySet.geojson` X |
314 | | :meth:`GeoQuerySet.gml` X X |
| 314 | :meth:`GeoQuerySet.gml` X X X |
315 | 315 | :meth:`GeoQuerySet.intersection` X X X |
316 | | :meth:`GeoQuerySet.kml` X |
| 316 | :meth:`GeoQuerySet.kml` X X |
317 | 317 | :meth:`GeoQuerySet.length` X X X |
318 | 318 | :meth:`GeoQuerySet.make_line` X |
319 | 319 | :meth:`GeoQuerySet.mem_size` X |