如何设置传单地图以在 ESRI:102012 投影中显示 WMS 图层?

问题描述 投票:0回答:1

我的 wms 服务器上有一些图层位于 ESRI:102012 srs 中。 http://spatialreference.org/ref/esri/102012/

服务器接受 EPSG:102012 srs 的 getmap 请求。

我正在使用 proj4leaflet 插件来设置适当的投影。 但我一直坚持定义 L.Transformation、分辨率和尺度。谁能告诉我参数应该是什么或提供示例吗?

projection leaflet wms srs proj
1个回答
0
投票

您好,这里是如何使用 proj4leaflet 插件为 Leaflet 中的 ESRI:102012 投影设置这些参数的示例

// Define the ESRI:102012 projection
proj4.defs("ESRI:102012", "+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs");

// Create a CRS object for the ESRI:102012 projection
var crs = new L.Proj.CRS("ESRI:102012",
    "+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs", {
        resolutions: [8192, 4096, 2048, 1024, 512], // Define the resolutions for different zoom levels
        origin: [0, 0], // Define the origin in projected coordinates
        bounds: L.bounds([Number.MIN_VALUE, Number.MIN_VALUE], [Number.MAX_VALUE, Number.MAX_VALUE]) // Set the bounds
});

// Create the map with the ESRI:102012 projection
var map = L.map('map', {
    crs: crs
});

// Set the initial view and center of the map
map.setView([0, 0], 4);

// Add a WMS layer with the ESRI:102012 projection
var wmsLayer = L.tileLayer.wms('http://your-wms-server-url', {
    layers: 'your-wms-layer-name',
    format: 'image/png',
    transparent: true
}).addTo(map);

© www.soinside.com 2019 - 2024. All rights reserved.