Generic GeoJSON validation JSON Schema for GeoJSON

Copyright © 2015 Open Geospatial Consortium. 33 type: array, items: { type: object, required: [ type, properties], properties: { type: { enum: [ Feature ] }, geometry: { ref: definitionsgeometry }, properties: { type: object } } } } }, definitions: { geometry: { title: geometry, type: object, oneOf: [{ properties: { type: { enum: [ Point] }, coordinates: { type: array, minItems: 2, items: { type: number} } } }, { properties: { type: { enum: [ LineString, Multipoint]}, coordinates: { type: array, minItems: 2, items: { type: array, minItems: 2, items : { type: number } } } } }, { properties: { type: { enum: [ Polygon, MultiLineString]}, coordinates: { type: array, items: { type: array, minItems: 2, items: { type: array, 34 Copyright © 2015 Open Geospatial Consortium. minItems: 2, items : { type: number } } } } } }, { properties: { type: { enum: [ MultiPolygon] }, coordinates: { type: array, items: { type: array, items: { type: array, minItems: 2, items: { type: array, minItems: 2, items : { type: number } } } } } } }, { properties: { type: { enum: [ GeometryCollection]}, geometries: { type: array, items: { ref: definitionsgeometry } } } }] } } }

7.1.2 Specific GeoJSON validation

The generic schema presented before leaves open the nature of the geometry and the content of properties. A specific JSON schema that acts like a GML application schema could be more appropriate to better describe a GeoJSON instance type. In it we can limit: ฀ The possibilities of geometry to a specific geometry type e.g. LineString Copyright © 2015 Open Geospatial Consortium. 35 ฀ The content of properties to a set of recognized list of attributes even if in JSON schema we cannot validate the inclusion of unknown properties. This is an example of a river collection JSON file: { id: river:ExampleRiverCollection, type: FeatureCollection, features: [ { id: wikipedia:Mississippi_River, type: Feature, geometry: { id: wikipedia:Mississippi_River, type: LineString, crs: ogc_def:crsOGC1.3CRS84, coordinates: [ [ -95.2075, 47.239722 ], [ -89.253333, 29.151111 ] ] }, properties: { url: wikipedia:Mississippi_River, type: riverType, name: mississipi, length: 3734, discharge: 16790, source: Lake Itasca , mouth: Gulf of Mexico, country: United States of America, bridges: [ Eads Bridge, Chain of Rocks Bridge ] } }, { id: wikipedia:Ebro,