0

Currently I can retrieve the center point of the map using

new google.maps.LatLng(map.getCenter().lat(), map.getCenter().lng());

What I am now trying to do, is get the left-center OR the right-center point of the map. For example: Link to example image

As far as I know, there is no built in Google Maps API function to retrieve either of these points.

Musa
  • 406
  • 3
  • 11
  • https://stackoverflow.com/questions/1831634/how-to-get-left-top-and-right-buttom-latitude-and-longitude-of-map-in-mapkit – Hema Nandagopal Jul 04 '17 at 06:58
  • @HemaNandagopal The link you posted is using Swift and mapkit. As you could have seen from the tags I'm using Google Maps API, not mapkit and Javascript, not Swift. Thanks for your effort. – Musa Jul 04 '17 at 07:07

1 Answers1

0

You can get the bound

var bounds = map.getBounds();

var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();

then get the middle of the lats and lngs

eg in Nothern - Western area (otherwise check for min and max lat and lng): 

middleLat = sw.lat() + ( ne.lat() - sw.lat())/2;

your left center is in

(middleLat, sw.lng() )

you right center is in

 (middleLat, ne.lng() )
ScaisEdge
  • 131,976
  • 10
  • 91
  • 107