|Version 15 (modified by 13 years ago) ( diff ),|
Blueprint for GIS Import/Export
We need to be able to Import & Export these XML formats to/from the Database:
- GeoRSS (URL fetch/publish)
- GPX (File upload/download)
- KML (File upload/download & URL fetch/publish)
- OSM (File upload/download)
- GML (? Low priority, not used much in real world)
Other formats which may be useful are Shapefiles, PostGIS & JSON.
These should be representations added to the RESTlike controller.
Rather than reinventing the wheel, we could consider wrapping FeatureServer to do a lot of this work for us (like Web2Py uses CherryPy) since it is WSGI-based.
Alternatively we could look to borrow code from it.
The XML conversion is probably best-done using an XSD parser:
KML export from Web2Py:
XML export from Web2Py:
Many options available for XML Import/Export, e.g.:
- PyRXP: http://www.reportlab.org/pyrxp.html
- Faster & optionally validating (DTD, XSD?), but requires compiling into Python so less portable (unless using pyexpat wrapper)
- XSD->DTD conversion (our schema are in XSD format)
- cElementTree - included in Python 2.5, strict & fast: http://effbot.org/zone/celementtree.htm
- sgmlop (supported by xmlrpclib): http://effbot.org/zone/sgmlop-index.htm
- pyexpat (non-validating & slower, but built-in to Python 2)
- Pyfo (example with Web2Py): http://michaelangela.wordpress.com/2008/04/10/simple-xml-creation-with-python/
This is another option for Import (via Python structures):