mandag den 16. februar 2009

Technical Overview: GeoJSON


Jeg har anvendt JSON i et af mine seneste projekter og jeg må sige at det er sgu smart ... GeoJSON må være det næste ...
/Sik


I've used JSON in one of my the latest projects and I must admit it is damn smart ... Next up must be GeoJSON ...
/Sik


Quote

Written by Richard Marsden   

[...]

GeoJSON

GeoJSON is a geospatial data interchange format based on JSON. It is a relatively young format, but already has support in the OpenLayers client and the GDAL/OGR library. GeoJSON plug-ins are also available for GeoServer and CartoWeb. The specification can be found at: http://geojson.org/geojson-spec.html

GeoJSON supports the standard geometry objects supported by shapefiles, as well as features, collections, bounding boxes, and multiple coordinate systems. Here is an example taken from the specification:

  1 
  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 
 14 
 15 
 16 
 17 
 18 
 19 
 20 
 21 
 22 
 23 
 24 
 25 
 26 
 27 
 28 
 29 
 30 
 31 
 32 
 33 
 34 
{ "type": "FeatureCollection",
  "features": [
    { "type": "Feature",
      "geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
      "properties": {"prop0": "value0"}
      },
    { "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
          ]
        },
      "properties": {
        "prop0": "value0",
        "prop1": 0.0
        }
      },
    { "type": "Feature",
       "geometry": {
         "type": "Polygon",
         "coordinates": [
           [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
             [100.0, 1.0], [100.0, 0.0] ]
           ]
       },
       "properties": {
         "prop0": "value0",
         "prop1": {"this": "that"}
         }
       }
     ]
   }

 GeoJSON has one parent object. Typically this is a collection object. Here, it is a FeatureCollection which defines three features. Each of these features has a geometry and one or more properties defined. The specification does not specify which properties should be supplied - these are specific to your application. All property values are objects. Although not in the above example, feature identifiers should be referred to using a feature member called "id".

Coordinates follow an x,y,z order. If using a projected system then this will be easting, northing, and altitude. For a geographic coordinate reference system, these will be longitude, latitude, altitude.

The default Coordinate Reference System (CRS) is the WGS84 geoid with longitude, latitude coordinates in decimal degrees. This can be overriden using a special "crs" object at the top level in the JSON hierarchy. Here is an example: [...]


Read more: http://www.geowebguru.com/articles/97-technical-overview-geojson

Ingen kommentarer:

Send en kommentar