4

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?

  • Quick clarification, I want to export the shapefiles as geojson to zoom to specific coordinates on the prerendered map. – Roy Kolak May 17 '13 at 17:00
  • 1
    Looks like your original shapefiles are in projection that is in metres/feet need to reproject into WGS84 then your will get the expected decimal degrees. – Mapperz May 17 '13 at 17:00
  • When I right click on a shapefile > Set Layer CRS.. it's currently set to 'WGS 84' and 'EPSG:4326'. Is that what you mean? – Roy Kolak May 17 '13 at 17:06
  • 1
    That is what the layer is set to, but the data is obviously ot EPSG:4326. Do you have a .prj file for your shapefile? You can look into it with any text editor. – AndreJ May 17 '13 at 17:25
  • 1
    Ok, thats correct. But what do you get if you rightclick on the layer ->properties, Metadata tab? The extent of the layer should be within +-90/180. – AndreJ May 17 '13 at 17:37
12

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....

  • 1
    Yes! You have saved the day. – Roy Kolak May 17 '13 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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