I have a requirement to convert .KML file to GeoJSON or JSON. Can you please recommend open source command line tools on GNU/Linux(2.6.32-358.14.1.el6.x86_64)? I have installed gdal, when I run..

ogr2ogr -f "GeoJSON" geojson.json Areas.kml

I get this error :-

Unable to open datasource `Areas.kml' with the following drivers. -> ESRI Shapefile -> MapInfo File -> UK .NTF -> SDTS -> TIGER -> S57 -> DGN -> VRT -> REC -> Memory -> BNA -> CSV -> GML -> GPX -> KML -> GeoJSON -> GMT -> AVCBin

  • Welcome to GIS SE! You have included a qgis tag but make no mention of it in your Question body or title. If it is not part of the specific workflow you are asking about here then I recommend that you edit your Question to remove it.
    – PolyGeo
    Apr 12, 2014 at 6:25

1 Answer 1


The correct syntax is:

ogr2ogr -f GeoJSON geojson.json Areas.kml

You can also use togeojson (Online Maps moving forward, from KML to GeoJSON)

togeojson Areas.kml > geojson.json
  • Thanks. togeojson worked. Do we have any open source tools to convert hml to esrijson or geojson to esrijason? Thanks Again. Apr 13, 2014 at 4:18
  • esri_to_geojson.py and geo_to_esri.py for example
    – gene
    Apr 13, 2014 at 15:33
  • The original ogr2ogr syntax was also correct. Using "GeoJSON" is OK, and sometimes the syntax is compulsory, like -f "ESRI Shapefile". Next time, tell the GDAL version and try to share a sample from the failing data.
    – user30184
    May 28, 2014 at 21:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.