Proj4Leaflet reprojection like in openlayers

梦想的初衷 提交于 2020-01-03 19:06:38

问题


I try to display several layers in own projections on base map also in it's own projection

Below my working example implemented using OpenLayers + proj4 library

var projection_name = 'EPSG:32610';
proj4.defs(projection_name, "+proj=utm +zone=10 +datum=WGS84 +units=m +no_defs");
var proj = ol.proj.get(projection_name);
var my_custom_layer = new ol.layer.Tile({
opacity: 0.5,
source: new ol.source.XYZ({
url: '',
projection: proj,
})
});

var osm_layer = new ol.layer.Tile({
source: new ol.source.MapQuest({layer: 'osm'}),
opacity: 0.3
});

with OpenLayers I can create something like this
var map = new ol.Map({
layers: [osm_layer, my_custom_layer],
target: 'map',
view: new ol.View({
projection: 'EPSG:4326',
center: [-122.347, 37.805],
zoom: 9
})
});

And as result will be rendered map in projection 4326 and layer in another projection (epsg:32610). Each tile of my_custom_layer will be transformed its figure to fit for base map projection. So my tile server every time returns simple square (256x256) tile and OL will transform square to some new figure.

Is it possible to implement it using Leaflet + Proj4Leaflet?


回答1:


No, Leaflet and/or Proj4Leaflet doesn't support bitmap reprojection.

Proj4leaflet can be used to support other projections than the ones already built into Leaflet, but your layers will still all have to be in the same projection as the map.



来源:https://stackoverflow.com/questions/36036347/proj4leaflet-reprojection-like-in-openlayers

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