简体   繁体   中英

How to get rectangular grid co-ordinate with 2 geo points

Given two geo points say

(27.172079,78.047229) and (26.171239,75.037778)

Is it possible to get other two geo co-ordinate so as to form rectangular polygon ?

It's possible.

lat1,lon1 lat1,lon2 lat2,lon2 lat2,lon1

With googlemap api v2 you can easily get northeast and southwest coordinates.

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
...
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM