I am trying to add an xyz source tile layer to OpenLayers v8.1.
The source URI for the tiles is the Chinese autonavi / amap provider.
http://webrd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}
When overlaid to the default OSM layer the amap tile layer appears shifted.
The shift of roughly 500m east, and 200m south seems to indicate that the autonavi tiles use a webmercator projection with a pseudo-datum like GCJ-02
Also referenced in this PROJ issue.
Does anybody know how to apply the datum shift to a web mercator projection for this XYZ/Tile layer?
I've created a codepen here.
const amap_layer = new ol.layer.Tile({
opacity: 0.5,
source: new ol.source.XYZ({
url:
"http://webrd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}"
})
});
new ol.Map({
target: "OL",
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
amap_layer
],
view: new ol.View({
center: ol.proj.fromLonLat([120.3, 30.3]),
zoom: 13
}),
controls: [
new ol.control.Zoom(),
new ol.control.ScaleLine({
minWidth: 64,
units: "metric"
})
]
});