iPhone iOS5 CLGeocoder how to geocode a large (200) set of addresses?

后端 未结 2 568
误落风尘
误落风尘 2020-12-15 01:03

I got a large set of about 200 addresses for which I need to know their latitude and longitude. I\'ve created a method that parses the addresses, and now I\'m trying to get

2条回答
  •  没有蜡笔的小新
    2020-12-15 01:54

    You can't immediately geocode large sets. iOS throttles you. I have seen that iOS limits you to 50 geocodes at a time, with the "time" factor being an unknown.

    I've had a similar problem, but as I needed only to present the geocoding data in a sequence to the user that takes time, I queued all my geocodings.

    Effectively, I geocode a chunk of 25 - display the results to the user 1 at a time at about an interval of a half second between each. When I have fewer than 4 left to display, I will geocode the next 25. This continues until everything is geocoded (or in my case, indefinitely).

    If you need to have everything geocoded at once, you'll need to chain your geocodings together with delays between each chunk and show some sort of busy indicator until you are done. Which could be some time with large sets of geocodings.

提交回复
热议问题