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



给定两个地理点,比如

(27.172079,78.047229) and (26.171239,75.037778)

有可能得到另外两个地理坐标,从而形成矩形多边形吗?

这是可能的。

lat1,lon1lat1,lon2lat2,lon2lat2、lon1

使用谷歌地图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
...
);

最新更新