0

I get the following error when trying to get a getBounds for my map.

*proj4-src.js:1849 Uncaught TypeError: coordinates must be finite numbers
    at checkCoord (proj4-src.js:1849)
    at checkSanity (proj4-src.js:1841)
    at transform (proj4-src.js:1865)
    at transformer (proj4-src.js:1944)
    at Object.forward (proj4-src.js:2010)
    at NewClass.project (proj4leaflet.js:40)
    at vers copy.html:80*

I'm using a 28992 projection.

  var RD = new L.Proj.CRS(
        'EPSG:28992',
        '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369,50.0087,465.658,-0.406857330322398,0.350732676542563,-1.8703473836068,4.0812 +no_defs', {
        origin: [-285401.92, 22598.08],
        resolutions: [3440.640, 1720.320, 860.160, 430.080, 215.040, 107.520, 53.760, 26.880, 13.440, 6.720, 3.360, 1.680, 0.840, 0.420, 0.210, 0.105],
        bounds: L.bounds([-285401.92, 22598.08], [595401.920, 903401.920])


var wgs84 = map.getBounds().getEast();
console.log(wgs84);
RdNew= RD.projection.project(wgs84);
console.log(RdNew);

The console log for wgs84 gives the correct coordinate. The console log for RdNew gives the error listed above

  • If you look at the docs, you'll see that projection .project method requires L.latLng input parameter, but bounds .getEast() method returns just single number which is east longitude of the bounds. You have to use either .getSouthEast() or .getNorthEast method to get L.latLng coordinate. – TomazicM Jun 19 at 11:27

Your Answer

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

Browse other questions tagged or ask your own question.