Skip to content

Simple wrapper for geocoding and reverse geocoding, using both Google Geocoding API and Apple iOS Geocoding Framework.

License

Notifications You must be signed in to change notification settings

lminhtm/LMGeocoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LMGeocoder

LMGeocoder is a simple wrapper for geocoding and reverse geocoding, using both Google Geocoding API and Apple iOS Geocoding Framework.

CI Status Version License Platform

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

About

Simple wrapper for geocoding and reverse geocoding, using both Google Geocoding API and Apple iOS Geocoding Framework.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published