I have a GeoJson file which has multiple polygons. Something like this.
I use Leaflet to render this GeoJson in a website.
I want to draw an outline around the polygoins that envelopes all the polygons. Something like this.
Format of GeoJSOn i am using :
{
"features": [
{
"geometry": {
"coordinates": [
[
[
1074.426,
-1136.986
],
[
1088.241,
-1123.171
]
]
],
"type": "Polygon"
},
"properties": {
"number": "2009",
"type": "",
"spaceid": null,
"alias": null,
"roomkey": "5/2009"
},
"type": "Feature"
}
],
"bbox": [
2445.578,
2445.578
],
"crs": {
"properties": {
"name": "urn:ogc:def:crs:OGC:1.3:CRS84"
},
"type": "name"
},
"type": "FeatureCollection"
}
Any pointers will be helpful :) Thanks
Your looking for the "convex hull":
Reference: https://en.wikipedia.org/wiki/Convex_hull
You can do that with Turf.js
convex
method:Reference: http://turfjs.org/docs/#convex
Example: