Wiki

Clone wiki

gnd / GeoJSON_Thoughts

Introduction

There's always merit in adopting existing standards. There is merit in adopting GeoJSON as a standard since the OpenLayers app provides direct support for GeoJSON data.

Aims

  • Easy support for showing tracks in OpenLayers
  • A data structure that can be validated
  • Easy parsing/manipulation of data from a GWT front-end

Problems

  • GeoJSON does not have concept of time. The only way-around this I've seen is for the "properties" element to contain a "times" element that is an array of time-stamps. The array is the same length as the number of elements in the LineString, with one time-stamp per LineString coordinate. See the example below. This approach can also be used for other non-spatial attributes (speed, heading, etc).

Ideas

  • GeoJSON allows for a bounding box in the geometry - that should be useful
  • In the properties object we can store Document Metadata

Example

Plain GeoJSON:

{
   "geometry": {
       "type": "LineString",
       "coordinates": [
           [
               -5,
               55
           ],
           [
               -6,
               54
           ]
       ]
   },
   "type": "Feature",
   "crs": {
       "type": "name",
       "properties": {
           "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
       }
   },
   "properties": {
       "title": "123132342342d"
   }
}

Example with Time data

{
   "_id": "a245d4184dfc4e11baf2269ded0bee22",
   "_rev": "1-eeb6626166f6cd4685f4d0d348b3b90c",
   "geometry": {
       "type": "LineString",
       "coordinates": [
           [
               "-0.2366333",
               "50.79767"
           ],
           [
               "-0.2308667",
               "50.77638"
           ],
           [
               "-0.2304833",
               "50.77308"
           ],
           [
               "-0.2281",
               "50.75757"
           ],
           [
               "-0.2214167",
               "50.7351"
           ],
           [
               "-0.2194167",
               "50.72853"
           ],
           [
               "-0.2152167",
               "50.71582"
           ],
           [
               "-0.211",
               "50.70312"
           ],
           [
               "-0.2089",
               "50.6966"
           ],
           [
               "-0.2046667",
               "50.68342"
           ],
           [
               "-0.2026",
               "50.67678"
           ],
           [
               "-0.1903667",
               "50.6391"
           ],
           [
               "-0.1880167",
               "50.63308"
           ],
           [
               "-0.1810333",
               "50.61427"
           ],
           [
               "-0.1694",
               "50.58363"
           ],
           [
               "-0.1670667",
               "50.57773"
           ],
           [
               "-0.1562833",
               "50.54987"
           ],
           [
               "-0.1493833",
               "50.53176"
           ],
           [
               "-0.14665",
               "50.52443"
           ],
           [
               "-0.1444333",
               "50.51852"
           ],
           [
               "-0.1397333",
               "50.50617"
           ],
           [
               "-0.1370833",
               "50.49928"
           ],
           [
               "-0.1318167",
               "50.4872"
           ],
           [
               "-0.1191",
               "50.45875"
           ],
           [
               "-0.1162833",
               "50.45257"
           ],
           [
               "-0.1109167",
               "50.4406"
           ],
           [
               "-0.09625",
               "50.40703"
           ]
       ]
   },
   "type": "Feature",
   "crs": {
       "type": "name",
       "properties": {
           "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
       }
   },
   "properties": {
       "title": "236108000",
       "time": [
           "2012_01_10T14:07:56Z",
           "2012_01_10T14:19:56Z",
           "2012_01_10T14:22:56Z",
           "2012_01_10T14:34:56Z",
           "2012_01_10T14:40:55Z",
           "2012_01_10T14:43:55Z",
           "2012_01_10T14:46:55Z",
           "2012_01_10T14:52:55Z",
           "2012_01_10T14:55:55Z",
           "2012_01_10T14:58:55Z",
           "2012_01_10T15:01:55Z",
           "2012_01_10T15:13:55Z",
           "2012_01_10T15:16:55Z",
           "2012_01_10T15:22:55Z",
           "2012_01_10T15:31:55Z",
           "2012_01_10T15:34:55Z",
           "2012_01_10T15:43:55Z",
           "2012_01_10T15:49:55Z",
           "2012_01_10T15:52:55Z",
           "2012_01_10T15:55:55Z",
           "2012_01_10T15:58:55Z",
           "2012_01_10T16:01:55Z",
           "2012_01_10T16:07:55Z",
           "2012_01_10T16:13:55Z",
           "2012_01_10T16:16:55Z",
           "2012_01_10T16:19:55Z",
           "2012_01_10T16:31:55Z"
       ]
   }
}

Updated