CLGeocoder getting nearby areas of interest

I want to be able to get the name of the closest (or just a nearby) Area of Interest to a location I give the CLGeocoder to reverse geocode. Right now the location I give actually has to be inside the Area of Interest for it to register, but I want to get Areas of Interest that are, say on the other side of the road or something. Right now I have a makeshift mechanism that creates a square of 8 points around the location to check 4 times with different distances (checking 32 times total), and if it finds an area of interest in one of them, my app uses that. The problem with this is that Apple reccommends you only send one geocode request per minute and will even temporarily block requests if sent too frequently (I've only seen this happening when I run my 32 request code twice within a few seconds, which would be a rare occasion anyway and I have a failsafe in case it does). So I was just wondering, is there a way to get nearby Areas of Interest so I don't have to check 32 times around a location?

Accepted Reply

This thread has been deleted

>using the reverseGeocodeLocation:completionHandler:


Suggest you instead use:

- reverseGeocodeLocation:preferredLocale:completionHandler:

Submits a reverse-geocoding request for the specified location and locale.


Am not suggesting you can casually sniff additional, less defined nearby/maybe~maybe nots w/the API as supplied.


Rather, I'd push you to honor the API, specifically the 'tips for using' section here:


https://developer.apple.com/documentation/corelocation/clgeocoder?language=objc

Replies

Formatted for readability...


I want to be able to get the name of the closest (or just a nearby) Area of Interest to a location I give the CLGeocoder to reverse geocode.


Right now the location I give actually has to be inside the Area of Interest for it to register, but I want to get Areas of Interest that are, say on the other side of the road or something.


Right now I have a makeshift mechanism that creates a square of 8 points around the location to check 4 times with different distances (checking 32 times total), and if it finds an area of interest in one of them, my app uses that.


The problem with this is that Apple recommends you only send one geocode request per minute and will even temporarily block requests if sent too frequently (I've only seen this happening when I run my 32 request code twice within a few seconds, which would be a rare occasion anyway and I have a failsafe in case it does).


So I was just wondering, is there a way to get nearby Areas of Interest so I don't have to check 32 times around a location?

Which of these are you using now?

- reverseGeocodeLocation:preferredLocale:completionHandler:

Submits a reverse-geocoding request for the specified location and locale.

- reverseGeocodeLocation:completionHandler:

Submits a reverse-geocoding request for the specified location.


>is there a way to get nearby Areas of Interest


I believe you can use Areas of Interest information from CLPlacemark:

https://developer.apple.com/reference/corelocation/clplacemark/1423673-areasofinterest


If you're going to say you forget to say you're already doing those, show some code, perhaps.