我正在从传单中迁移,然后返回,如果我需要地图绑定,则使用以下代码:
var b = map.getBounds();
$scope.filtromapa.lat1 = b.getSouth();
$scope.filtromapa.lat2 = b.getNorth();
$scope.filtromapa.lng1 = b.getWest();
$scope.filtromapa.lng2 = b.getEast();
有效纬度/经度位置的那些值,因此我可以将其发送到后端,并查询该区域内的任何位置。
我如何使用openlayers做到这一点?
现在我所拥有的是:
var b = map.getView().calculateExtent(map.getSize());
但是这些位置不是有效的纬度/经度位置。
我正在使用openlayers 3.19.1
遵循https://gis.stackexchange.com/questions/122250/how-to-get-the-feature-location-in-openlayers-v3中的答案(及其假设)
var currentExtent = map.getView().calculateExtent(map.getSize()),
TLpoint = ol.extent.getTopLeft( currentExtent ),
BRpoint = ol.extent.getBottomRight( currentExtent ),
TLcoords = ol.proj.transform( TLpoint, 'EPSG:3857', 'EPSG:4326' ),
BRcoords = ol.proj.transform( BRpoint, 'EPSG:3857', 'EPSG:4326' );
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句