- Is this a valid GeoJSON?
- Can it be displayed using LeafLet GeoJSON Layer?
"geometry": {
"coordinates": [{
"coordinates": [{
"type": "LineString",
"coordinates": [{
"x": 63.176,
"y": 34.354
},
...
{
"x": 63.176,
"y": 34.354
}]
}],
"type": "Polygon"
}, {
"coordinates": [{
"type": "LineString",
"coordinates": [{
"x": 69.169,
"y": 32.875
},
...
{
"x": 69.169,
"y": 32.875
}]
}],
"type": "Polygon"
}],
"type": "MultiPolygon"
}}
Background:
With the goal of displaying GeoJSONs(indexed in Elasticsearch as geo_shape) in a LeafLet-based map in my frontend.
- I retrieve them from a REST API featuring SpringData.
- The repository maps Elasticsearch-data to a generic
org.springframework.data.elasticsearch.core.geo.GeoJsoninterface, as my indexed data can contain Polygons or Multipolygons. - Original shapes are indexed from a .shp file using ogr2ogr.
A GeoJSON object has a member with the name "type". The value of the member MUST be one of the GeoJSON types.so that there can be only one type and thus your geometry with two types is not valid. But you can use a GeometryCollection https://gis.stackexchange.com/questions/193590/can-a-geojson-multigeometry-contain-a-multipoint-among-other-geometries. – user30184 Jan 16 '22 at 14:43