6

I'm very new to projections and struggling to convert a map dataset from OSGB36 (Eastings and Northings) to WGS84 (lat/longs).

I've used geopandas to import a shapefile. Now I want to export it as GeoJSON so I can then use Folium to map it on leaflet.js.

If I check the crs variable with .crs I get:

{u'datum': u'OSGB36',
u'k': 0.999601272,
u'lat_0': 49,
u'lon_0': -2,
u'no_defs': True,
u'proj': u'tmerc',
u'units': u'm',
u'x_0': 400000,
u'y_0': -100000} 

Trouble is if I'm a bit lost on the attributes to set to convert it to WGS84:

staffs.to_crs({'datum':"wgs84"})

RuntimeError: projection not named

Can you help?

1 Answer 1

7

This should work:

staffs.to_crs(epsg=4326)
5
  • Oh. One problem. The conversion seems to have mapped northings and eastings to the wrong corresponding figure. I guess that's part of the dataset I was given. Don't suppose there's a simple transform? (No problems, if not).
    – elksie5000
    Mar 27, 2014 at 19:38
  • Do you mean northings and eastings are reversed? Mar 27, 2014 at 19:51
  • Yes. I'm very new with this geo stuff.
    – elksie5000
    Mar 27, 2014 at 19:54
  • Actually, that's not true. I've just imported it into Folium and now the map displays beautifully.
    – elksie5000
    Mar 27, 2014 at 19:56
  • I don't know the source of your specific problem, but it's a common problem for beginners to reverse coordinate orders since in we generally say (latitude, longitude) and (northing, easting), but most mapping software uses cartesian ordering (x,y) and is therefore in a different order. Mar 27, 2014 at 20:30

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.