Getting surrounding zip codes from a location using Apple Map Kit

1.7k views Asked by At

I'm getting started on Map Kit for my job and I have a IOS project I am working on where it involves Map Kit, I know how to search for a location and pin point it but my issues is that part of my project involves getting the next 10-15 zip codes of the surrounding areas of my central location and receive the cities that are in each zip code, i really don't know how to implement it and I need help. an explanation or a snippet of code would be much appreciated.

2

There are 2 answers

0
incanus On BEST ANSWER

Zip codes like this aren't available in MapKit. You need to find a third-party source of zip code data (e.g. codes + bounding geometries), figure out a way to index them (perhaps be using or precalculating the centroid of each), and then figure out what's close to the selected point.

0
rambodrahmani On

Use Google Places API for this.

You can go for a Radar or NearbyPlaces search and get zip codes of the returned places (you can use a custom location and set the radius for your search as you are wishing to do).

There is a really good iOS library for querying Google Places API which is FTGooglePlacesAPI

Eventually you can also do everything manually using

NSData* data = [NSData dataWithContentsOfURL:YOUR-googleRequestURL];

and handling the fetched data.