当前位置: 首页 > news >正文

soso地图api接口地理解析geocoder检索示例----并在信息框显示经纬度


api官网:

http://api.map.soso.com/doc_v2/example.html?sample-geocoding-simple#8map



示例代码如下(保存为html打开可见效果):

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>按关键字查询</title><script charset="utf-8" src="http://map.soso.com/api/v2/main.js"></script>
<script>var geocoder,map,marker = null;
var init = function() {var center = new soso.maps.LatLng(39.916527,116.397128);map = new soso.maps.Map(document.getElementById('iCenter'),{center: center,zoom: 15});geocoder = new soso.maps.Geocoder({complete : function(result){map.setCenter(result.detail.location);var marker = new soso.maps.Marker({map:map,position: result.detail.location,title:result.detail.address+result.detail.location});},error : function(result){$("#iCenter").empty();$("#iCenter").append("检索没有结果,原因: " + result);}});
}function codeAddress() {var address = "成都市金河路口宽窄巷子";geocoder.getLocation(address);
}var showmap = function() 
{init();
codeAddress();
}</script></head>
<body οnlοad="showmap();">  <div id="iCenter" style="height:300px;width=661px "></div></body>
</html>


http://www.xdnf.cn/news/854029.html

相关文章:

  • 钩子(hook)编程
  • BoundsChecker使用说明
  • 即时通讯音视频开发(十八):详解音频编解码的原理、演进和应用选型
  • android 加密手机功能,怎么为安卓手机加密
  • 【网络安全入门】学习网络安全必须知道的100 个网络基础知识_网络安全知识入门基础_网络安全基础知识
  • 电脑重装系统后会怎样?
  • 启动应用程序出现autoconv.exe找不到问题解决
  • 硬盘检测工具哪个好?5款硬盘工具对比测试
  • 《MySQL高级篇》四、索引的存储结构
  • Linux中搭建Apache服务器
  • 【每天学习一点新知识】sqlmap的使用
  • Android游戏开发大全
  • 51nod-1437 迈克步(单调栈)
  • IT运维工具推荐
  • 爱是一种遇见
  • windows XP中的IE6.0修复方法
  • 【转帖】源的添加管理和Cydia使用教程
  • windows下Npoint虚拟主机安装配置及心得
  • 万能DOS启动盘制作全攻略!(软盘+光盘+U盘+硬盘+NTFS+应急实用工具)
  • 如果找活跃IP段!抓肉鸡必须的!
  • 超级玛丽全通关图文攻略
  • MATLAB数字图像处理详细总结
  • 为什么数组下标越界要检查
  • vbs整人代码大集合 多年的代码收集
  • ubuntu实用工具
  • 赛效:在线查询QQ号价格评估的方法是什么
  • JAVA 基于J2ME的手机游戏设计与开发(论文+源码)_Nueve
  • 网线制作,集线器、交换机、路由器的介绍以及路由器的设置
  • C/C++经典题解析
  • iOS 7.0 presentViewController 背景变黑的解决办法