Skip to content

andris-lejasmeiers/ios-offline-reverse-geocode-country

 
 

Repository files navigation

ios-offline-reverse-geocode-country

This is an Objective-C Module to reverse geocode country without any geocoding service API, the reverse geocoding is done offline using static country polygon data from a JSON file. Light weight reverse geocoder that uses approximated country boundaries. The method will return the country name for a given latitude and longitude.

How to use

The country reverse geocoder files are available in the ReverseGeocodeCountry folder.

Add the following files to your project:

  • ReverseGeocodeCountry.h
  • ReverseGeocodeCountry.m
  • ReverseGeocodeCountry.json

Initializing object:

ReverseGeocodeCountry *reverseGeocode = [[ReverseGeocodeCountry alloc] init];

Method to get Reverse Geocoded Country Name:

- (NSString*) getCountry: (float) lat : (float) lng;

lat and lng are the latitude and longitude of the point to be reverse geocoded and the method will return the country name string or an empty string if there is no country in the reverse geocoded point.

Example:

NSString *countryName = [reverseGeocode getCountry:lat :lng];

Sample App

There is a iOS sample project countrymap included in this repo which uses the ReverseGeocodeCountry module to update the name of country based on where the map is dragged.

countrymap

Attribution

The JSON data for country polygon and the reverse geocoding algorithm used in this module was implemented based on the country-reverse-geocoding nodejs module available at https://github.com/teleportd/country-reverse-geocoding

License

ReverseGeocodeCountry is licensed under the terms of the MIT License

About

iOS Class to reverse geocode country without any geocoding service API, reverse geocodes offline using static data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 92.0%
  • Ruby 8.0%