1

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

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 ? – Hicham Zouarhi Jul 18 '16 at 16:14
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.