Ticket #16231: spatialite-kml-gml.3.diff

File spatialite-kml-gml.3.diff, 3.7 KB (added by John Paulett, 13 years ago)

Only add AsGML and AsKML if SpatialLite >= 2.4.0

  • django/contrib/gis/db/backends/spatialite/operations.py

    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):  
    133133        gis_terms += self.geometry_functions.keys()
    134134        self.gis_terms = dict([(term, None) for term in gis_terms])
    135135
     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
    136141    def check_aggregate_support(self, aggregate):
    137142        """
    138143        Checks if the given aggregate name is supported (that is, if it's
  • django/contrib/gis/tests/geoapp/tests.py

    diff --git django/contrib/gis/tests/geoapp/tests.py django/contrib/gis/tests/geoapp/tests.py
    index b7ce3b7..84ce53d 100644
    class GeoModelTest(TestCase):  
    9292
    9393    def test03a_kml(self):
    9494        "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))):
    9797            self.assertRaises(NotImplementedError, State.objects.all().kml, field_name='poly')
    9898            return
    9999
    class GeoModelTest(TestCase):  
    117117
    118118    def test03b_gml(self):
    119119        "Testing GML output from the database using GeoQuerySet.gml()."
    120         if mysql or spatialite:
     120        if mysql:
    121121            self.assertRaises(NotImplementedError, Country.objects.all().gml, field_name='mpoly')
    122122            return
    123123
    class GeoModelTest(TestCase):  
    131131        if oracle:
    132132            # No precision parameter for Oracle :-/
    133133            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>')
    136137        else:
    137138            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
    140143
    141144    def test03c_geojson(self):
    142145        "Testing GeoJSON output from the database using GeoQuerySet.geojson()."
  • docs/ref/contrib/gis/db-api.txt

    diff --git docs/ref/contrib/gis/db-api.txt docs/ref/contrib/gis/db-api.txt
    index fbced8e..871defe 100644
    Method PostGIS Oracle SpatiaLite  
    311311:meth:`GeoQuerySet.force_rhr`         X
    312312:meth:`GeoQuerySet.geohash`           X
    313313:meth:`GeoQuerySet.geojson`           X
    314 :meth:`GeoQuerySet.gml`               X        X
     314:meth:`GeoQuerySet.gml`               X        X       X
    315315:meth:`GeoQuerySet.intersection`      X        X       X
    316 :meth:`GeoQuerySet.kml`               X
     316:meth:`GeoQuerySet.kml`               X                X
    317317:meth:`GeoQuerySet.length`            X        X       X
    318318:meth:`GeoQuerySet.make_line`         X
    319319:meth:`GeoQuerySet.mem_size`          X
Back to Top