= Blueprint for GIS Import/Export = === XML === 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 [wiki:BluePrintREST RESTlike controller]. Rather than reinventing the wheel, we could consider wrapping [http://featureserver.org FeatureServer] to do a lot of this work for us (like Web2Py uses !CherryPy) since it is WSGI-based.[[BR]] Alternatively we could look to borrow code from it. The XML conversion is probably best-done using XSL stylesheets: * http://sourceforge.net/projects/geofunctions/ Relevant XSDs: * [http://georss.org GeoRSS] * http://georss.org/xml/1.1/georss.xsd * http://georss.org/xml/1.1/gmlgeorss.xsd * GPX * http://www.topografix.com/gpx/1/1/gpx.xsd * GML * http://schemas.opengis.net/gml/3.2.1/ * KML * http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd * OSM * http://dev.openstreetmap.org/~kleptog/osm-0.5.dtd Sahan Eden uses [wiki:S3XRC S3XRC] for our XML Import/Export which uses lxml: * lxml: http://codespeak.net/lxml/index.html#introduction * Fast Parser: http://blog.ianbicking.org/2008/03/30/python-html-parser-performance/ Other options are available: * XML export from Web2Py: http://michaelangela.wordpress.com/2008/03/29/exporting-a-web2py-table-in-xml/ * KML export from Web2Py: http://groups.google.com/group/web2py/browse_thread/thread/b59bd3a9c40086f0 * PyRXP: http://www.reportlab.org/pyrxp.html * Faster & optionally validating (DTD, XSD?), but requires compiling into Python so less portable (unless using pyexpat wrapper) * PyRXP_Documentation.pdf * XSD->DTD conversion (our schema are in XSD format) * http://crism.maden.org/consulting/pub/xsl/xsd2dtd.xsl * http://weblogs.asp.net/rchartier/archive/2006/03/21/440782.aspx * http://lists.xml.org/archives/xml-dev/200504/msg00757.html * http://bytes.com/groups/xml/85935-converting-xsd-into-dtd * cElementTree - included in Python 2.5, strict & fast: http://effbot.org/zone/celementtree.htm * {{{mytree=xml.etree.ElementTree.XML(request.body.read())}}} * sgmlop (supported by xmlrpclib): http://effbot.org/zone/sgmlop-index.htm * pyexpat (non-validating & slower, but built-in to Python 2) * http://docs.python.org/library/pyexpat.html * Pyfo (example with Web2Py): http://michaelangela.wordpress.com/2008/04/10/simple-xml-creation-with-python/ * SAX: http://www.devshed.com/c/a/Python/Parsing-XML-with-SAX-and-Python/ CSV to KML Converter: * http://code.google.com/apis/kml/articles/csvtokml.html * Useful to extend to handle images (multiple images => Tabs) This is another option for Import (via Python structures): * http://www.rexx.com/~dkuhlman/generateDS.html XML links: * http://www.w3schools.com/Schema/schema_intro.asp * http://diveintopython.org/xml_processing/index.html * http://www.xml.com/pub/a/2002/09/18/py.html * http://www.xml.com/pub/a/2003/09/10/py.html ---- === Geotagged Photos === We should also be able to import Geotagged Photos & have these display on the Map. Feature Metadata already includes an Image - so the work needed is just in terms of reading the Lat/Lon from the Tag & providing a UI: * http://en.wikipedia.org/wiki/Geotag#JPEG_photos Most developed OSS tools are: * [http://www.exiv2.org Exiv2] - C++ with [http://tilloy.net/dev/pyexiv2/ pyexiv2] binding (still experimental) * [http://www.sno.phy.queensu.ca/~phil/exiftool ExifTool] - Perl (extra dependencies & needs to be run as system call) * Comparison: http://www.picurl.org/development/wiki/Exiv2vsExifTool Python works-in-progress here: * http://sourceforge.net/projects/exif-py/?abmode=1 * http://www.ivan-herman.net/cgi-bin/blosxom.cgi/WorkRelated/SemanticWeb/xmpextract.html XMP-only * http://code.google.com/p/python-xmp-toolkit/ XMP-only ---- [wiki:BluePrintGeographicInformationSystems GIS BluePrints]