I am trying to draw a shape (airplane) from external geojson file. Said shape uses data from 2 object structures inside the geojson file. I can load both shapes separately, but I can't append/join them together.
2 Answers
You have to merge your polygons before displaying them. The accepted answer in this question explains how to achieve that in detail.
-
that's an OL2 solution not an OL3, Is it working for OL3 too ? Jul 18, 2016 at 16:14
for OL3 it's a bit complicated since you'll have to read both features from both sources and do an union to them then you load them to a vector layer,
the union itself is made with turf you can download it from here:
var feature1,feature2;
var union=turf.union(feature1,feature2);
var formatGeoJSON= new ol.format.GeoJSON();
var yourResult=formatGeoJSON.readFeature(union);
Now you can load it in a vector layer to your map