GML to GeoJSON Conversion

d3geojsongmlvisualisation

I have downloaded a GML file from Statistics Canada and would like to convert it into GeoJSON to use parts of it in a D3 visualization on the web. However, I did not find a converter that would do that for me (I tried http://converter.mygeodata.eu/ , but the GeoJSON it returned did not contain any actual geometry).

What is the best approach to convert GML into GeoJSON?

Best Answer

You Can use ogr2ogr. Simplest to install it would be to download fwTools.

the following command will do

ogr2ogr -f "GeoJSON" E:\lakes.geojson e:\lakes.gml

Else if you have QuantumGIS, you can add your GML layer to map and by Right-Clicking the Layer, Select Save As to GeoJSON format.