如何将叠加层添加到我的 OpenStreetMap
我目前使用谷歌地图并通过使用 PHP 脚本生成所需的 PNG 图像为其创建图块
var myTileLayer = new GTileLayerOverlay(
new GTileLayer(null, null, null, {
//tileUrlTemplate: 'Overlays/Overlay_{Z}_{X}_{Y}.png',
tileUrlTemplate: 'gentile.php?Zoom={Z}&TileX={X}&TileY={Y}',
isPng:true,
opacity:1.0
})
);
map.addOverlay(myTileLayer);
我现在希望使用 OpenStreetMap 并根据此来源: http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example
我需要使用此代码来实现这一点,但是它似乎希望我在需要时使用预制图块动态生成它们
var newLayer = new OpenLayers.Layer.OSM("New Layer", "URL_TO_TILES/${z}/${x}/${y}.png", {numZoomLevels: 19});
map.addLayer(newLayer);
真的我需要使用 gentile.php?Zoom={Z}&TileX={X}&TileY={Y}
I currently use a google map and create tiles for it by using a PHP script to generate the required PNG images
var myTileLayer = new GTileLayerOverlay(
new GTileLayer(null, null, null, {
//tileUrlTemplate: 'Overlays/Overlay_{Z}_{X}_{Y}.png',
tileUrlTemplate: 'gentile.php?Zoom={Z}&TileX={X}&TileY={Y}',
isPng:true,
opacity:1.0
})
);
map.addOverlay(myTileLayer);
I now wish to use OpenStreetMap and according to this source: http://wiki.openstreetmap.org/wiki/OpenLayers_Simple_Example
I need to use this code to acheive that, however it seems to want me to use premade tiles when I want to gen them on the fly
var newLayer = new OpenLayers.Layer.OSM("New Layer", "URL_TO_TILES/${z}/${x}/${y}.png", {numZoomLevels: 19});
map.addLayer(newLayer);
Really I need to use gentile.php?Zoom={Z}&TileX={X}&TileY={Y}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想,您想使用 OpenLayers 在 OSM(或其他)地图上显示您自己的叠加层吗?
你必须使用,你的图块位于像“gentile.php?Zoom={Z}&TileX={X}&TileY={Y}”这样的URL
所以尝试添加图层:
我用过一年前...
如果这不起作用,请编写一个 htaccess - mod_rewrite
例如类似的内容:
I think, you whant to use OpenLayers to show your own Overlay on an OSM(or what ever)-map?
And you hav to use and your tiles lays at an URL like "gentile.php?Zoom={Z}&TileX={X}&TileY={Y}"
So try to add the layer with:
i've used that an year ago...
if that doesn't work write an htaccess - mod_rewrite
eg something like that: