GeoJSON for Virtual Earth
Tuesday, September 9th, 2008For my new project I decided to make use of GeoJSON, a standard for representing geo data in JSON format, rather than returning KML, georss to the client, or some custom format.
From a quick look online there wasn’t much in the way of using Virtual Earth with GeoJSON, I found one blog post that was the inspiration behind doing VEGeoJSON.
The VEGeoJSON library provides two functions (not much of a library)
- addGeoJSON(data, onLayerCreated, onShapeCreated)
- getGeoJSON(onGeometryCreated)
As a quick example of its usage
var v = new VEGeoJson(map); var geoJson = v.getGeoJSON();
VEGeoJSON supports all the GeoJSON shapes; Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection.
Thanks to Colin Brown for giving it a quick test and talking me into putting it on CodePlex.