Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#16231 closed New feature (fixed)

add support for AsGML() and AsKML() for the Spatialite backend

Reported by: Stefano Costa Owned by: Stefano Costa
Component: GIS Version: 1.3
Severity: Normal Keywords:
Cc: john@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Spatialite supports AsGML() and AsKML() since version 2.4.0-RC4, that is largely used in production environments.

This trivial patch adds support for these two output formats to the Spatialite backend in GeoDjango.

I've also made the small changes one would expect to both the test suite and to the documentation.

Tests seem to pass, but this is my first Django patch ever and I'm not very familiar with running the test suite.

Attachments (5)

spatialite-kml-gml.diff (2.4 KB ) - added by Stefano Costa 13 years ago.
git diff style patch
spatialite-kml-gml.2.diff (2.4 KB ) - added by John Paulett 13 years ago.
Fix test
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
spatialite-kml-gml.4.diff (5.5 KB ) - added by John Paulett 13 years ago.
Feature detection of AsGML to detect 2.4.0 RC2 vs RC4
spatialite-kml-gml.5.diff (5.5 KB ) - added by John Paulett 13 years ago.
Rebase patch after big changes in [16749]

Download all attachments as: .zip

Change History (10)

by Stefano Costa, 13 years ago

Attachment: spatialite-kml-gml.diff added

git diff style patch

comment:1 by Stefano Costa, 13 years ago

Owner: changed from nobody to Stefano Costa
Status: newassigned

comment:2 by Aymeric Augustin, 13 years ago

Needs tests: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

Overall the patch looks good, but I think it needs actual tests.

by John Paulett, 13 years ago

Attachment: spatialite-kml-gml.2.diff added

Fix test

comment:3 by John Paulett, 13 years ago

Cc: john@… added
Needs tests: unset

I attached a tweak to the patch, spatialite-kml-gml.2.diff (assertRaises was still called for sqlite due to a bug in the if statement).

I am new to the GeoDjango, so this may be irrelevant, but it appears that the version of Spatialite that supports AsGML and AsKML is not considered "stable" (2.4.0-RC4). The GeoDjango docs still include instructions on installing the stable version of Spatialite, 2.3.1. Ubuntu 11.04 & 11.10 (not yet released) appear to only have 2.4.0-RC2--so even on the bleading edge versions of Ubuntu these functions will not be available.

by John Paulett, 13 years ago

Attachment: spatialite-kml-gml.3.diff added

Only add AsGML and AsKML if SpatialLite >= 2.4.0

comment:4 by John Paulett, 13 years ago

The latest patch, spatialite-kml-gml.3.diff, checks the Spatialite version before adding AsKML and AsGML. It works for Spatialite 2.4.0-RC4+, but fails for the default Ubuntu libspatialite2 package (2.4.0-RC2). Not sure how to detect RC2 vs RC4 given that spatialite_version() returns for 2.4.0 regardless of RC2 or RC4.

by John Paulett, 13 years ago

Attachment: spatialite-kml-gml.4.diff added

Feature detection of AsGML to detect 2.4.0 RC2 vs RC4

by John Paulett, 13 years ago

Attachment: spatialite-kml-gml.5.diff added

Rebase patch after big changes in [16749]

comment:5 by jbronn, 13 years ago

Resolution: fixed
Status: assignedclosed

In [16800]:

Fixed #16231 -- Added support for GML and KML on the SpatiaLite backend. Thanks, steko for the bug report and jpaulett for the patch.

Note: See TracTickets for help on using tickets.
Back to Top