c# - geocoding multiple addresses code behind -


i geocoding multiple address xml file lat/lng plot marker on map. works fine 15 addresses today checked , there 88 addresses , takes while load page. what's happening user clicks link map page , browser spins until addresses have been geocoded, page loads. i'm having use system.threading.thread.sleep(150); before each call google service avoid query limit error. there can make load page load addresses?

as you've found, google's geocoding service isn't requests en masse. in fact, it's against terms of service use service bulk downloads or processing batch requests.

what ought service doesn't have such low limits , allows submit batch requests api. disclosure purposes, work smartystreets, , provide such api called liveaddress.

it sounds you're submitting many requests there addresses geocode , plot. 15-100 requests take anywhere 1 maybe 10 or 15 seconds including network latency. i've seen situation quite few times in line of work , it's legitimate question.

what i'd recommend doing having server push down page client, have javascript load coordinates , plot points. (c.evenhuis suggested in comment.) while load page earlier, still should spin sort of "loading" animation, still make user wait. without upgraded license google, limits remain.

to overcome this, can api has few key features:

  • geo-distributed. reduces network latency , improves performance.
  • terms of service allow perform batch requests or geocode en masse
  • support multiple addresses per request, meaning have submit 1 or 2 requests per page load, 100 or 200 addresses
  • preferably, way verify addresses exist before plotting them. google approximates addresses, doesn't verify them.
  • permission cache/store values more temporary amount of time optimizing scripts. google's tos won't let store results except temporarily optimize performance @ runtime.

you can use liveaddress example of for, , see if meets needs. supports 100 addresses per single request, wait time goes several seconds few milliseconds. can store results download indefinitely, , return coordinates addresses exist, or fix addresses aren't quite correct. let me know if have questions it.

as thought, if don't want client-side geocode addresses, c# code can , bundle addresses 1 request.

[here's sample c# code on github]


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -