AB资源网(www.xxab.cn)服务器导航站-找服务器商就上AB资源网
百度360必应搜狗本站头条
【本站公告】:本站互助计划,欢迎有活动的服务器商免费投稿,免费收录,最新收录会在首页展示! - 站长QQ:6502567
当前位置:网站首页 > 技术文档 > 正文

webapi.br.baidu.com的简单介绍

AB资源网 2023-03-07 14:57 121 浏览 0 评论

本文目录一览:

  • 1、android中用高德地图通过地址获取经纬度
  • 2、调用高德地图API实现关键字查询的jsp代码怎么写

android中用高德地图通过地址获取经纬度

1.首先需要申请一个高德地图的key值,只有有了这个才能使用高德地图AP。申请地址,点击“获取KEY”,按步骤填空

2.准备工作做好,写入如下源码:

!DOCTYPE HTML

html

head

meta http-equiv="Content-Type" content="text/html; "

title输入提示后查询,点击获取坐标/title

style type="text/css"

body{

margin:0;

height:100%;

width:100%;

position:absolute;

font-size:12px;

}

#mapContainer{

position: absolute;

top:0;

left: 0;

right:0;

bottom:0;

}

#tip{

background-color:#fff;

border:1px solid #ccc;

padding-left:10px;

padding-right:2px;

position:absolute;

min-height:65px;

top:10px;

font-size:12px;

right:10px;

border-radius:3px;

overflow:hidden;

line-height:20px;

min-width:400px;

}

#tip input[type="button"]{

background-color: #0D9BF2;

height:25px;

text-align:center;

line-height:25px;

color:#fff;

font-size:12px;

border-radius:3px;

outline: none;

border:0;

cursor:pointer;

}

#tip input[type="text"]{

height:25px;

border:1px solid #ccc;

padding-left:5px;

border-radius:3px;

outline:none;

}

#pos{

height: 70px;

background-color: #fff;

padding-left: 10px;

padding-right: 10px;

position:absolute;

font-size: 12px;

right: 10px;

bottom: 30px;

border-radius: 3px;

line-height: 30px;

border:1px solid #ccc;

}

#pos input{

border:1px solid #ddd;

height:23px;

border-radius:3px;

outline:none;

}

#result1{

max-height:300px;

}

/style

/head

body

div id="mapContainer" /div

div id="tip"

b请输入关键字:/b

input type="text" id="keyword" name="keyword" value="" onkeydown='keydown(event)' style="width: 95%;"/

div id="result1" name="result1"/div

/div

div id="pos"

b鼠标左键在地图上单击获取坐标/b

brdivX:input type="text" id="lngX" name="lngX" value=""/ Y:input type="text" id="latY" name="latY" value=""//div

/div

script type="text/javascript" src="https://www.wanyucheng.com/news/66/;key=您的Key值"/script

script type="text/javascript"

var windowsArr = [];

var marker = [];

var mapObj = new AMap.Map("mapContainer", {

resizeEnable: true,

view: new AMap.View2D({

resizeEnable: true,

zoom:13//地图显示的缩放级别

}),

keyboardEnable:false

});

var clickEventListener=AMap.event.addListener(mapObj,'click',function(e){

document.getElementById("lngX").value=e.lnglat.getLng();

document.getElementById("latY").value=e.lnglat.getLat();

});

document.getElementById("keyword").onkeyup = keydown;

//输入提示

function autoSearch() {

var keywords = document.getElementById("keyword").value;

var auto;

//加载输入提示插件

AMap.service(["AMap.Autocomplete"], function() {

var autoOptions = {

city: "" //城市,默认全国

};

auto = new AMap.Autocomplete(autoOptions);

//查询成功时返回查询结果

if ( keywords.length 0) {

auto.search(keywords, function(status, result){

autocomplete_CallBack(result);

});

}

else {

document.getElementById("result1").style.display = "none";

}

});

}

//输出输入提示结果的回调函数

function autocomplete_CallBack(data) {

var resultStr = "";

var tipArr = data.tips;

if (tipArrtipArr.length0) {

for (var i = 0; i tipArr.length; i++) {

resultStr += "div id='divid" + (i + 1) + "' onmouseover='openMarkerTipById(" + (i + 1)

+ ",this)' onclick='selectResult(" + i + ")' onmouseout='onmouseout_MarkerStyle(" + (i + 1)

+ ",this)' style=\"font-size: 13px;cursor:pointer;padding:5px 5px 5px 5px;\"" + "data=" + tipArr[i].adcode + "" + tipArr[i].name + "span style='color:#C1C1C1;'"+ tipArr[i].district + "/span/div";

}

}

else {

resultStr = " π__π 亲,人家找不到结果!br /要不试试:br /1.请确保所有字词拼写正确br /2.尝试不同的关键字br /3.尝试更宽泛的关键字";

}

document.getElementById("result1").curSelect = -1;

document.getElementById("result1").tipArr = tipArr;

document.getElementById("result1").innerHTML = resultStr;

document.getElementById("result1").style.display = "block";

}

//输入提示框鼠标滑过时的样式

function openMarkerTipById(pointid, thiss) { //根据id打开搜索结果点tip

thiss.style.background = '#CAE1FF';

}

//输入提示框鼠标移出时的样式

function onmouseout_MarkerStyle(pointid, thiss) { //鼠标移开后点样式恢复

thiss.style.background = "";

}

//从输入提示框中选择关键字并查询

function selectResult(index) {

if(index0){

return;

}

if (navigator.userAgent.indexOf("MSIE") 0) {

document.getElementById("keyword").onpropertychange = null;

document.getElementById("keyword").onfocus = focus_callback;

}

//截取输入提示的关键字部分

var text = document.getElementById("divid" + (index + 1)).innerHTML.replace(/[^].*?.*\/[^].*?/g,"");

var cityCode = document.getElementById("divid" + (index + 1)).getAttribute('data');

document.getElementById("keyword").value = text;

document.getElementById("result1").style.display = "none";

//根据选择的输入提示关键字查询

mapObj.plugin(["AMap.PlaceSearch"], function() {

var msearch = new AMap.PlaceSearch(); //构造地点查询类

AMap.event.addListener(msearch, "complete", placeSearch_CallBack); //查询成功时的回调函数

msearch.setCity(cityCode);

msearch.search(text); //关键字查询查询

});

}

//定位选择输入提示关键字

function focus_callback() {

if (navigator.userAgent.indexOf("MSIE") 0) {

document.getElementById("keyword").onpropertychange = autoSearch;

}

}

//输出关键字查询结果的回调函数

function placeSearch_CallBack(data) {

//清空地图上的InfoWindow和Marker

windowsArr = [];

marker = [];

mapObj.clearMap();

var resultStr1 = "";

var poiArr = data.poiList.pois;

var resultCount = poiArr.length;

for (var i = 0; i resultCount; i++) {

resultStr1 += "div id='divid" + (i + 1) + "' onmouseover='openMarkerTipById1(" + i + ",this)' onmouseout='onmouseout_MarkerStyle(" + (i + 1) + ",this)' style=\"font-size: 12px;cursor:pointer;padding:0px 0 4px 2px; border-bottom:1px solid #C1FFC1;\"tabletrtdimg src=\"" + (i + 1) + ".png\"/td" + "tdh3font color=\"#00a6ac\"名称: " + poiArr[i].name + "/font/h3";

resultStr1 += TipContents(poiArr[i].type, poiArr[i].address, poiArr[i].tel) + "/td/tr/table/div";

addmarker(i, poiArr[i]);

}

mapObj.setFitView();

}

//鼠标滑过查询结果改变背景样式,根据id打开信息窗体

function openMarkerTipById1(pointid, thiss) {

thiss.style.background = '#CAE1FF';

windowsArr[pointid].open(mapObj, marker[pointid]);

}

//添加查询结果的markerinfowindow

function addmarker(i, d) {

var lngX = d.location.getLng();

var latY = d.location.getLat();

var markerOption = {

map:mapObj,

icon:"" + (i + 1) + ".png",

position:new AMap.LngLat(lngX, latY)

};

var mar = new AMap.Marker(markerOption);

marker.push(new AMap.LngLat(lngX, latY));

var infoWindow = new AMap.InfoWindow({

content:"h3font color=\"#00a6ac\" " + (i + 1) + ". " + d.name + "/font/h3" + TipContents(d.type, d.address, d.tel),

size:new AMap.Size(300, 0),

autoMove:true,

offset:new AMap.Pixel(0,-30)

});

windowsArr.push(infoWindow);

var aa = function (e) {infoWindow.open(mapObj, mar.getPosition());};

AMap.event.addListener(mar, "mouseover", aa);

}

//infowindow显示内容

function TipContents(type, address, tel) { //窗体内容

if (type == "" || type == "undefined" || type == null || type == " undefined" || typeof type == "undefined") {

type = "暂无";

}

if (address == "" || address == "undefined" || address == null || address == " undefined" || typeof address == "undefined") {

address = "暂无";

}

if (tel == "" || tel == "undefined" || tel == null || tel == " undefined" || typeof address == "tel") {

tel = "暂无";

}

var str = " 地址:" + address + "br / 电话:" + tel + " br / 类型:" + type;

return str;

}

function keydown(event){

var key = (event||window.event).keyCode;

var result = document.getElementById("result1")

var cur = result.curSelect;

if(key===40){//down

if(cur + 1 result.childNodes.length){

if(result.childNodes[cur]){

result.childNodes[cur].style.background='';

}

/script

/body

/html

调用高德地图API实现关键字查询的jsp代码怎么写

API实现关键字查询的jsp

!DOCTYPE html

html

head

meta http-equiv="Content-Type" content="text/html; charset=utf-8"/

title关键字查询/title

link rel="stylesheet" type="text/css" href="https://www.wanyucheng.com/Public/css/demo.Default.css" /

script language="javascript" src="https://www.wanyucheng.com/news/66/;key=c84af8341b1cc45c801d6765cda96087"/script

script language="javascript"

var mapObj;

var marker = new Array();

var windowsArr = new Array();

//基本地图加载

function mapInit() {

mapObj = new AMap.Map("iCenter");

}

function placeSearch() {

var MSearch;

mapObj.plugin(["AMap.PlaceSearch"], function() {

MSearch = new AMap.PlaceSearch({ //构造地点查询类

city:"021" //城市

});

AMap.event.addListener(MSearch, "complete", keywordSearch_CallBack);//返回地点查询结果

MSearch.search("东方明珠"); //关键字查询

});

}

//添加markerinfowindow

function addmarker(i, d) {

var lngX = d.location.getLng();

var latY = d.location.getLat();

var markerOption = {

map:mapObj,

icon:"" + (i + 1) + ".png",

position:new AMap.LngLat(lngX, latY)

};

var mar = new AMap.Marker(markerOption);

marker.push(new AMap.LngLat(lngX, latY));

var infoWindow = new AMap.InfoWindow({

content:"h3font color=\"#00a6ac\" " + (i + 1) + ". " + d.name + "/font/h3" + TipContents(d.type, d.address, d.tel),

size:new AMap.Size(300, 0),

autoMove:true,

offset:new AMap.Pixel(0,-30)

});

windowsArr.push(infoWindow);

var aa = function (e) {infoWindow.open(mapObj, mar.getPosition());};

AMap.event.addListener(mar, "click", aa);

}

//回调函数

function keywordSearch_CallBack(data) {

var resultStr = "";

var poiArr = data.poiList.pois;

var resultCount = poiArr.length;

for (var i = 0; i resultCount; i++) {

resultStr += "div id='divid" + (i + 1) + "' onmouseover='openMarkerTipById1(" + i + ",this)' onmouseout='onmouseout_MarkerStyle(" + (i + 1) + ",this)' style=\"font-size: 12px;cursor:pointer;padding:0px 0 4px 2px; border-bottom:1px solid #C1FFC1;\"tabletrtdimg src=\"" + (i + 1) + ".png\"/td" + "tdh3font color=\"#00a6ac\"名称: " + poiArr[i].name + "/font/h3";

resultStr += TipContents(poiArr[i].type, poiArr[i].address, poiArr[i].tel) + "/td/tr/table/div";

addmarker(i, poiArr[i]);

}

mapObj.setFitView();

document.getElementById("result").innerHTML = resultStr;

}

function TipContents(type, address, tel) { //窗体内容

if (type == "" || type == "undefined" || type == null || type == " undefined" || typeof type == "undefined") {

type = "暂无";

}

if (address == "" || address == "undefined" || address == null || address == " undefined" || typeof address == "undefined") {

address = "暂无";

}

if (tel == "" || tel == "undefined" || tel == null || tel == " undefined" || typeof address == "tel") {

tel = "暂无";

}

var str = " 地址:" + address + "br / 电话:" + tel + " br / 类型:" + type;

return str;

}

function openMarkerTipById1(pointid, thiss) { //根据id 打开搜索结果点tip

thiss.style.background = '#CAE1FF';

windowsArr[pointid].open(mapObj, marker[pointid]);

}

function onmouseout_MarkerStyle(pointid, thiss) { //鼠标移开后点样式恢复

thiss.style.background = "";

}

/script

/head

body onload="mapInit();"

div id="iCenter"/div

div class="demo_box"

pinput type="button" value="查询" onclick="placeSearch()"/br /

/p

div id="r_title"b关键字查询结果:/b/div

div id="result" /div

/div

/body

/html

更多0

关于webapi.br.baidu.com和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

腾讯云

相关推荐

云主机FTP软件:高效传输与安全管理的一站式解决方案

在云计算时代,云主机已成为企业和个人用户托管应用和存储数据的首选。为了方便文件传输,FTP(文件传输协议)软件在云主机环境中扮演着重要角色。本文将详细介绍如何在云主机上配置和使用FTP软件...

云主机FP:引领未来计算,解锁无限可能

云主机FP(FloatingPoint)是指在云计算环境中,针对浮点运算性能进行优化的虚拟机实例。浮点运算在科学计算、工程模拟、金融建模、图形处理等领域中占据重要地位,因此云主机FP的设计和配置...

云主机ECS:解锁企业数字化转型的新引擎,高效、安全、灵活的云计算解决方案

云主机ECS(ElasticComputeService)是阿里云提供的一种弹性计算服务,它允许用户在云端创建和管理虚拟机实例。ECS的核心优势在于其灵活性和可扩展性,能够满足各种规模和类型的业...

云主机D盘:解锁无限存储空间,轻松应对大数据挑战!

云主机是一种基于云计算技术的虚拟化服务器,它允许用户在云平台上创建、配置和管理虚拟机实例。在云主机中,磁盘分区是存储数据的关键部分,通常包括系统盘和数据盘。系统盘用于安装操作系统和运行应用...

云主机DNS解析:提升网站速度与稳定性的关键策略

云主机DNS(DomainNameSystem)是云计算环境中至关重要的一部分,它负责将域名转换为IP地址,从而使得用户能够通过易于记忆的域名访问云主机上的服务和应用。本文将深入探讨云主机DNS...

云主机C盘爆满?快速解决方法大揭秘,让你的服务器重获新生!

云主机C盘满了是一个常见但棘手的问题,尤其对于依赖云服务进行日常运营的企业和个人用户来说,这可能导致系统性能下降、应用程序崩溃,甚至数据丢失。本文将详细探讨云主机C盘满的原因、影响以及解决方法。...

云主机CPU选择指南:提升性能与效率的关键决策

在选择云主机的CPU时,用户需要考虑多个因素,以确保所选的CPU能够满足其应用的需求,同时优化成本效益。以下是一些关键点,帮助用户在云主机CPU选择过程中做出明智的决策。了解应用的性能需求...

云主机CPU性能大比拼:揭秘顶级云服务商的核心竞争力

云主机CPU是云计算环境中至关重要的组成部分,它直接影响着云服务的性能、稳定性和用户体验。CPU,即中央处理器,是计算机系统的核心,负责执行指令和处理数据。在云主机中,CPU的性能决定了虚...

云主机ASP:高效搭建动态网站,轻松实现业务扩展与性能优化

云主机ASP(ActiveServerPages)是一种在云环境中运行ASP应用程序的技术。ASP是一种由微软开发的动态网页技术,允许开发者使用VBScript或JScript等脚本语言编写服务...

云主机API:解锁无限可能,引领企业数字化转型新纪元

云主机API(ApplicationProgrammingInterface)是云计算服务提供商为用户提供的一种编程接口,允许开发者通过编程方式管理和操作云主机资源。这些API通常基于RESTf...

云主机99idc:高效稳定,轻松搭建您的专属云端空间,一键部署,畅享无限可能!

云主机99idc是一家专注于提供云计算服务的公司,其核心业务是为企业和个人用户提供高性能、高可靠性的云主机服务。随着数字化转型的加速,云计算已经成为企业IT基础设施的重要组成部分,而云主机99i...

云主机80端口:解锁无限可能,开启高效网络新时代!

云主机是一种基于云计算技术的虚拟化服务器,它通过互联网提供计算资源和服务。在云主机中,80端口是一个非常重要的端口,通常用于HTTP协议,即网页服务。本文将详细探讨云主机80端口的相关内容...

云主机403错误:解锁高效解决方案,提升网站性能与安全

云主机403错误是一个常见的网络问题,通常表示用户在尝试访问某个资源时被服务器拒绝。这种错误可能由多种原因引起,包括权限问题、配置错误、防火墙设置等。以下是关于云主机403错误的一些详细信...

云主机360:全方位云端解决方案,助力企业数字化转型无忧

云主机360是一种基于云计算技术的虚拟化服务器解决方案,它通过将物理服务器资源虚拟化,为用户提供灵活、高效、安全的计算服务。云主机360的核心优势在于其高度的可扩展性和弹性,用户可以根据业务需求...

云主机301:引领未来云计算的新纪元,高效稳定,助力企业数字化转型!

云主机301是一种常见的网络重定向状态码,通常用于指示用户请求的资源已被永久移动到新的URL。在云计算环境中,云主机301状态码的出现可能涉及到多种技术和管理策略,下面我们将详细探讨这一现象。...

取消回复欢迎 发表评论: