问题
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