DanTurco.GoogleMapExport2KML 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global DanTurco.GoogleMapExport2KML --version 1.0.2                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local DanTurco.GoogleMapExport2KML --version 1.0.2                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=DanTurco.GoogleMapExport2KML&version=1.0.2                
nuke :add-package DanTurco.GoogleMapExport2KML --version 1.0.2                

GoogleMapExport2KML

Parses .csv files generated from a google maps export of Saved Places. This fills the gap in Google of allowing you to import valid KML files from google maps into other mapping applications.

GoogleMapExport2Kml

Usage

  • Export your data from Google Takeout
  • Install this dotnet tool (DanTurco.GoogleMapExport2Kml) from Nuget dotnet tool install DanTurco.GoogleMapExport2Kml --global
  • Run commands to output your KML file. See below for command options and usage
    • goog2kml parse [OPTIONS]
Options
Short Command Long Command Description
-h --help Prints help information
-v --version Prints version information
--noheader If true. Does not display the banner on command execute
-f --file The csv files to parse
--includeComments If true. Adds any comment from the csv column to the description
-v --verbose If true. Increases the level of the output
--trace If true. Outputs all the tracing for each processing line
-s --stats If true. Outputs all the timing stats
-o --output The output KML file
-t --timeout The timeout to wait on each lookup for coordinates from Google. Default 10s
-p --parallel The number of threads used to process Google data locations. Default 4
-b --batch The number of batches used to process Google data locations. Default 10
--stopOnError If true. Stops parsing on any csv row error
--dryrun If true. Runs through the files and estimates times to completion
--placements-per-file The number of placements to add per KML file. Files will be named based on number of files needed. Default ALL
Example Commands
# Typical command
goog2kml parse -f=C:\downloads\myplaces.csv -f=C:\downloads\myfavoriteplaces.csv
-o=MyCombinedPlaces.kml --stats --stopOnError -p=10
# This will output an estimated time that it will take to complete the conversion
goog2kml parse -f=C:\downloads\myplaces.csv -f=C:\downloads\myfavoriteplaces.csv
-o=MyCombinedPlaces.kml --dryrun
# Creates multiple output files with 500 placemarks per file. This is useful for mapping
# applications that limit the amount of placemarks that can be imported at 1 time
goog2kml parse -f=C:\downloads\myplaces.csv -f=C:\downloads\myfavoriteplaces.csv
-o=MyCombinedPlaces.kml --placements-per-file=500
# Outputs all the lines and files being processed. Once all completed will output how much time
# each section took to complete
goog2kml parse -f=C:\downloads\myplaces.csv -f=C:\downloads\myfavoriteplaces.csv
-o=MyCombinedPlaces.kml --stats --trace
# Processes all the Google places lookups in parallel of 10 at a time. Note the more parallelism
# used the more load is placed on your computer
goog2kml parse -f=C:\downloads\myplaces.csv -f=C:\downloads\myfavoriteplaces.csv
-o=MyCombinedPlaces.kml -p=10

Errors and Solutions

Error: Index was out of range

Index out of range error

Solution
  • Increase the timeout for looking up the place in Google. The default is 10s and that is usually enough time, but if google has congestion this could impact lookup time.
  • Run the job over again
Screenshots
Typical Run

Typical Run

Dry Run

Dry Run

Verbose

Verbose

Trace

Verbose

Sample CSV File

Title,Note,URL,Comment
Dropped pin,,"https://www.google.com/maps/search/34.3948012,-111.1521886",
"39°42'51.2""N 106°09'53.8""W",,"https://www.google.com/maps/search/39.714212,-106.164947",
"39°43'00.7""N 106°09'41.6""W",,"https://www.google.com/maps/search/39.716858,-106.16156",
"39°43'05.2""N 106°09'19.0""W",,"https://www.google.com/maps/search/39.718111,-106.155271",
Pine Cove Campground,24/night FF,https://www.google.com/maps/place/Pine+Cove+Campground/data=!4m2!3m1!1s0x876a5eaa342bd02d:0xcabf37436295da63,
Clear Creek Reservoir Campground,,https://www.google.com/maps/place/Clear+Creek+Reservoir+Campground/data=!4m2!3m1!1s0x876aba47279efd93:0x38cdc8f3e4649fad,

Sample KML File

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.opengis.net/kml/2.50">
  <Document>
    <name>Camping</name>
    <Placemark>
      <description />
      <name>Dropped pin</name>
      <Point>
        <coordinates>34.3948012,-111.1521886</coordinates>
      </Point>
    </Placemark>
    <Placemark>
      <description />
      <name>Dropped pin</name>
      <Point>
        <coordinates>34.3754296,-111.1464524</coordinates>
      </Point>
    </Placemark>
    <Placemark>
      <description />
      <name>Dropped pin</name>
      <Point>
        <coordinates>34.3425726,-110.9879697</coordinates>
      </Point>
    </Placemark>
  </Document>
</kml>

Technical Notes

Under this covers this uses Playwright to lookup the translation from Google place to Latitude and Longitude. Becuase of this we are sometimes at the mercy of your internet connection and Google web throttling. Attempts are made to recover from these errors but sometimes it may result in a crash of the tool.

Changelog

Date Change Version
02/03/2024 Add support to convert Google CSV to KML 1.0
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.0.4 632 4/16/2024
1.0.3 766 2/22/2024
1.0.2 716 2/18/2024
1.0.1 674 2/9/2024
1.0.0 769 2/9/2024