Getting surrounding zip codes from a location using Apple Map Kit

后端 未结 2 1278
悲哀的现实
悲哀的现实 2020-12-22 08:06

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 is

相关标签:
2条回答
  • 2020-12-22 08:39

    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 讨论(0)
  • 2020-12-22 08:42

    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.

    0 讨论(0)
提交回复
热议问题