Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
476 views
in Technique[技术] by (71.8m points)

leaflet - Proj4Leaflet reprojection like in openlayers

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...