如何获得具有2个地理点的矩形网格坐标

时间:2014-09-18 15:04:51

标签: android google-maps google-api

鉴于两个地理位置说

(27.172079,78.047229) and (26.171239,75.037778)

是否可以获得其他两个地理坐标以形成矩形多边形?

1 个答案:

答案 0 :(得分:0)

这是可能的。

LAT1,lon1 LAT1,lon2 LAT2,lon2 LAT2,lon1

使用googlemap api v2,您可以轻松地获得东北和西南坐标。

llBuilder = new LatLngBounds.Builder();
point = new LatLng(lat,lon);
llBuilder.include(point);
point = new LatLng(lat2, lon2);
llBuilder.include(point);
calcBounds = llBuilder.build();
calcBounds.northeast.

log.d( ...
calcBounds.northeast.latitude,calcBounds.northeast.longitude
calcBounds.northeast.latitude,calcBounds.southwest.longitude
calcBounds.southwest.latitude, calBounds.southwest.longitude
calcBounds.southwest.Latitude, calcBounds.northeast.longitude
...
);