geometry.json 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. {
  2. "$schema": "http://json-schema.org/draft-04/schema#",
  3. "id": "http://json-schema.org/geojson/geometry.json#",
  4. "title": "geometry",
  5. "description": "One geometry as defined by GeoJSON",
  6. "type": "object",
  7. "required": [ "type", "coordinates" ],
  8. "oneOf": [
  9. {
  10. "title": "Point",
  11. "properties": {
  12. "type": { "enum": [ "Point" ] },
  13. "coordinates": { "$ref": "#/definitions/position" }
  14. }
  15. },
  16. {
  17. "title": "MultiPoint",
  18. "properties": {
  19. "type": { "enum": [ "MultiPoint" ] },
  20. "coordinates": { "$ref": "#/definitions/positionArray" }
  21. }
  22. },
  23. {
  24. "title": "LineString",
  25. "properties": {
  26. "type": { "enum": [ "LineString" ] },
  27. "coordinates": { "$ref": "#/definitions/lineString" }
  28. }
  29. },
  30. {
  31. "title": "MultiLineString",
  32. "properties": {
  33. "type": { "enum": [ "MultiLineString" ] },
  34. "coordinates": {
  35. "type": "array",
  36. "items": { "$ref": "#/definitions/lineString" }
  37. }
  38. }
  39. },
  40. {
  41. "title": "Polygon",
  42. "properties": {
  43. "type": { "enum": [ "Polygon" ] },
  44. "coordinates": { "$ref": "#/definitions/polygon" }
  45. }
  46. },
  47. {
  48. "title": "MultiPolygon",
  49. "properties": {
  50. "type": { "enum": [ "MultiPolygon" ] },
  51. "coordinates": {
  52. "type": "array",
  53. "items": { "$ref": "#/definitions/polygon" }
  54. }
  55. }
  56. }
  57. ],
  58. "definitions": {
  59. "position": {
  60. "description": "A single position",
  61. "type": "array",
  62. "minItems": 2,
  63. "items": [ { "type": "number" }, { "type": "number" } ],
  64. "additionalItems": false
  65. },
  66. "positionArray": {
  67. "description": "An array of positions",
  68. "type": "array",
  69. "items": { "$ref": "#/definitions/position" }
  70. },
  71. "lineString": {
  72. "description": "An array of two or more positions",
  73. "allOf": [
  74. { "$ref": "#/definitions/positionArray" },
  75. { "minItems": 2 }
  76. ]
  77. },
  78. "linearRing": {
  79. "description": "An array of four positions where the first equals the last",
  80. "allOf": [
  81. { "$ref": "#/definitions/positionArray" },
  82. { "minItems": 4 }
  83. ]
  84. },
  85. "polygon": {
  86. "description": "An array of linear rings",
  87. "type": "array",
  88. "items": { "$ref": "#/definitions/linearRing" }
  89. }
  90. }
  91. }