服务名称 | 描述 | 详细说明 |
---|---|---|
PlaceSearch | 兴趣点(POI)搜索 | 提供兴趣点的位置检索、周边检索和范围检索。 |
AutoComplete | 输入提示 | 提供检索输入框快速提供结果。 |
DistrictSearch | 行政区检索 | 提供省市区行政区的检索。 |
WeatherSearch | 天气检索 | 提供城市天气检索。 |
Driving | 驾车规划 | 提供驾车出行方案的搜索服务。 |
Transit | 公交路线 | 提供公交换乘方案的搜索服务。 |
Walking | 步行规划 | 提供驾车出行方案的搜索服务。 |
Geocoder | 地理编码/逆地理编码 | 提供将地址信息转换为坐标点信息的服务。 |
IpLocation | IP定位 | 提供通过用户IP定位所在位置。 |
Geolocation | 浏览器定位 | 提供浏览器定位服务,需要浏览器支持。 |
Correction | 纠偏贴路服务 | 提供点,轨迹的贴路、纠偏服务。 |
let placeSearch = new KMap.PlaceSearch({ map: map }); placeSearch.search({ keyword:'肯德基', start:0, count:20 });
let placeSearch = new KMap.PlaceSearch({ map: map }); placeSearch.search({ keyword:'肯德基', start:0, count:20 },(status, result) => { if(status == 'complete') { let pois = result.getSuggestCites(); let html = []; for (let poi of pois) { html.push(poi.name + '('+ poi.count +')'); } document.getElementById('result').innerHTML = html.join('<br>'); } });
let placeSearch = new KMap.PlaceSearch({ map: map }); placeSearch.searchInRegion({ city:'深圳市', keyword:'肯德基', start:0, count:20 });
let driving = new KMap.Driving({ map: map, showTraffic: true }); driving.search([{ keyword:"创建大厦", city:"深圳市" },{ keyword:"深圳机场", city:"深圳市" }]);
let driving = new KMap.Driving({ map: map, panel: 'result', showTraffic: true }); driving.search([{ keyword:"创建大厦", city:"深圳市" },{ keyword:"深圳机场", city:"深圳市" }]);
let driving = new KMap.Driving({ map: map }); driving.search([{ keyword:"创建大厦", city:"深圳市" },{ keyword:"深圳机场", city:"深圳市" }],(status,result) => { if(status == 'complete') { let html = []; html.push('起点:'+result.origin.name); html.push('终点:'+result.destination.name); if(result.routes.length > 0) { html.push(result.routes[0].tag); html.push('里程:'+ result.routes[0].distance + '米'); html.push('时间:'+ result.routes[0].time + '秒'); html.push('红绿灯:'+ result.routes[0].trafficLight); } document.getElementById('result').innerHTML = html.join('<br>'); } });
let transit = new KMap.Transit({ map : map }); transit.search([{ keyword:"创建大厦", city:"深圳市" },{ keyword:"深圳机场", city:"深圳市" }]);
let transit = new KMap.Transit({ map : map, panel: 'result' }); transit.search([{ keyword:"创建大厦", city:"深圳市" },{ keyword:"深圳机场", city:"深圳市" }]);
let transit = new KMap.Transit({ map : map }); transit.search([{ keyword:"创建大厦", city:"深圳市" },{ keyword:"深圳机场", city:"深圳市" }],(status,result) => { if(status == 'complete') { let html = []; html.push('起点:'+result.origin.name); html.push('终点:'+result.destination.name); for (let route of result.routes) { html.push(route.name); for (let step of route.steps) { html.push(step.name + '('+ step.start.name + '-' + step.end.name +')'); } } document.getElementById('result').innerHTML = html.join('<br>'); } });
// 创建实例 let geoCoder = new KMap.Geocoder(); // 地理编码 geoCoder.getLocation({ address : '你的地址' },(status,result) => { if(status == 'complete') { if(result.list.length > 0) { console.log(result.list[0].location); } } else { alert('解析失败['+result+']'); } });
// 创建实例 let geoCoder = new KMap.Geocoder(); // 逆地理编码 geoCoder.getAddress({ location: new KMap.Point(114.023144,22.535019) },(status,result) => { if(status == 'complete') { if(result.list.length > 0) { console.log(result.list[0].address); } } else { alert('解析失败['+result+']'); } });
// 创建实例 let correction = new KMap.Correction(); // 单点抓路 correction.pointGraspRoad(new KMap.Point(114.026067,22.536282), 90, function (status,result) { if(status == 'complete') { //显示 console.log(result); } else { //错误 alert(result); } });
// 创建实例 let correction = new KMap.Correction(); // 轨迹贴路 let track = [{"lon":113.87038,"lat":23.07192306,"speed":20,"direction":202,"time":1557314269},{"lon":113.87026,"lat":23.07168639,"speed":11,"direction":183,"time":1557314275}]; correction.trackGraspRoad(track,function (status,result) { if(status == 'complete') { //显示 console.log(result); } else { //错误 alert(result); } });