19 | | Various extensions exist above the core GeoJSON specification: at the FeatureCollection, Feature or Geometry levels. See https://github.com/mapbox/carmen/blob/master/carmen-geojson.md, https://github.com/geocoders/geocodejson-spec/blob/master/draft/README.md or https://github.com/geojson/draft-geojson/issues/80#issuecomment-138037554 for a few examples. |
| 19 | Various extensions exist above the core GeoJSON specification: at the FeatureCollection, Feature or Geometry levels. |
| 20 | |
| 21 | See https://github.com/mapbox/carmen/blob/master/carmen-geojson.md, |
| 22 | |
| 23 | {{{ |
| 24 | { |
| 25 | "type": "FeatureCollection", |
| 26 | "query": ["austin"], |
| 27 | "features": [ |
| 28 | { |
| 29 | "type": "Feature", |
| 30 | "id": "place.4201", |
| 31 | "text": "Austin", |
| 32 | "place_name": "Austin, Texas, United States", |
| 33 | "bbox": [-97.9383829999999, 30.098659, -97.5614889999999, 30.516863], |
| 34 | "center": [-97.7559964, 30.3071816], |
| 35 | "geometry": { |
| 36 | "type": "Point", |
| 37 | "coordinates": [-97.7559964, 30.3071816] |
| 38 | }, |
| 39 | "properties": { |
| 40 | "title": "Austin", |
| 41 | "type": "city", |
| 42 | "score": 600000790107194.8 |
| 43 | }, |
| 44 | "context": [ |
| 45 | { |
| 46 | "id": "province.293", |
| 47 | "text": "Texas" |
| 48 | }, |
| 49 | { |
| 50 | "id": "country.51", |
| 51 | "text": "United States" |
| 52 | } |
| 53 | ] |
| 54 | }, |
| 55 | ... |
| 56 | ] |
| 57 | } |
| 58 | }}} |
| 59 | |
| 60 | https://github.com/geocoders/geocodejson-spec/blob/master/draft/README.md: |
| 61 | |
| 62 | {{{ |
| 63 | { |
| 64 | |
| 65 | // REQUIRED. GeocodeJSON result is a FeatureCollection. |
| 66 | "type": "FeatureCollection", |
| 67 | |
| 68 | // REQUIRED. Namespace. |
| 69 | "geocoding": { |
| 70 | |
| 71 | // REQUIRED. A semver.org compliant version number. Describes the version of |
| 72 | // the GeocodeJSON spec that is implemented by this instance. |
| 73 | "version": "0.1.0", |
| 74 | |
| 75 | // OPTIONAL. Default: null. The licence of the data. In case of multiple sources, |
| 76 | // and then multiple licences, can be an object with one key by source. |
| 77 | "licence": "ODbL", |
| 78 | |
| 79 | // OPTIONAL. Default: null. The attribution of the data. In case of multiple sources, |
| 80 | // and then multiple attributions, can be an object with one key by source. |
| 81 | "attribution": "OpenStreetMap Contributors", |
| 82 | |
| 83 | // OPTIONAL. Default: null. The query that has been issued to trigger the |
| 84 | // search. |
| 85 | "query": "24 allée de Bercy 75012 Paris", |
| 86 | |
| 87 | }, |
| 88 | |
| 89 | // REQUIRED. As per GeoJSON spec. |
| 90 | "features": [ |
| 91 | // OPTIONAL. An array of feature objects. See below. |
| 92 | ] |
| 93 | } |
| 94 | }}} |
| 95 | |
| 96 | or https://github.com/geojson/draft-geojson/issues/80#issuecomment-138037554 for a few examples. |
| 97 | |
| 98 | {{{ |
| 99 | { "type" : "GeometryCollection", |
| 100 | "geometries" : [ |
| 101 | { "type" : "LineString", |
| 102 | "extensions" : [ "time", "atemp", "hr", "cad" ], |
| 103 | "coordinates" : [ |
| 104 | [ |
| 105 | -122.45671039447188, |
| 106 | 37.786870915442705, |
| 107 | 0.4000000059604645, |
| 108 | "2014-11-06T19:16:06.000Z", |
| 109 | 31.0, |
| 110 | 99, |
| 111 | 0 |
| 112 | ], |
| 113 | }}} |
25 | | Two new members will be added to the OGRFeature class, nativeData (string) and nativeMediaType (string). nativeData will contain the representation (or part of the representation) of the original feature, and nativeMediaType the [https://en.wikipedia.org/wiki/Media_type media type] |
26 | | |
27 | | Thus, in the GeoJSON case, nativeData would contain the full serialization of a GeoJSON Feature. nativeMediaType would be set to "application/vnd.geo+json" |
| 119 | Two new members will be added to the OGRFeature class, m_pszNativeData (string) and m_pszNativeMediaType (string). m_pszNativeData will contain the representation (or part of the representation) of the original feature, and m_pszNativeMediaType the [https://en.wikipedia.org/wiki/Media_type media type] |
| 120 | |
| 121 | The following methods will be added to OGRFeature class: |
| 122 | |
| 123 | {{{ |
| 124 | public: |
| 125 | const char *GetNativeData() const; |
| 126 | const char *GetNativeMediaType() const; |
| 127 | void SetNativeData( const char* pszNativeData ); |
| 128 | void SetNativeMediaType( const char* pszNativeMediaType ); |
| 129 | }}} |
| 130 | |
| 131 | Thus, in the GeoJSON case, nativeData would contain the full serialization of a GeoJSON Feature. m_pszNativeMediaType would be set to "application/vnd.geo+json" |
51 | | The GeoJSON driver will be modified to implement this RFC. |
| 163 | The GeoJSON driver will be modified to implement this RFC, in read and write, and thus |
| 164 | wil* : |
| 165 | * declare a NATIVE_DATA open option to enable storing layer and feature native data. |
| 166 | * and NATIVE_DATA & NATIVE_MEDIA_TYPE layer creation options so as to be able to write native data at FeatureCollection levels |
| 167 | * use OGRFeature nativeData on write. |
| 168 | |
| 169 | The effect of this is that ogr2ogr will be able to preserve the members marked between {{{***}}} in the below snippet: |
| 170 | |
| 171 | {{{ |
| 172 | { |
| 173 | "type": "FeatureCollection", |
| 174 | ***"extra_fc_member": "foo",*** |
| 175 | "features": |
| 176 | [ |
| 177 | { |
| 178 | "type": "Feature", |
| 179 | ***"extra_feat_member": "bar",*** |
| 180 | "geometry": { |
| 181 | "type": "Point", |
| 182 | ***extra_geom_member": "baz",*** |
| 183 | "coordinates": [ 2, 49, 3, ***100, 101*** ] |
| 184 | }, |
| 185 | "properties": { |
| 186 | "a_property": "foo", |
| 187 | } |
| 188 | } |
| 189 | ] |
| 190 | } |
| 191 | }}} |
| 192 | |