Python JSON libraries
JavaScript Object Notation (JSON) is rapidly becoming the number one data exchange format across a lot of fields and, no, it's no different. The lightweight syntax and the similarity to existing data structures makes it a perfect match for Python.
We'll use the following geoJSON sample document for this section from the Wikipedia article on GeoJSON found at: http://en.wikipedia.org/wiki/GeoJSON
The document contains a single point:
{
"type": "Feature",
"id": "OpenLayers.Feature.Vector_314",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [
97.03125,
39.7265625
]
},
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
}
}This sample is just a simple point with new attributes which would be stored in the properties data structure of the geometry. First we'll compact the sample document into a single string to make...