Skip to main content
Solved

Split single KML into multiple KML files with equal record count


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).

Best answer by todd_davis

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.

View original
Did this help you find an answer to your question?

2 replies

todd_davis
Supporter
Forum|alt.badge.img+20
  • Supporter
  • Best Answer
  • August 14, 2016

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.


arnold_bijlsma
Enthusiast
Forum|alt.badge.img+14

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:

  1. Create a Writer for your 'master.KMZ'
  2. 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.
  3. 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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings