Awesome Open Source
Awesome Open Source

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://awesomeopensource.com/project/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


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Objective C (110,693
Swift (95,593
Ios (19,320
Geocoding (339
Geocoder (164
Related Projects