Transform <Polygon> entities from KML into their 'mask' (inverted polygon) equivalents.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 0668e51 Oct 2, 2011

README

Transform KML polygons in their 'mask' equivalent entities. 
For each <Placemark>:
- an universe rectangle(polygon) that covers the studied area is created.
- all the previous inner boundaries (holes) become stand-alone polygons and forces a <MultiGeometry> to be created
- the previous outer boundary become a hole in the universe polygon created

Usage example:
$ xsltproc invert.xsl cantons.kml > cantons_inverted.kml

If you want to customize the masking area, use 'mask' via --stringparam:
$ xsltproc --stringparam mask '-25,15 40,15 40,80 -25,80 -25,15' invert.xsl cantons.kml > cantons_inverted.kml

The attached 'cantons.kml' is generated from Swisstopo GG25 dataset.
http://www.toposhop.admin.ch/en/shop/products/landscape/gg25_1

For a demo output check this Swiss boundaries map integration (Google Maps, Google Fusion Tables)
http://www.vasile.ch/hacks/ft-mask/