I have klokantech docker container for openmaptiles. Now I want take the KML of the country border and grey all outside the country.


A solution may be to use a Leaflet plugin that inverts polygons, such as Leaflet.snogylop. An example.

enter image description here

  • not bad! But I look for a solution for mapbox gl js. – Gerd Nov 16 '17 at 8:42
  • Consider that Mapbox GL and Leaflet can be used together using mapbox-gl-leaflet. – Antonio Falciano Nov 16 '17 at 9:56

The interesting polygon is a difference of bounding box and the border polygon. This difference polygon you can hide. For making difference it's good to use the turfjs tool.


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.