Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#16231 closed New feature (fixed)

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

Reported by: steko Owned by: steko
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 steko 3 years ago.
git diff style patch
spatialite-kml-gml.2.diff (2.4 KB) - added by jpaulett 3 years ago.
Fix test
spatialite-kml-gml.3.diff (3.7 KB) - added by jpaulett 3 years ago.
Only add AsGML and AsKML if SpatialLite >= 2.4.0
spatialite-kml-gml.4.diff (5.5 KB) - added by jpaulett 3 years ago.
Feature detection of AsGML to detect 2.4.0 RC2 vs RC4
spatialite-kml-gml.5.diff (5.5 KB) - added by jpaulett 3 years ago.
Rebase patch after big changes in [16749]

Download all attachments as: .zip

Change History (10)

Changed 3 years ago by steko

git diff style patch

comment:1 Changed 3 years ago by steko

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to steko
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 3 years ago by aaugustin

  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

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

Changed 3 years ago by jpaulett

Fix test

comment:3 Changed 3 years ago by jpaulett

  • 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.

Changed 3 years ago by jpaulett

Only add AsGML and AsKML if SpatialLite >= 2.4.0

comment:4 Changed 3 years ago by jpaulett

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.

Changed 3 years ago by jpaulett

Feature detection of AsGML to detect 2.4.0 RC2 vs RC4

Changed 3 years ago by jpaulett

Rebase patch after big changes in [16749]

comment:5 Changed 3 years ago by jbronn

  • Resolution set to fixed
  • Status changed from assigned to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.