LMGeocoder
LMGeocoder is a simple wrapper for geocoding and reverse geocoding, using both Google Geocoding API and Apple iOS Geocoding Framework.
Features
- Wrapper for Geocoding and Reverse geocoding with blocked-based coding.
- Use both Google Geocoding API and Apple iOS Geocoding Framework.
Requirements
iOS 8.0 or higher
Installation
LMGeocoder is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'LMGeocoder'
Swift Version
https://github.com/lminhtm/LMGeocoderSwift
Usage
Geocoding
[[LMGeocoder sharedInstance] geocodeAddressString:addressString
service:LMGeocoderServiceGoogle
alternativeService:LMGeocoderServiceApple
completionHandler:^(NSArray *results, NSError *error) {
if (results.count && !error) {
LMAddress *address = [results firstObject];
NSLog(@"Coordinate: (%f, %f)", address.coordinate.latitude, address.coordinate.longitude);
}
}];
Reverse Geocoding
[[LMGeocoder sharedInstance] reverseGeocodeCoordinate:coordinate
service:LMGeocoderServiceGoogle
alternativeService:LMGeocoderServiceApple
completionHandler:^(NSArray *results, NSError *error) {
if (results.count && !error) {
LMAddress *address = [results firstObject];
NSLog(@"Address: %@", address.formattedAddress);
}
}];
Cancel Geocode
[[LMGeocoder sharedInstance] cancelGeocode];
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
License
LMGeocoder is available under the MIT license. See the LICENSE file for more info.
Author
Minh Nguyen