KML files are commonly exported from Google Earth, Google My Maps, and various GPS devices. While KML is great for visualization in Earth-based applications, web developers and data analysts often need the same data in GeoJSON format for use with JavaScript mapping libraries, geospatial APIs, and data processing pipelines. Converting between these formats used to require desktop GIS software like QGIS or command-line tools like ogr2ogr, but today you can do it entirely in the browser.
Step 1: Open GeoDataTools
To convert a KML file to GeoJSON using GeoDataTools, open the app and either drag your .kml file onto the map or click the upload button to browse for it. The file is parsed entirely in your browser using a Web Worker, so your data never leaves your device — an important consideration when working with sensitive or proprietary geographic information.
Step 2: Review Your Data
Once loaded, all features appear on the interactive map with their original properties intact. You can use the attribute table to inspect individual features, apply filters by geometry type or property values, and verify that your data looks correct before exporting.
Step 3: Export as GeoJSON
Click the export button and select GeoJSON as the output format. The tool generates a standards-compliant GeoJSON FeatureCollection with WGS 84 coordinates. You can also apply filters before exporting — for example, exporting only polygon features or features matching a specific attribute value — which saves a separate post-processing step. The downloaded file is ready to use in Leaflet, Mapbox, Turf.js, or any other tool that accepts GeoJSON input.
What Converts and What Doesn't
- Geometry — All KML geometry types (Point, LineString, Polygon, MultiGeometry) convert to their GeoJSON equivalents
- Properties — Extended data and custom schemas in KML are mapped to GeoJSON feature properties where possible
- Styling — KML styling information (icons, colors, line widths) does not have a direct equivalent in GeoJSON, so visual styles are not preserved
- Network links — KML network links and screen overlays are skipped since GeoJSON only represents geographic geometry and attributes
Alternative Conversion Methods
If you prefer command-line tools, GDAL's ogr2ogr utility is the industry standard:
ogr2ogr -f GeoJSON output.geojson input.kml
For programmatic conversion in Python, the fiona or geopandas libraries can read KML and write GeoJSON. For JavaScript projects, libraries like @tmcw/togeojson parse KML into GeoJSON objects directly.
FAQ
Is my data sent to a server during conversion?
No. GeoDataTools processes everything in your browser using Web Workers. Your files never leave your device, making it safe for sensitive or proprietary data.
Can I convert KMZ files too?
KMZ is a zipped KML file. Extract the .kml file from the archive first, then convert it using the same process described above.
Will my KML styles be preserved?
No. GeoJSON does not have a styling specification. Styles need to be applied at the rendering layer in your mapping library. See our GeoJSON vs KML comparison for more details on format differences.