This simple tool takes a long KML path (like a hiking or driving route) and automatically splits it into smaller segments. For example, you can break a 10-day hiking route into 10 separate KML files, one for each day's journey.
You provide two KML files:
- A Route File: Contains the single, long path you want to split.
- A Points File: Contains the placemarks (pins) that mark where you want each segment to end.
The script then generates a new KML file for each segment. The name of each output file is based on the name of the placemark where that segment ends.
- Install Node.js from: https://nodejs.org/
- Open terminal.
- In the terminal, cd to the kml-slicerdirectory, run the following command. You only need to do this once.npm install 
Make sure your main KML file with the long path is located in the files folder. For this guide, we'll assume it's named caminho.kml.
This is how you tell the script where to cut the path.
- Open Google Earth.
- Find the location along your route where you want your first segment to end.
- Click the "Add Placemark" tool (the yellow pin icon) in the toolbar.
- A new placemark will appear. Drag it to the exact endpoint for your first segment.
- In the window that pops up, give the placemark a descriptive Name. This is important, as the name you enter here will be used for the generated KML file. For example, if you name the placemark "Day 1 End", the script will create a file named day_1_end.kml.
- Click OK.
- Repeat this process for every segment endpoint. If you have a 3-day trip, you will create 3 placemarks, one for the end of each day.
- When you are finished, look at the "Places" panel on the left. Right-click on the folder containing all the placemarks you just created and choose "Save Place As...".
- In the save window, make sure to set the "Save as type" to Kml (*.kml).
- Save the file inside the filesfolder in this project. For this guide, we'll assume you name itpoints.kml.
- Open your terminal again.
- Make sure you are in the kml-slicerdirectory.
- Run the following command. If you named your files differently, be sure to change the names in the command.
node index.js files/caminho.kml files/points.kml output/ 
Your new, segmented KML files will be created inside the output folder. You can open them in Google Earth or any other KML viewer.