Closed danzhuibing closed 7 years ago
finally I figure it out by myself:
var get_resolution = function() {
level = 19;
var res = [];
res[0] = Math.PI * 2 * 6378137 / 256;
for(var i = 1 ; i < level; i++) {
res[i] = Math.PI * 2 * 6378137 / 256 / Math.pow(2, i);
}
return res;
};
var crs = new L.Proj.CRS('EPSG:3857',
'+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs',
{
resolutions: get_resolution(),
origin: [-Math.PI * 2 * 6378137 / 2.0, Math.PI * 2 * 6378137 / 2.0],
bounds: L.bounds([-20037508.342789244, 20037508.342789244], [20037508.342789244, -20037508.342789244])
}
);
I know EPSG 3857 is the default CRS for Leaflet. I'm just curious about how to define EPSG 3857 by Proj4Leaflet.
My sketch code is:
I just couldn't figure out the ? syntax in the code. Can anyone help?