Latest 0.2.0
Homepage https://github.com/tingslabs/TIMapboxGeocoder
License MIT
Platforms ios 7.0, requires ARC
Frameworks CoreLocation
Authors

Requirements

ios7 or highter

Installation

TIMapboxGeocoder is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "TIMapboxGeocoder"

Usage

First, import this lib:

#import "TIMapboxGeocoder.h"

Initialization

    TIMapboxGeocoder* geocoder = [[TIMapboxGeocoder alloc] initWithAccessToken:@"XXXX-XXXXX-XXXXX"];

You need a Mapbox access token

Geocoding

TIMapboxGeocoder* geocoder = [[TIMapboxGeocoder alloc] initWithAccessToken:@"XXXX-XXXXX-XXXXX"];
[geocoder geocodeAddressString:@"Paris" proximity:nil types:TIGeocoderTypeNone completionHandler:^(NSArray *results, NSError *error) {
    if (error) {
        // Handle error
    }
    TIPlacemark* placemark = results.firstObject;
    NSLog(@"First placemark name : %@", placemark.name);
}]; 

Nb : proximity can be nil or a CLLocation object near the search area

Reverse Geocoding

CLLocation* location = [[CLLocation alloc] initWithLatitude:0.0 longitude:0.0];
[geocoder reverseGeocodeLocation:location types:TIGeocoderTypeNone completionHandler:^(NSArray *results, NSError *error) {
    if (error) {
        // Handle error
    }
    TIPlacemark* placemark = results.firstObject;
    NSLog(@"First placemark name : %@", placemark.name);
}];

Types of places

  • TIGeocoderTypeNone
  • TIGeocoderTypeCountry
  • TIGeocoderTypeRegion
  • TIGeocoderTypePostcode
  • TIGeocoderTypePlace
  • TIGeocoderTypeAddress
  • TIGeocoderTypePoi

See https://www.mapbox.com/developers/api/geocoding/ for more details

TIPlacemark object

@interface TIPlacemark : NSObject

- (CLLocation*) location;
- (NSString*) name;

@end

Author

Benjamin Digeon, TingsLabs (http://www.tingslabs.com), [email protected]

Credits

This Objective-C implementation is inspired by the original MapBox Geocoder implementation.

Check out the original Swift implementation here: https://github.com/mapbox/MapboxGeocoder.swift

License

TIMapboxGeocoder is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "TIMapboxGeocoder",
    "version": "0.2.0",
    "summary": "Mapbox geocoder in Objective-C",
    "description": "MapBox geocoder in Objective-C for geocoding and reverse geocoding with Mapbox geocoding API",
    "homepage": "https://github.com/tingslabs/TIMapboxGeocoder",
    "license": "MIT",
    "authors": {
        "Benjamin Digeon": "[email protected]"
    },
    "source": {
        "git": "https://github.com/tingslabs/TIMapboxGeocoder.git",
        "tag": "0.2.0"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "public_header_files": "Pod/Classes/**/*.h",
    "frameworks": "CoreLocation"
}

Pin It on Pinterest

Share This