Sunday 7 August 2016

leaflet - How to get correct format of coordinates for export to geojson from QGIS?


I've created a custom map in QGIS with a few shapefiles. I'm using leaflet.js to render the map and the shapefile points and everything lines up correctly. The CRS is set to 4326.


When I export the shapefiles as geojson from QGIS, the coordinates are huge and look something like this: 9949941.925330460071564, -12405330.17722519300878


Leaflet is expecting coordinates that look like this: 82.9687,63.2336


Anyone have any insight into resolving this problem?




Answer



Try to change the layer CRS with Rightclick ->Set Layer CRS to EPSG:3857. To verify that your data is in the correct place you can load the openlayers plugin with Google or Openstreetmap background.


For Geojson export, the target CRS must be EPSG:4326. You have to set that manually when using Rightclick->Save As....


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...