kartena / Proj4Leaflet

Smooth Proj4js integration with Leaflet.
http://kartena.github.io/Proj4Leaflet/
BSD 2-Clause "Simplified" License
590 stars 173 forks source link

Unable to set MaxBounds using grid based datum adjustments using the +nadgrids in Proj4 #185

Open CityBelfast opened 2 years ago

CityBelfast commented 2 years ago

Our application is using both the OS-Maps Api and OS-Features Api in EPSG:27700 projection. Therefore, we need to define the coordinate reference system such that Leaflet can apply the correct datum transformation and align everything as expected. see the OS guide below. image

https://www.ordnancesurvey.co.uk/business-government/tools-support/os-net/for-developers

https://www.ordnancesurvey.co.uk/documents/resources/guide-coordinate-systems-great-britain.pdf

However, we are getting wrong TOID selection if user click around the border of a property boundary. see the below image.

In August 2016, Ordnance Survey released a transformation grid called OSTN15 which improves the accuracy of the transformation between OSGB36/British National Grid and WGS84. In order to get the accuracy, Proj4js Ver.2.7.0 needs to be configured for grid based datum adjustments using the +nadgrids keyword in a coordinate system definition. The downside to this is that grid based adjustments file (i.e. OSTN15_NTv2_OSGBtoETRS.gsb) is 15mb, which isn’t ideal for web-based applications; but it is required to get the accuracy on the TOID selection kind of functionality.

Now the accuracy of TOID issue got resolved after implementing OSTN15. But we are facing another issue either on proj4 due to this implementation because now we are not able to set the maximum bounding box(i.e. maxBounds) option on the map and getting errors on the browser console window.

image