calvinmetcalf / leaflet.shapefile

Shapefile in Leaflet
http://calvinmetcalf.github.io/leaflet.shapefile/
MIT License
256 stars 119 forks source link

British_National_Grid Projection #17

Open outmost opened 9 years ago

outmost commented 9 years ago

Apologies if I'm being stupid, I have a shape file in the following projection: PROJCS["British_National_Grid",GEOGCS["GCS_OSGB_1936",DATUM["D_OSGB_1936",SPHEROID["Airy_1830",6377563.396,299.3249646]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",-100000.0],PARAMETER["Central_Meridian",-2.0],PARAMETER["Scale_Factor",0.9996012717],PARAMETER["Latitude_Of_Origin",49.0],UNIT["Meter",1.0]]

When adding this to the map, the objects are offset from their correct position by around 200m East /North-East.

I've tried digging through the code in shp, and can't work out whether the projection is automatically detected and converted, or whether I will need to manually convert or pass any options.

calvinmetcalf commented 9 years ago

The projection stuff is in a different project called proj4 On Oct 28, 2014 6:08 AM, "Tom Sutton" notifications@github.com wrote:

Apologies if I'm being stupid, I have a shape file in the following projection:

PROJCS["British_National_Grid",GEOGCS["GCS_OSGB_1936",DATUM["D_OSGB_1936",SPHEROID["Airy_1830",6377563.396,299.3249646]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",400000.0],PARAMETER["False_Northing",-100000.0],PARAMETER["Central_Meridian",-2.0],PARAMETER["Scale_Factor",0.9996012717],PARAMETER["Latitude_Of_Origin",49.0],UNIT["Meter",1.0]]

When adding this to the map, the objects are offset from their correct position by around 200m East /North-East.

I've tried digging through the code in shp, and can't work out whether the projection is automatically detected and converted, or whether I will need to manually convert or pass any options.

— Reply to this email directly or view it on GitHub https://github.com/calvinmetcalf/leaflet.shapefile/issues/17.

tomchadwin commented 9 years ago

I think the definition might not be quite right. The one I use in Leaflet with proj4leaflet is:

'+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +towgs84=446.448,-125.157,542.06,0.15,0.247,0.842,-20.489 +units=m +no_defs',