I have a large KML file that I would like to split into several smaller equal size KML. My original KML file has 311,055 polygon records and is too large to open in Google Earth as is. I would like to create several sub files from this file (e.g. 5 KML files with 62,211 records each).
Page 1 / 1
Pass all features through ModuloCounter with Count Maximum set as 5. Then set "_modulo_count" as the fanout on the KML writer (e.g. @Value(_modulo_count).kmz ). You will get 5 output kmz called 0.kmz, 1.kmz, 2.kmz, 3.kmz, 4.kmz.
And once you have split your big KMZ file into 5 smaller ones, you might want to create a single master KMZ file that references all 5 KMZ files using KML Network Links. This means your users will only be dealing with just one file, because the other 5 get loaded behind the scene.
Initially, it will be a bit tricky to get your head around how FME deals with KML, but basically:
- Create a Writer for your 'master.KMZ'
- In this writer, there is only 1 feature type, and the name must be set to 'NetworkLink', because this KMZ will not contain any features, only links to your 5 KMZ files.
- Before your Writer, you will need an AttributeCreator (or AttributeManager) where you set 'kml_id' and 'kml_name' to your group name, e.g. 'Group @Value(_modulo_count)' and your 'kml_link_href' attribute to 'MyDataFolder/@Value(_modulo_count).kmz'. I have attached a screenshot of the AttributeCreator in one of my workspaces, where I have created a separate KMZ for each PostcodeDistrict.
Also see Google Documentation on KML Network Links and an example how this KML Network Link is implemented in FME