Skip to content

davidraviv/kml-slicer

Repository files navigation

KML Path Slicer

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.

How It Works

You provide two KML files:

  1. A Route File: Contains the single, long path you want to split.
  2. 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.

Installation (One-Time Setup)

1. Install Node.js

2. Install Dependencies

  • Open terminal.
  • In the terminal, cd to the kml-slicer directory, run the following command. You only need to do this once.
    npm install

Step-by-Step Guide

Step 1: Prepare Your Route KML

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.

Step 2: Create Your Slicing Points in Google Earth

This is how you tell the script where to cut the path.

  1. Open Google Earth.
  2. Find the location along your route where you want your first segment to end.
  3. Click the "Add Placemark" tool (the yellow pin icon) in the toolbar.
  4. A new placemark will appear. Drag it to the exact endpoint for your first segment.
  5. 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.
  6. Click OK.
  7. 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.
  8. 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...".
  9. In the save window, make sure to set the "Save as type" to Kml (*.kml).
  10. Save the file inside the files folder in this project. For this guide, we'll assume you name it points.kml.

Step 3: Run the Tool

  1. Open your terminal again.
  2. Make sure you are in the kml-slicer directory.
  3. 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/

Step 4: Find Your Files

Your new, segmented KML files will be created inside the output folder. You can open them in Google Earth or any other KML viewer.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published