TruMan1
TruMan1

Reputation: 36088

Determine if coordinates within Google Map bounds?

I have a Google Map already zoomed and positioned. How can I find out if some coordinates are within the map bounds or viewport of the current map? I want to conditionally drop a pin only if the coordinates I feed it is within the current bounds.

Upvotes: 2

Views: 2752

Answers (1)

geocodezip
geocodezip

Reputation: 161334

google.maps.LatLngBounds.contains()

(from the documentation):

contains
contains(latLng)
Parameters:
latLng: LatLng|LatLngLiteral
Return Value: boolean
Returns true if the given lat/lng is in this bounds.

Upvotes: 5

Related Questions