Leaflet map with WMS and custom projection

时光毁灭记忆、已成空白 提交于 2020-01-14 07:53:28

问题


I have implemented a map using Leaflet and tiles from a WMS-service. They offer a list of projections, where of one is usable in standard Leaflet EPSG:4326.

However, the map looks a bit distorted, and I recon one of the other projections would be better. The supplier of the maps uses EPSG:32624, but I cannot seem to get that projection right.

This is the complete list: EPSG:32624, EPSG:32619, EPSG:32620, EPSG:32621, EPSG:32622, EPSG:32623, EPSG:32624, EPSG:32625, EPSG:32626, EPSG:32627, EPSG:4326, EPSG:3413, EPSG:3575

I have a fiddle here: http://jsfiddle.net/uyrv2j7f/2/

There are two maps, top one is using desired projection, but not really working. Bottom one is using a working, but distorted projection.

I'm quite sure, that I need to edit the configuration of the crs. But to what? Where to find the info?

I have found the first part here: http://spatialreference.org/ref/epsg/wgs-84-utm-zone-24n/ - the rest I have nicked for examples using other projections.

var crs = new L.Proj.CRS('EPSG:32624',
    '+proj=utm +zone=24 +ellps=WGS84 +datum=WGS84 +units=m +no_defs', {
    resolutions: [
        2116.670900008467, 
        1058.3354500042335, 
        529.1677250021168, 
        264.5838625010584, 
        132.2919312505292, 
        66.1459656252646, 
        26.458386250105836, 
        13.229193125052918, 
        6.614596562526459, 
        2.6458386250105836, 
        1.3229193125052918, 
        0.6614596562526459, 
        0.33072982812632296, 
        0.21166709000084669
    ],
    transformation: new L.Transformation(1, -500, -1, 7017000)
});

Hope someone can help me out.

Alternatively: Leaflet works like a charm for me normally and is preferred library for the case. BUT should someone bee able to Help med out using different library, then I'd be very interested.....

UPDATE: tinproject gave some pointers, I went looking, and this version is closer to the wanted result: http://jsbin.com/rehoxu/5/edit?html,css,js,output

I'd still like inputs on how to really define the variables for the custom-projections though...

来源:https://stackoverflow.com/questions/31070949/leaflet-map-with-wms-and-custom-projection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!