GeoJSON

There is quickly growing interest in Geographic Support in JSON (Javascript Object Notation) and now there is a central discussion rallying area at the GeoJSON wiki.

The goal is to grow and develop GeoJSON similar to how GeoRSS has grown, by community effort, examples, and implementation. And then make a standard on what has come out of it (rather than standards first, implementation later... please)

There have been other efforts to start GeoJSON, originally, GeoJSON for Pleiades, and also JDIL.

All well and good, but what do you mean?


JSON is a way to easily serialize, store, and create Javascript objects from a hash. That's the simple way to put it.

Therefore, given a hash for a contact:

var JSON_text = {
"firstName": "John",
"lastName": "Smith",
"address": {
"city": "New York, NY",
"zipCode": 10021,
"streetAddress": "21 2nd Street"
},
"phoneNumbers": [
"212 732-1234",
"646 123-4567"
]
}

You can easily create a contact object:

 var p = eval("(" + JSON_text + ")");

(via Wikipedia)

The idea behind GeoJSON then is to encapsulate geographic features in JSON in a common way that allows different services to pass around the Javascript representation.

For example (from Pleiades GeoJSON):

var GEO_JSON = { "name": "map-1",
"title": "Pleiades Map 1",
"boundingBox": [-12.0, 32.0, 40.0, 58.0],
"srs": "EPSG:4326",
"layers": [
{ "name": "dphysio",
"title: "Demis Physiography"
"layers": "Bathymetry,Topography,Rivers,Waterbodies",
"styles": ",,,",
"onlineResource": "http:\/\/www2.demis.nl\/mapserver\/request.asp",
"srs": "EPSG:4326"
}
]
}

UED


Lets just carry this one more step forward.

Just today on Ajaxian there was mention of URL Encoded Data. This is taking that Javascript array/hash - JSON? and making it into a URL to link to resources, or perhaps to create Geo-objects on the other end for, say, mapping.

From the above example it may yield something like:

var geo_url = ued_encode(GEO_JSON);

http://geoservice.com/get_data.php?name=map-1&title=Pleiades+Map+1
&boundingBox[]=-12.0&boundingBox[]=32.0&boundingBox[]=40.0&boundingBox[]=58.0
&srs=EPSG:4326&layers[name]=dphysio&layers[title]=Demis+Physiography
&layers[layers][]=Bathymetry&layers[layers][]=Topography
&layers[layers][]=Rivers&layers[layers][]=Waterbodies
&layers[onlineResource]=http://www2.demis.nl/mapserver/request.asp",
&layers[srs]=EPSG:4326

Of course, you may start running into encoding problems or URL lengths, but it is still a very nice idea.

Devil in the details


This is all well and good, and very interesting. But there will definitely be a long road working out the issues and details. Lots of initial excitement, people throwing out existing formats, libraries, use-cases, and issues that have been building over years. This will mire the whole thing down, and everyone will slowly wonder if it will make it out of the murkiness.

And then lo' and behold, after much forging & shaping, it will be a useful spec.

About this article

written on
posted in Neogeography Back to Top

About the Author

Andrew Turner is an advocate of open standards and open data. He is actively involved in many organizations developing and supporting open standards, including OpenStreetMap, Open Geospatial Consortium, Open Web Foundation, OSGeo, and the World Wide Web Consortium. He co-founded CrisisCommons, a community of volunteers that, in coordination with government agencies and disaster response groups, build technology tools to help people in need during and after a crisis such as an earthquake, tsunami, tornado, hurricane, flood, or wildfire.