Giter Site home page Giter Site logo

amap3dmap_demo's Introduction

高德地图的使用方法参照高德地图开发者文档:

##1.进入项目,touch podfile platform :ios, '8.0' #手机的操作系统 pod 'AMap3DMap' #pod 'AMap2DMap' #pod 'AMap3DMap', '2.4.0' #退回原来老的版本'2.4.0' #两个中选择一个,不能同时使用 pod 'AMapSerch'

编写完后 在terminal中: pod install 等待几秒后就可以open the project (xcworkingspace)

##2.create Swift-Bridging-Header.h file## Build Settings -> Swift Compiler - code Generation ->Objective-C Bridging Header(...Swift-Bridging-Header.h) ##3.apply for apiKey.##

##4.display the map##

let apiKey = "" class ViewController:UIViewController,MAMapViewDelegate var mapView:MAMapView?

MAMapServices.sharedServices().apiKey = apiKey mapView = MAMapView(frame:self.view.bounds);mapView!.delegate = self;self.view.addSubview(mapView!) ##5.逆地理编码查询##

逆地理编码是高德提供的众多服务中的一种,被广泛用于iOS的LBS应用。实现逆地理编码查询功能需要搜索SDK(AMapSearchKit.framework)。

搜索SDK提供的服务功能的实现步骤有以下四点:

(1) 初始化主搜索对象AMapSearchAPI,并继承搜索协议 AMapSearchDelegate 。

(2) 构造 Request 对象,配置搜索参数。

(3) 通过主搜索对象以 Request 对象为参数,发起搜索。

(4) 实现搜索协议中对应的回调函数,通过解析 Response 对象获取搜索结果。

这里通过定位获取当前位置的经纬度,在点击定位标注(小蓝点)时,进行逆地理编码,在弹出的气泡中显示定位点的地址。实现该场景有以下几个步骤:

1.开启定位,显示定位标注(小蓝点)。

2.在定位的回调函数中获取定位点的经纬度。

3.点击定位标注,执行逆地理编码查询。

4.在逆地理编码回调中设置定位标注的title和subtitle。

amap3dmap_demo's People

Contributors

yyn835314557 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.