OpenLayers 显示全球 720 度
我当前的 OpenLayers 如下所示: 错误的地图 http://i1179.photobucket.com/albums/x384/yoyomyo /Picture2.png
它的大陆数量是应有数量的两倍。
我试图为我的地图设置边界,但整个地图拒绝渲染:
var map = new OpenLayers.Map('map', {restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90)});
var layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
map.addLayers([layer]);
map.setCenter(
new OpenLayers.LonLat(-71.147, -42.472).transform( new OpenLayers.Projection("EPSG:4326"),map.getProjectionObject()),
12);
有地图大师知道我做错了什么吗?
My current OpenLayers looks like the following:
a wrong map http://i1179.photobucket.com/albums/x384/yoyomyo/Picture2.png
It has twice as many continents as there should be.
I was trying to set Bounds to my map, but the entire map just refuses to render:
var map = new OpenLayers.Map('map', {restrictedExtent: new OpenLayers.Bounds(-180, -90, 180, 90)});
var layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
map.addLayers([layer]);
map.setCenter(
new OpenLayers.LonLat(-71.147, -42.472).transform( new OpenLayers.Projection("EPSG:4326"),map.getProjectionObject()),
12);
Does any Map guru know what I did wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
WrapDateLine
尝试
wrapDateLine:false
WrapDateLine
Try
wrapDateLine:false
听起来你想设置 maxExtent。
http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels
否则我没有线索。 :)
It sounds like you want to set maxExtent.
http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels
Otherwise I have no clue. :)
用一个例子来回答会更容易。我放大12是相当遥远的。是的,您可以放大 OSM http://www.openstreetmap.org/
在该网站中,他们使用这些值
It would be easier to answer with an example to work off of. I would zoom in 12 is pretty far out. And yes you can zoom in on OSM http://www.openstreetmap.org/
In that site, they use these values
好吧我放弃了。我认为这就是 OpenStreetMap 显示地图的方式。
我看过很多demo,都是和上面的一样。
Okay I give up. I think this is just the way OpenStreetMap displays its map.
I have seen many demos and they are all like the one above.