0

I am a newbie to leaflet, and need an crs function sample to create an system that can change the coordinate system from EPSG:3857 to EPSG:3826. The basic library for coordinate I hope to use is proj4js, and I have the sample code as following:

proj4.defs('EPSG:3826', '+proj=tmerc +lat_0=0 +lon_0=121 +k=0.9999 +x_0=250000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +type=crs');;
proj4.defs("GOOGLE", "EPSG:3857");
var coord = proj4("EPSG:3826", "GOOGLE", [longitude, latitude]);

However, to create crs for leaflet need more to define, is there any good sample to refer for me to write a library to make that? Any instruction is highly appreciated, thanks a lot.

2
  • 1
    You can get the proj4js definition for EPSG:3857 from epsg.io/3857 – that should be enough: proj4.defs("EPSG:3857","+proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs"); Commented Sep 25, 2023 at 7:13
  • I can not figure out the crs function for leaflet via these two proj4.defs(). The codes I hope to create seems like this : var map = new L.Map('map', {crs: crs, crossOrigin: true}); and crs function obj is like var crs = .....some definition for cooridate. Commented Sep 25, 2023 at 7:29

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.