【发布时间】:2015-10-20 18:13:22
【问题描述】:
我已经尝试使用以下功能在开放层中将多边形居中-
function centerIn(longitude,latitude){
lonlat = new OpenLayers.LonLat(longitude, latitude).transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection
);
map.setCenter(new OpenLayers.LonLat(lonlat.lon, lonlat.lat), 10);
map.zoomTo(theZoom);
}
centerIn(0.99689177607425,44.1216337491133);
我的多边形边界是 - 1.18915251826175,44.069361365345 1.12048796748053,43.941939265001 1.45900420283204,43.9394671408999
在执行时它指向多边形的边缘。不是多边形的中心。有人可以建议我一些解决方案来解决这个问题。
【问题讨论】:
标签: javascript jquery openlayers openstreetmap