Giter VIP home page Giter VIP logo

glpreversegeocode's Introduction

简介

示例提供了集合的六种地理坐标反编码的方法,分别为苹果地图,高德地图,百度地图,谷歌地图,微软地图(前必应地图),以及 OpenStreetMap 开放地图(OSM)。 除了苹果地图和 OSM ,其他几个地图服务,都需要导入相应的 SDK ,在 GLPReverseGeocode.h 中,如果导入了相应的 SDK ,则取消注释相应的 define 即可。 示例使用的是 CocoaPods 导入方式,手动导入的,可能不需要尖括号导入。

注意

在 SceneDelegate.m 中,需要提供自己申请的相应的地图的 SDK 的授权 key 。与此同时,你可能需要更改示例的 Bundle ID 。

使用

方式一

适用于同时触发多次请求的情况。在 resultHandler 中处理即可。

    __weak typeof(self) weakSelf = self;
    _geocode = [[GLPReverseGeocode alloc] initWithService:GLPGeocodeServiceApple];
    _geocode.resultHandler = ^(GLPGeocodeAddress * _Nullable address, NSError * _Nullable error) {
        dispatch_async(dispatch_get_main_queue(), ^{
            if (!error) {
                // 此处处理 address
            }
        });
    };
    
    [_geocode reverseWithCoordinate:coordi];

方式二

适用于单次请求。

    [_geocode reverseGeocodeWithCoordinate:CLLocationCoordinate2DMake(lat, long) completionHandler:^(GLPGeocodeAddress * _Nullable address, NSError * _Nullable error) {
        if (!error) {
            // 在此处处理 address
        }
    }];

License

GLPReverseGeocode 使用 MIT License

glpreversegeocode's People

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.