GeoJDIL

From GeoJSON
Revision as of 10:45, 1 June 2007 by Crschmidt (Talk | contribs) (i hate wikitext)

Jump to: navigation, search

GeoJDIL is an additional layer above GeoJSON. GeoJDIL is the preferred format for representation of geographic information in JDIL, the JSON Data Interchange Language.

There are a number of constructs which may be useful for applications which are not described wholly by GeoJSON. Specifically, the description of feature types is not defined in GeoJSON. However, at least some existing users have the desire to describe this information. It is recommended that these users use GeoJDIL.

A GeoJDIL document must have one additional property on the top level JSON object. The key for this property must be "@namespaces", and the value is an object, whose key/value members are associations of short strings (prefixes) to URLs (namespaces). For example:

  "@namespaces":  {"":"http://geojson.org/ns#", "atom":"http://www.w3.org/2005/Atom"},

Features may also have a '@type' property, which describes the Feature type, as in this example:

{
  "@namespaces":  {"":"http://geojson.org/ns#", "atom":"http://www.w3.org/2005/Atom"},
  "@type": "atom:item",
  "type": "Feature",
  "geometry": {
      "type": "LineString",
      "coordinates": [
          [100.0, 0.0], [101.0, 1.0]
      ]
  },
  "properties": {
      "atom:summary": "Some GeoJSON Content",
      "atom:description": "This content is also valid GeoJDIL."
  }
}

GeoJSON output must include a 'type' attribute, so in a case where a producer wishes to create GeoJDIL but no appropriate '@type' is available, that producer can duplicate the type information from the GeoJSON 'type', but that 'type' must be included, even if it is the same as the '@type' attribute.

GeoJSON implementations may assign meaning to the namespace prefixes, but it is expected that most properties will be treated as strings. Therefore, the GeoJSON namespace must be the default namespace.

In summary:

  • GeoJDIL is said to be GeoJSON which includes a top level 'namespaces' property which defines a default namespace, and may define additional namespaces for any attribute name which contains a ':', where the value before the ':' is expected to map to a namespace prefix.
  • GeoJDIL producers must provide a 'type' property, even if they provide a '@type' property. The '@type' will typically only differ if there is a specific feature type being described, which GeoJSON does not have the built in mechanism for handling.
  • General JDIL consumers who are consuming GeoJSON, which does not have a top level 'namespaces' property, can transform GeoJSON to JDIL by adding a 'namespaces' element at the top level which contains only the GeoJSON namespace with a null prefix. General JDIL consumers can also transform GeoJDIL to be more consistent with usage of JDIL by treating any 'type' properties as equivalent to JDIL '@type' properties when no other '@type' property is available. However, JDIL produced with a '@type' property and no 'type' property is not valid GeoJSON, and should not expected to be exchanged with GeoJSON/GeoJDIL consumers.