SpencerChantler123
SpencerChantler123

Reputation: 366

How to make center_changed listener in Google Map API v3 only fire once?

I am currently using 'center_changed',function() as a listener to get the lat and lng of the map centre and then subsequently calling a reverse geocode method to convert the lat and lng into an address. However, since center_changed is firing more than once when the map is being dragged, i get a prompt message "OVER_QUERY_LIMIT" from my reverse geocode method. Is there a way to make the centre_changed listener only fire once?

Upvotes: 2

Views: 795

Answers (1)

geocodezip
geocodezip

Reputation: 161384

Use the addLlistenerOnce method.

events description in the documentation

Upvotes: 1

Related Questions