百度API介绍

合集下载

百度知道OPEN API接口规范文档1.0_final

百度知道OPEN API接口规范文档1.0_final

百度知道OPEN API接口规范文档V1.0系统名称百度知道OPEN API服务接口项目负责人作者耿艳坤文档提交日期2010-08-26百度在线网络技术(北京)有限公司(版权所有,翻版必究)修改记录No 修改后版本号修改内容简介修改日期修改人1 1.0 百度知道OPEN API服务接口2010-08-26 耿艳坤目录1背景 (5)2规范适用对象说明 (5)3名词解释 (5)4请求数据包格式规范 (5)4.1URL (5)4.2参数 (5)4.2.1系统级参数 (5)4.2.2业务级参数的通用约定 (6)4.2.3参数签名算法 (6)5响应数据包格式规范 (7)5.1XML输出格式 (7)5.2json输出格式 (7)5.3错误响应输出格式 (8)6错误码定义 (8)7API接口细则 (9)7.1baidu.zhidao.getQuestionList (9)7.1.1功能 (9)7.1.2参数 (9)7.1.3返回值 (9)7.2baidu.zhidao.getQuestionSearch (10)7.2.1功能 (10)7.2.2参数 (10)7.2.3返回值 (10)7.3baidu.zhidao.getQuestionInfo (11)7.3.1功能 (11)7.3.2参数 (11)7.3.3返回值 (11)7.4baidu.zhidao.getQuestionAnswer (12)7.4.1功能 (12)7.4.2参数 (12)7.4.3返回值 (13)7.5baidu.zhidao.question (13)7.5.1功能 (13)7.5.2参数 (13)7.5.3返回值 (13)7.6baidu.zhidao.answer (14)7.6.1功能 (14)7.6.2参数 (14)7.6.3返回值 (14)8第三方提供API接口细则 (15)9附件及参考资料 (16)1背景本文旨在为第三方合作站点应用访问百度知道开放服务提供统一的HTTP接口调用与交互规范。

简单使用百度API生成地图步骤

简单使用百度API生成地图步骤
map.addControl(ctrl_nav);
//向地图中添加缩略图控件
var ctrl_ove = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:1});
map.addControl(ctrl_ove);
window.map = map;//将map变量存储在全局
}
//地图事件设置函数:
function setMapEvent(){
map.enableDragging();//启用地图拖拽事件,默认启用(可不写)
map.enableScrollWheelZoom();//启用地图滚轮放大缩小
map.enableDoubleClickZoom();//启用鼠标双击放大,默认启用(可不写)
map.enableKeyboard();//启用键盘上下左右键移动地图
}
//地图控件添加函数:
function addMapControl(){
//向地图中添加缩放控件
var ctrl_nav = new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_PAN});
}
//创建地图函数:
function createMap(){
var map = new BMap.Map("doint = new BMap.Point(120.365872,31.545238);//定义一个中心点坐标
map.centerAndZoom(point,17);//设定地图的中心点和坐标并将地图显示在地图容器中

百度翻译API词典资源-接入字段说明.pdf说明书

百度翻译API词典资源-接入字段说明.pdf说明书

如需直观了解情况,您可前往https:///验证,两者的数据源是同源的。

词典json字符串可在https:///中可视化查看节点,需做utf-8转义。

中中释义/英英释义/简明释义可以理解为三本独立的词典,开发者在使用时,选择其中一个即可。

一、词典数据字段节点英文json结构层级:中文json结构层级:二、示例1、英文:以apple为例2、英文:以take为例3、中文:以专心致志为例4、中文:以中国为例三、接入指南四、常见问题dict字段下:lang:0:中文;1:英文exchange:不同时态:word_third:第三人称单数word_ing:进行时态word_done:完成时态word_pl:复数形式word_past:过去时态tags:词汇标签core:核心词;如高考、考研other:其他标签symbols:音标ph_en:英式音标ph_am:美式音标parts:词性组part:词性,有几种词性就有几个partmeans:词义ph_other:其他音标,一般为空general_knowledge:单词集锦similar_words:同类词en:英文释义;zh:中文释义word_name:词语queryword_lang:词语语言word_type:词语类型,如水果dict字段下:lang:0:中文;1:英文parts:词组part_name(一般为空)text:词组内容part:词性word_mean:英文释义means:中文含义word_name:原文queryfrom:来源word_means:含义general_knowledge:单词集锦similar_words:同类词en:英文释义;zh:中文释义word_name:词语queryword_lang:词语语言word_type:词语类型,如水果synthesize_means汉英大词典,因并非所有词汇都有结果,因此省略,后续可能将“汉英大词典”结果关闭,{"lang":"1","word_result":{"edict":{"item":[{"tr_group":[{"tr":["fruit with red or yellow or green skin and sweet to tart crisp whitish flesh"],"example":[]," similar_word":[]},{"tr":["native Eurasian tree widely cultivated in many varieties for its firm rounded edible fruits"],"example":[],"similar_word":["orchard apple tree","Malus pumila"]}],"pos":"noun"}],"word":"apple"},"zdict":"","simple_means":{"word_name":"apple","from":"original","word_means":["苹果"],"exchange": {"word_pl":["apples"]},"tags":{"core":["高考","考研"],"other":[""]},"symbols":[{"ph_en":"pl","ph_am":"pl","parts":[{"part":"n.","means":["苹果"]}],"ph_other":""}]},"general_knowledge":{"similar_words":[{"en":"pear","zh":"梨"},{"en":"peach","zh":"桃子"},{"en":"apple","zh":"苹果"},{"en":"grape","zh":"葡萄"},{"en":"banana","zh":"香蕉"},{"en":"cherry","zh":"樱桃"},{"en":"mulberry","zh":"桑椹"},{"en":"persimmon","zh":"柿子"},{"en":"hippophae","zh":"沙棘"},{"en":"strawberry","zh":"草莓"},{"en":"watermelon","zh":"西瓜"},{"en":"pomegranate","zh":"石榴"}],"word_name":"apple","word_type":"水果"," word_lang":"en"}}}{"lang":"1","word_result":{"edict":{"item":[{"tr_group":[{"tr":["the act of photographing a scene or part of a scene without interruption"],"example":[]," similar_word":[]},{"tr":["the income or profit arising from such transactions as the sale of land or other property"],"example":["the average return was about5%"]," similar_word":["return","issue","takings","proceeds","yield","payoff"]}],"pos":"noun"},{"tr_group":[{"tr":["be stricken by an illness,fall victim to an illness"]," example":["He got AIDS","She came down with pneumonia","She took a chill"],"similar_word":["contract","get"]},{"tr":["remove something concrete,as by lifting,pushing,or taking off,or remove something abstract"],"example":["remove a threat","remove a wrapper","Remove the dirty dishes from the table","take the gun from your pocket","This machine withdraws heat from the environment"],"similar_word":["remove","take away","withdraw"]},{"tr":["ascertain or determine by measuring,computing or take a reading from a dial"],"example":["take a pulse","A reading was taken of the earth's tremors"],"similar_word":[]}, {"tr":["take on a certain form,attribute,or aspect"],"example":["His voice took on a sad tone","The story took a new turn","he adopted an air of superiority","She assumedstrangemanners","Thegods assume human or animal form in these fables"],"similar_word":["assume","acquire","adopt","take on"]},{"tr":["be seized or affected in a specified way"],"example":["take sick","be taken drunk"],"similar_word":[]},{"tr":["be a student of a certain subject"],"example":["She is reading for the bar exam"],"similar_word":["learn","study","read"]},{"tr":["interpret something in a certain way","convey a particular meaning or impression"],"example":["I read this address as a satire","How should I take this message?","You can't take credit for this!"],"similar_word":["read"]},{"tr":["accept or undergo,often unwillingly"],"example":["We took a pay cut"],"similar_word":["submit"]},{"tr":["pick out,select,or choose from a number of alternatives"],"example":["Take anyoneofthesecards","Choosea good husband for your daughter","She selected a pair of shoes from among the dozen the salesgirl had shown her"],"similar_word":["choose","select","pick out"]},{"tr":["take into consideration for exemplifying purposes"],"example":["Take the case of China","Consider the following case"],"similar_word":["consider","deal","look at"]},{"tr":["take as an undesirable consequence of some event or state of affairs"],"example":["the accident claimed three lives","The hard work took its toll on her"],"similar_word":["claim","exact"]},{"tr":["lay claim to","as of an idea"],"example":["She took credit for the whole idea"],"similar_word":["claim"]},{"tr":["make a film or photograph of something"],"example":["take a scene","shoot a movie"],"similar_word": ["film","shoot"]},{"tr":["obtain by winning"],"example":["Winner takes all","He took first prize"],"similar_word":[]},{"tr":["point or cause to go(blows,weapons, orobjectssuch asphotographic equipment)towards"],"example":["Please don't aim at your little brother!","He trained his gun on the burglar","Don't train your camera on the women","Take a swipe at one's opponent"],"similar_word":["aim","train","take aim","direct"]},{"tr":["serve oneself to,or consume regularly"]," example":["Have another bowl of chicken soup!","I don't take sugar in my coffee"],"similar_word":["consume","ingest","take in","have"]},{"tr":["get into one's hands,take physically"],"example":["Take a cookie!","Can you take this bag,please"],"similar_word":["get hold of"]},{"tr":["have sex with","archaic use"]," example":["He had taken this woman when she was most vulnerable"],"similar_word":["have"]},{"tr":["travel or go by means of a certain kind of transportation, or a certain route"],"example":["He takes the bus to work","She takes Route1to Newark"],"similar_word":[]},{"tr":["proceed along in a vehicle"],"example": ["We drive the turnpike to work"],"similar_word":["drive"]},{"tr":["occupy or take on"],"example":["He assumes the lotus position","She took her seat on the stage","We took our seats in the orchestra","She took up her position behind the tree","strike a pose"],"similar_word":["assume","strike","take up"]},{"tr":["take somebody somewhere"],"example":["We lead him to our chief","can you take me to the main entrance?","He conducted us to the palace"],"similar_word": ["lead","direct","conduct","guide"]},{"tr":["head into a specified direction"],"example":["The escaped convict took to the hills","We made for the mountains"]," similar_word":["make"]},{"tr":["take something or somebody with oneself somewhere"],"example":["Bring me the box from the other room","Take these letters to the boss","This brings me to the main point"],"similar_word":["bring","convey"]},{"tr":["experience or feel or submit to"],"example":["Take a test","Take the plunge"],"similar_word":[]},{"tr":["to get into a position of having,e.g.,safety,comfort"],"example":["take shelter from the storm"],"similar_word":[]},{"tr":["take into one's possession"],"example":["We are taking an orphan from Romania","I'll take three salmon steaks"],"similar_word":[]},{"tr":["take by force"],"example": ["Hitler took the Baltic Republics","The army took the fort on the hill"],"similar_word":[]},{"tr":["buy,select"],"example":["I'll take a pound of that sausage"]," similar_word":[]},{"tr":["engage for service under a term of contract"],"example":["We took an apartment on a quiet street","Let's rent a car","Shall we take a guide in Rome?"],"similar_word":["lease","rent","hire","charter","engage"]},{"tr":["receive or obtain regularly"],"example":["We take the Times every day"],"similar_word":["subscribe","subscribe to"]},{"tr":["make use of or accept for some purpose"],"example":["take a risk","take an opportunity"],"similar_word": ["accept"]},{"tr":["receive willingly something given or offered"],"example":["The only girl who would have him was the miller's daughter","I won't have this dog in my house!","Please accept my present"],"similar_word":["accept","have"]},{"tr":["admit into a group or community"],"example":["accept students for graduate study","We'll have to vote on whether or not to admit a new member"],"similar_word":["accept","admit","take on"]},{"tr":["require(time or space)"]," example":["It took three hours to get to work this morning","This event occupied a very short time"],"similar_word":["occupy","use up"]},{"tr":["assume,as of positionsorroles"],"example":["She took the job as director of development","he occupies the position of manager","the young prince will soon occupy the throne"],"similar_word":["fill","occupy"]},{"tr":["develop a habit"],"example":["He took to visiting bars"],"similar_word":[]},{"tr":["carry out"],"example":["take action","take steps","take vengeance"],"similar_word":[]},{"tr":["require as useful,just,or proper"],"example":["It takes nerve to do what she did","success usually requires hard work","This job asks a lot of patience and skill","This position demands a lot of personal sacrifice","This dinner calls for a spectacular dessert","This intervention does not postulate a patient's consent"],"similar_word":["necessitate","ask","postulate","need","require","involve","call for","demand"]},{"tr":["be capable of holding or containing"],"example":["This box won't take all the items","The flask holds one gallon"],"similar_word":["contain","hold"]},{"tr":["have withoneself","haveon one's person"],"example":["She always takes an umbrella","I always carry money","She packs a gun when she goes into the mountains"]," similar_word":["carry","pack"]},{"tr":["be designed to hold or take"],"example":["This surface will not take the dye"],"similar_word":["accept"]}],"pos":"verb"}]," word":"take"},"zdict":"","simple_means":{"word_name":"take","from":"original","word_means":["携带","拿走","取走","运走","带去","引领","使达到,把…推向,把…带到","场景,镜头","收入额","进项","看法","意见"],"exchange":{"word_third":["takes"],"word_ing":["taking"],"word_done":["taken"],"word_past": ["took"]},"tags":{"core":["高考","考研"],"other":[""]},"symbols":[{"ph_en":"tek","ph_am":"tek","parts":[{"part":"v.","means":["携带","拿走","取走","运走","带去","引领","使达到,把…推向,把…带到(另一个层次、层面等)"]},{"part":"n.","means":["(不停机一次连续拍摄的)场景,镜头","收入额","进项","看法","意见"]}],"ph_other":""}]}}}{"lang":"0","word_result":{"edict":"","zdict":{"simple":null,"word":"专心致志","detail":{"chenyu":{"from":"《孟子·告子上》:“夫今弈之为数,小数也,不专心致志,则不得也。

百度地图API应用实例说明文档

百度地图API应用实例说明文档

百度地图API百度地图API应用实例Michael Tian目录百度地图API (3)1基础知识 (3)1.1 百度地图 API 概念 (3)1.2 百度地图的“Hello, World” (3)1.2.1 引用百度地图API文件 (5)1.2.2创建地图容器元素 (5)1.2.3命名空间 (5)1.2.4创建地图实例 (5)1.2.5创建点坐标 (6)1.2.6 初始化地图 (6)1.2.7地图操作 (6)2应用示例 (6)2.1 Map类 (7)2.2 ExtJs (7)2.2.1 将百度地图嵌入到Ext中 (8)2.2.2 在Ext中显示百度地图 (10)2.3 向地图添加标注 (10)2.4 为标注添加信息窗口 (11)2.5 标注与数据列表的联动 (12)2.6 数据列表与标注的联动 (12)2.7 创建可拖拽的标注 (14)3折线 (14)3.1添加多边形 (14)3.2样式设置 (16)4自定义标注 (16)5 文本标注 (17)5.1 添加一个文本标注 (17)5.2 文本位置偏移值 (18)5.3 自定义Label (19)5.4 添加滑动门效果 (20)6参考资料 (21)百度地图API1基础知识1.1 百度地图 API 概念百度地图API是一套由JavaScript语言编写的应用程序接口,它能够帮助您在网站中构建功能丰富、交互性强的地图应用程序。

百度地图API不仅包含构建地图的基本功能接口,还提供了诸如本地搜索、路线规划等数据服务。

1.2 百度地图的“Hello, World”开始学习百度地图API最简单的方式是看一个简单的示例。

以下代码创建了一个520x340<meta http-equiv="Content-Type"content="text/html; charset=gbk"/> <title>Hello, World</title><scriptsrc=/api?key=46ce9d0614bf7aefe0ba562f8cf87194 &v=1.0&services=false type="text/javascript"></script></head><body><div style="width: 520px; height: 340px; border: 1px solid gray"id="container"></div></body></html><script type="text/javascript">var map = new BMap.Map("container"); // 创建Map实例var point = new BMap.Point(116.404, 39.915); // 创建点坐标map.centerAndZoom(point,15); // 初始化地图,设置中心点坐标和地图级别。

百度地图API爬取不同类型POI的详细数据

百度地图API爬取不同类型POI的详细数据

百度地图API爬取不同类型POI的详细数据⼀、相关概念查询某个范围内的所有POI参数介绍:page_size:单次查询返回的POI的数量,最⼤值为20page_num:查找的POI数量超过20时,会分页显⽰;⽐如60个POI就会分3页;此时,page_num=1/2/3会先显⽰全部的数据;当page_num=4时,第4页的结果集⼤⼩为0;scope:1为默认值;2会显⽰详细数据region:检索的⾏政区域URL链接:查询结果⽰例:"status":0,"message":"ok","total":2,"result_type":"poi_type","results":[{"name":"红螺寺","location":{"lat":40.390454,"lng":116.632411},"address":"北京市怀柔区红螺东路2号","province":"北京市","city":"北京市","area":"怀柔区","street_id":"","telephone":"(010)60681175,(010)60681639","detail":1,"uid":"605884e7c61e3573871541a3","detail_info":{"tag":"旅游景点;⽂物古迹","navi_location":{"lng":116.63176774842,"lat":40.37846005246},"type":"scope","detail_url":"/place/detail?uid=605884e7c61e3573871541a3&output=html&source=placeapi_v2","overall_rating":"4.3","comment_num":"200","children":[]}},{"name":"卧佛寺","location":{"lat":40.013776,"lng":116.213915},"address":"北京市海淀区卧佛寺路北京植物园内","province":"北京市","city":"北京市","area":"海淀区","street_id":"934b3dbf0a8d977b8b2fb5c0","detail":1,"uid":"934b3dbf0a8d977b8b2fb5c0","detail_info":{"tag":"旅游景点;⽂物古迹","navi_location":{"lng":116.21389548337,"lat":40.011540367963},"type":"scope","detail_url":"/place/detail?uid=934b3dbf0a8d977b8b2fb5c0&output=html&source=placeapi_v2","overall_rating":"4.7","image_num":"38","comment_num":"74","children":[]}}]查询某个POI的详细数据参数介绍:uid:某个POI对应的唯⼀的标识(通过范围查询获取到的)URL链接:查询结果⽰例:{"status":0,"message":"ok","result":{"uid":"605884e7c61e3573871541a3","street_id":"","name":"红螺寺","location":{"lng":116.63241097199,"lat":40.390454021402},"address":"北京市怀柔区红螺东路2号","province":"北京市","city":"北京市","area":"怀柔区","telephone":"(010)60681175,(010)60681639","detail_info":{"tag":"旅游景点;⽂物古迹","navi_location":{"lng":116.63176778525,"lat":40.378460018453},"detail_url":"/place/detail?uid=605884e7c61e3573871541a3&output=html&source=placeapi_v2","type":"scope","price":"¥54元","overall_rating":"4.3","image_num":"133","comment_num":"200","scope_type":"古迹","scope_grade":"AAAA","content_tag":"适合亲⼦;登⼭;礼佛祈福;赏红叶;适合拍照;⽇出;适合跑步;银杏;情侣约会;⾹⽕旺;免费项⽬;收费合理;空⽓清新;绿植繁茂;位置优越;景⾊优美;⼈⽓旺;景区⼤;⽓势宏⼤;环境不错;玩的开⼼;休闲好去处;值得游玩;建筑风格独特 },"detail":1}}⼆、相关链接百度地图API的POI分类申请akPOI检索相关介绍三、功能模块范围查询获取POI数据#将查询到的poi数据存⼊数据库def insertPOIData(name_list,ak,cursor):#总共查询到了多少对象total = 0#不重复的向数据库中写⼊的数据条数inserttotal = 0for i in name_list:#ecxel表格数据判空if i == '':break#j的范围从0开始;上限不⼀样for j in range(0, 10):time.sleep(3)url = getUrlByName(i, ak, j)print(url)html = requests.get(url)# print(type(html)) response类型data = html.json()# print(type(data)) dict类型print(data)#status状态码为0表⽰获取正常if data['status'] == 0:#判断获取的数量,为0表⽰查询不到该类型的对象if data['total'] == 0:breaktotal = total + data['total']if 'results' in data:for item in data['results']: # ⼀次返回的results中有20条数据# print(item)name = item['name']if isExist(cursor, item['uid']):print(f'{name}已经存在')#跳出循环,判断results中的下⼀个itemcontinueinsert = "insert into poidatas(tag,uid,lat,lng,name,address,province,city,area) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')" % (i, item['uid'], str(item['location']['lat']), str(item['location']['lng']), item['name'],item['address'], item['province'], item['city'], item['area']) # 字符串类型的数据插⼊要加单引号if cursor.execute(insert):inserttotal = inserttotal + 1if 'overall_rating' in item['detail_info']:update = "update poidatas set overall_rating ='%s' where uid = '%s'" % (item['detail_info']['overall_rating'], item['uid'])cursor.execute(update)if 'distance' in item['detail_info']:update = "update poidatas set distance ='%s' where uid = '%s'" % (item['detail_info']['distance'], item['uid'])cursor.execute(update)if 'comment_num' in item['detail_info']:update = "update poidatas set comment_num ='%s' where uid = '%s'" % (item['detail_info']['comment_num'], item['uid'])cursor.execute(update)if 'price' in item['detail_info']:update = "update poidatas set price ='%s' where uid = '%s'" % (item['detail_info']['price'], item['uid'])cursor.execute(update)if 'result' in data: #还需要对只有⼀个返回结果的情况进⾏判断#区别就是这⾥不能⽤for循环item = data['result']# print(item)db = pymysql.connect(host="localhost", user="root", password="root", database="poi")cursor = db.cursor()name = item['name']if isExist(cursor, item['uid']):print(f'{name}已经存在')exit()insert = "insert into poidatas(tag,uid,lat,lng,name,address,province,city,area) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')" % (i, item['uid'], str(item['location']['lat']), str(item['location']['lng']), item['name'],item['address'], item['province'], item['city'], item['area']) # 字符串类型的数据插⼊要加单引号if cursor.execute(insert):inserttotal = inserttotal + 1if 'overall_rating' in item['detail_info']:update = "update poidatas set overall_rating ='%s' where uid = '%s'" % (item['detail_info']['overall_rating'], item['uid'])cursor.execute(update)if 'distance' in item['detail_info']:update = "update poidatas set distance ='%s' where uid = '%s'" % (item['detail_info']['distance'], item['uid'])cursor.execute(update)if 'comment_num' in item['detail_info']:update = "update poidatas set comment_num ='%s' where uid = '%s'" % (item['detail_info']['comment_num'], item['uid'])cursor.execute(update)if 'price' in item['detail_info']:update = "update poidatas set price ='%s' where uid = '%s'" % (item['detail_info']['price'], item['uid'])cursor.execute(update)print('总共查找到的POI数量为: ')print(total)print('插⼊数据库的POI数量为: ')print(inserttotal)根据uid查询POI详细数据#通过uid查询更详细的数据并存⼊数据库def updateDetailInfo(ak,cursor):selectsql = 'SELECT uid FROM poidatas'cursor.execute(selectsql)result = cursor.fetchall()for row in result:uid = row[0]url2 = '/place/v2/detail?uid=%s&output=json&scope=2&ak=%s' %(uid,ak)print(url2)time.sleep(3)html=requests.get(url2)data=html.json()print(data)if data['status']==0:if 'result' in data:#print(data['result'])#result集合⼤⼩为1,这⾥不能使⽤for循环item = data['result']if 'shop_hours' in item['detail_info']:update = "update poidatas set shop_hours ='%s' where uid = '%s'" % (item['detail_info']['shop_hours'],item['uid'])print(update)cursor.execute(update)if 'detail_url' in item['detail_info']:update = "update poidatas set detail_url ='%s' where uid = '%s'" % (item['detail_info']['detail_url'],item['uid'])print(update)cursor.execute(update)if 'image_num' in item['detail_info']:update = "update poidatas set image_num ='%s' where uid = '%s'" % (item['detail_info']['image_num'],item['uid'])print(update)cursor.execute(update)if 'service_rating' in item['detail_info']:update = "update poidatas set service_rating ='%s' where uid = '%s'" % (item['detail_info']['service_rating'],item['uid'])print(update)cursor.execute(update)if 'environment_rating' in item['detail_info']:update = "update poidatas set environment_rating ='%s' where uid = '%s'" % (item['detail_info']['environment_rating'],item['uid'])print(update)cursor.execute(update)判断POI是否已经存⼊数据库#判断是否已经存⼊数据库def isExist(cursor,uid):sql = "select * from poidatas where uid = '%s'" % uid#print(cursor.execute(sql)) sql语句执⾏成功,返回的是1if cursor.execute(sql):return Trueelse:return False从excel表中读取POI类别def readExcel(path):data = xlrd.open_workbook(path)sheets = data.sheets()data_list=[]for i in range(len(sheets)):table=data.sheets()[i]table_rows=table.nrowstable_cols=table.ncolsfor j in range(table_rows):data_list.append( table.cell(j,0).value)return data_list拼接访问URLdef getUrlByName(name,ak,j):#矩形搜索,POI数量较少url = '/place/v2/search/?query=%s&page_size=20&page_num=%s&output=json&bounds=40.817,111.697,40.821,111.709&scope=2&ak=%s' %(name,j,ak) # ⾏政区域搜索,POI数量较多#url = '/place/v2/search/?query=%s&output=json&region=呼和浩特&scope=2&ak=%s' %(name,ak)return urlMain函数def Main():ak = "~~~~~"name_list=readExcel(r'D:\poi类别.xls')db = pymysql.connect(host="localhost", user="root", password="root", database="poi")cursor = db.cursor()insertPOIData(name_list,ak,cursor)updateDetailInfo(ak, cursor)mit()cursor.close()。

百度地图API基本使用(二)

百度地图API基本使用(二)

百度地图API基本使⽤(⼆)本⽂系作者原创,转载请私信并在⽂章开头附带作者和原⽂地址链接。

违者,作者保留追究权利。

前⾔PS:我所使⽤的的是百度地图Javascript API 3.0本⽂是对之前使⽤的延续,继续对百度地图API的⼀些使⽤去做归纳和总结,本次主要是对地图上的覆盖物这块做介绍,如果有⼩伙伴没有看过之前的,可以先去观看⼀下,前期所需要的⼀些准备,以及⼀些基本的⽤法。

感兴趣的⼩伙伴可以⾃⾏查看百度地图官⽅提供的⽂档开发⽂档中的JavaScript API也可以通过下⽅⽰例中⼼更直观的看到百度地图API的⼀些使⽤,以及它的⼀些特性不过要注意:实例中⼼使⽤的是BMapGL去创建容器的,最新版GL地图命名空间为BMapGL, 可按住⿏标右键控制地图旋转、修改倾斜⾓度。

由于本次使⽤的是BMapGL所以在引⼊API的时候也不太⼀样引⼊⽅式如下:<script type="text/javascript" src="///api?type=webgl&v=1.0&ak=您的密钥"></script>好的,废话不多说,开整百度地图API-覆盖物在讲覆盖物之前,先给⼤家讲⼀下覆盖物的添加和删除的⽅法,这个是通⽤的,下⾯各种类型的覆盖的添加和删除的使⽤是⼀样的。

在我们获取到容器之后,根据⾃⼰的需求创建好⾃⼰的覆盖物对象之后,如果我们需要添加覆盖物的话,就可以使⽤容器对象.addOverlay(覆盖物对象);如果我们需要清除覆盖物的话,只需要使⽤容器对象.clearOverlays();就可以清除所有,但是如果只是想清除某⼀个覆盖物的话,我们需要使⽤容器对象.removeOverlays(覆盖物对象);代码⽰例如下://创建容器var map = new BMapGL.Map('allmap');var point = new BMapGL.Point(116.404, 39.915);map.centerAndZoom(point, 15);// 创建点覆盖物var marker = new BMapGL.Marker(new BMapGL.Point(116.404, 39.915));//添加覆盖物map.addOverlay(marker);//删除具体覆盖物map.removeOverlays(marker);//删除所有覆盖物map.clearOverlays();1. 点覆盖物点覆盖物主要使⽤的是Marker这个⽅法,例如:var marker1 = new BMapGL.Marker(new BMapGL.Point(经度, 纬度));这样就创建好了⼀个点覆盖物对象,我们需要使⽤上⾯介绍的添加覆盖物的⽅法,将覆盖物添加到容器中,即容器对象.addOverlay(marker1)这样就实现了简单的点覆盖物,不过有的时候需要我们的覆盖物能够拖动,所以这个时候就要⽤到⼀个属性enableDragging,默认情况下是false,也就是说在上⾯的那些默认创建的⽅式这个属性都是false,这是属性字⾯意思也很好理解⽀持拖拽,所以如果有需要拖拽的需求,我们只需要将整个属性设置为true。

百度地图API开发指南

百度地图API开发指南

12<html>3<head>4<meta http-equiv="Content-Type"content="text/html;charset=utf-8"/>5<title>Hello,World</title>6<script type="text/javascript"src="/api?key=46ce9d0614bf7aefe0ba562f8cf87194&v=1.0&services=false"></script> 7</head>8<body>9<div style="width:520px;height:340px;border:1px solid gray"id="container"></div>10</body>11</html>1213view plainprint14<script type="text/javascript">15var map=new BMap.Map("container");//创建地图实例16var point=new BMap.Point(116.404,39.915);//创建点坐标17map.centerAndZoom(point,15);//初始化地图,设置中心点坐标和地图级别18</script>1920<script type="text/javascript"src="/api?key=46ce9d0614bf7aefe0ba562f8cf87194&v=1.0&services=false"></script> 21创建地图容器元素view plainprint22<div style="width:520px;height:340px;border:1px solid#000"id="container"></div>23地图需要一个HTML元素作为容器,这样才能展现到页面上。

百度地图API使用(JS案例Web服务器案例)

百度地图API使用(JS案例Web服务器案例)

百度地图API使⽤(JS案例Web服务器案例)前⾔这⼏天在项⽬中⽤到了百度地图这个插件,所以准备花点时间记录⼀下⼼得,好东西就要分享出来!1. 百度地图使⽤⽅式1.11.2 申请AK我的需求时web端,所有这⾥选择了浏览器端。

⽩名单上线前使⽤*号,线上正式ak请设置合理的IP⽩名单2.主要学习: 定位技术、路径规划和导航2.1 打开2.2 点击开发指南中的2.3⾄此,我们就快速创建了⼀张以天安门为中⼼的地图~注意: ak=必须时⾃⼰申请的3. 常见相关API 可以在这⾥查找这⾥只介绍⼀些常⽤的3.11<!DOCTYPE html>2<html>3<head>4<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />6<title>Hello, World</title>7<style type="text/css">8html{9height:100%10}11body{12height:100%;13margin:0px;14padding:0px 15}16#container{17height:100%18}19</style>20<script type="text/javascript" src="https:///api?v=3.0&ak=iG0Qt0gY2IMtf99aZe0j7d1cNnXxIhwM"></script>21</head>2223<body>24<div id="container"></div>25<script type="text/javascript">26// 创建地图实例27var map = new BMap.Map("container");28// 创建点坐标29var point = new BMap.Point(116.404, 39.915);30// 初始化地图,设置中⼼点坐标和地图级别31map.centerAndZoom(point, 15);32</script>33</body>34</html>3.2可以给地图中的点添加标注,添加标注的时候要⼀个point(坐标)对象,把标注添加到坐标位置。

百度API开发指南

百度API开发指南

百度 API 开发指南 目录[隐藏] o o o o o o o o  o1 简介 1.1 什么是百度地图 API? 1.2 面向的读者 1.3 获取 API 1.4 开发移动平台上的地图应用 1.5 异步加载 1.6 兼容性 1.7 版本说明 1.8 问题解答 2 基础知识 2.1 百度地图的“Hello, World”       o  o o o   o o     o o     o4 覆盖物 3 控件2.1.1 准备页面 2.1.2 引用百度地图 API 文件 2.1.3 创建地图容器元素 2.1.4 命名空间 2.1.5 创建地图实例 2.1.6 创建点坐标 2.1.7 地图初始化 2.2 地图配置与操作 3.1 地图控件概述 3.2 向地图添加控件 3.3 控制控件位置 3.3.1 控件停靠位置 3.3.2 控件位置偏移 3.4 修改控件配置 3.5 自定义控件 3.5.1 定义构造函数并继承 Control 3.5.2 初始化自定义控件 3.5.3 添加自定义控件 4.1 地图覆盖物概述 4.2 标注 4.2.1 定义标注图标 4.2.2 监听标注事件 4.2.3 可托拽的标注 4.2.4 内存释放 4.3 信息窗口o  o        o o o o  o o o     o o o o  o o      o   o   o  8 服务 7 工具 5 事件4.4 折线 4.4.1 添加折线 4.5 自定义覆盖物 4.5.1 定义构造函数并继承 Overlay 4.5.2 初始化自定义覆盖物 4.5.3 绘制覆盖物 4.5.4 移除覆盖物 4.5.5 自定义其他方法 4.5.6 添加覆盖物 5.1 地图事件概述 5.2 事件监听 5.3 事件参数和 this 5.4 移除监听事件 6 地图图层 6.1 地图图层概念 6.2 添加和移除图层 6.3 自定义图层 6.3.1 地图坐标系 6.3.2 定义取图规则 6.3.3 添加和移除自定义图层 7.1 地图工具概述 7.2 向地图添加工具 7.3 通过按钮控制工具的开启和关闭 7.4 拉框放大工具 8.1 地图服务概述 8.2 本地搜索 8.2.1 配置搜索 8.2.2 结果面板 8.2.3 数据接口 8.2.4 周边搜索 8.2.5 范围搜索 8.3 公交导航 8.3.1 结果面板 8.3.2 数据接口 8.4 驾车导航 8.4.1 结果面板 8.4.2 数据接口 8.5 地理编码 8.5.1 根据地址描述获得坐标 8.5.2 反向地理编码简介 什么是百度地图 API?百度地图 API 是一套由 JavaScript 语言编写的应用程序接口,它能够帮助您在网站中构建功能丰富、交互 性强的地图应用。

百度api短信开发

百度api短信开发

百度api短信开发公司原来有⼀个短信发送的功能,是调⽤第三⽅的,但是很不稳定,时不时就收不到短信,但是钱已经扣了。

对于这样的事,谁都忍受不了的。

于是想找⼀个稳定短信发送平台,第⼀想到的是阿⾥云,百度。

在这两个平台上公司都有认证了,于是省了很多事。

现在开始吧。

找到百度开放云登录窗⼝,然后登录,进⼊控制中⼼,然后在产品服务中找到,如下图简单消息服务SMS。

前提是账号已经认证了。

点击它跳转到⾸先是短信签名申请,这个可以根据他们提供的⽂档⼀⼀操作,盖章,拍照上传,等待他们审核(⼤概两个星期吧)。

审核成功,然后是短信模版申请,然后审核(⼤概⼀两天)数量没有限制。

这个时候其实我们可以根据他们⽂档进⾏开发了,只要签名和短信模板审核已通过我们就可以测试了。

他们有Java等,SDK,但是没有.net的,因此我只能调⽤他们的API实现。

⾸先要认证。

这个我是偷了⼀回懒。

由于有同事做好了这个,他之前实现了⼀个百度api 发送邮箱的功能。

我只要把他那部分认证的代码搬过来就是了。

如果愿意看,也是可以实现的。

我把认证的代码搬来。

这个⽅法实现。

'https:///zh-cn/library/system.security.cryptography.hmacsha256(v%3DVS.95).aspx'/s/blog_5eded52b0100e0mq.htmlFunction GetSigningKeyByHMACSHA256HEX(ByVal SecretAccessKey As String, ByVal authStringPrefix As String) As StringDim Livehmacsha256 As HMACSHA256 = New HMACSHA256(Encoding.UTF8.GetBytes(SecretAccessKey))Dim LiveHash As Byte() = puteHash(Encoding.UTF8.GetBytes(authStringPrefix))Dim SigningKey As String = HashEncode(LiveHash)Return SigningKeyEnd FunctionFunction GetSignatureByHMACSHA256HEX(ByVal SigningKey As String, ByVal CanonicalRequest As String) As StringDim Livehmacsha256 As HMACSHA256 = New HMACSHA256(Encoding.UTF8.GetBytes(SigningKey))Dim LiveHash As Byte() = puteHash(Encoding.UTF8.GetBytes(CanonicalRequest))Dim Signature As String = HashEncode(LiveHash)Return SignatureEnd Function'将字符串全部变成⼩写。

百度地图API手册

百度地图API手册

核心类•Map基础类•Point•Pixel•Bounds•Size控件类•Control •ControlAnchor •NavigationControl •NavigationControlType •NavigationControlOptions •OverviewMapControl •OverviewMapControlOptions •ScaleControl •ScaleControlOptions •LengthUnit •CopyrightControl •Copyright •CopyrightControlOptions 覆盖物类•Overlay•InfoWindow •InfoWindowOptions •Marker •MarkerOptions•Label•LabelOptions•Polyline •PolylineOptions •Polygon •PolygonOptions•Icon•IconOptions右键菜单类•ContextMenu •MenuItem •MenuItemOptions工具类•PushpinTool •PushpinToolOptions •DistanceTool•DragAndZoomTool •DragAndZoomToolOptions•ZoomType地图图层类•TileLayer•TileLayerOptions•MapType服务类•LocalSearch•LocalSearchOptions•StatusCode•LocalResult•LocalResultPoi•PoiType•TransitRoute•TransitRouteOptions•TransitPolicy•TransitRouteResult•TransitRoutePlan•Line•LineType•DrivingRoute•DrivingRouteOptions•DrivingPolicy•DrivingRouteResult•RoutePlan•Route•RouteType•WalkingRoute•WalkingRouteOptions •WalkingRouteResult•Geocoder•LocalCity•LocalCityOptions•LocalCityResult•TrafficControlMap 类此类是地图API的核心类,用来实例化一个地图。

简单使用百度API生成地图步骤

简单使用百度API生成地图步骤
//向地图中添加比例尺控件
var ctrl_sca = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT});
map.addControl(ctrl_sca);
}
//标注点数组
var markerArr = [{title:"无锡科技创业园",content:"新区龙山路2号",point:"120.367255|31.545807",isOpen:1,icon:{w:23,h:25,l:23,t:21,x:9,lb:12}}
this.openInfoWindow(_iw);
});
_iw.addEventListener("open",function(){
_marker.getLabel().hide();
})
_iw.addEventListener("close",function(){
_marker.getLabel().show();
//创建和初始化地图函数:
function initMap(){
createMap();//创建地图
setMapEvent();//设置地图事件
addMapControl();//向地图添加控件
addMarker();//向地图中添加marker
}
//创建地图函数:
function createMap(){
window.map = map;//将map变量存储在全局
}
//地图事件设置函数:
function setMapEvent(){
map.enableDragging();//启用地图拖拽事件,默认启用(可不写)

new bmap.marker的用法

new bmap.marker的用法

一、新版百度地图API的介绍随着科技的快速发展,百度地图API也在不断更新和升级。

其中,new bmap.marker作为其新版的一部分,为开发者提供了更加丰富的功能和更灵活的使用方法。

二、new bmap.marker的作用new bmap.marker是百度地图API中的一个重要组件,它主要用于在地图上添加标记点,可以用来标注地点、显示特定信息等。

通过new bmap.marker,开发者可以实现对地图上的标记点进行更加灵活和精细的控制,有效提升用户体验。

三、new bmap.marker的基本用法1. 创建一个标记点通过new bmap.marker可以很容易地在地图上创建一个标记点,代码示例如下:```javascriptvar point = new BMap.Point(116.404, 39.915);var marker = new BMap.Marker(point);map.addOverlay(marker);```上面的代码中,首先创建了一个地理坐标点point,然后通过new BMap.Marker方法创建了一个标记点,并将它添加到地图上。

这样就实现了在地图上添加一个标记点。

2. 自定义标记点的图标new bmap.marker还可以帮助开发者实现对标记点图标的自定义,以使标记点更加醒目和个性化。

可以通过如下代码实现自定义标记点图标:```javascriptvar myIcon = new BMap.Icon("xxx", new BMap.Size(23, 25), {anchor: new BMap.Size(10, 25)});var marker = new BMap.Marker(point, {icon: myIcon});```在上面的代码中,首先创建了一个自定义的图标myIcon,然后将它作为参数传入到new BMap.Marker方法中,从而实现了自定义标记点图标的效果。

百度地图API-根据地址解析坐标,根据坐标解析地址

百度地图API-根据地址解析坐标,根据坐标解析地址

百度地图API-根据地址解析坐标,根据坐标解析地址⼀.根据地址解析坐标1.官⽅⽂档地址2.c#封装⽅法/// <summary>/// 根据地址解析经纬度/// </summary>/// <param name="address">地址</param>/// <param name="city">城市</param>/// <returns></returns>public static string GetMapLatOrLong(string address, string city){string posturl = "/geocoder?address=" + address + "&output=json&key=⾃⼰的key&city=" + city + "";string postret = HttpGet(posturl);//返回json数据:{ "status":"OK","result":{ "location":{ "lng":经度,"lat":纬度},"precise":1,"confidence":75,"level":"\u5546\u52a1\u5927\u53a6"} }string citylist = "";JsonData jd = JsonMapper.ToObject(postret);if (jd["status"].ToString() == "OK"){citylist = "{\"lng\":\""+ jd["result"]["location"]["lng"].ToString()+ "\",\"lat\":\""+ jd["result"]["location"]["lat"].ToString()+ "\",\"level\":\""+ jd["result"]["level"].ToString() + "\"}";}else{citylist = "{\"lng\":\"\",\"lat\":\"\",\"level\":\"\"}";}return citylist;}3.调⽤string retcity= GetMapLatOrLong("地址","城市");Response.Write(retcity);⼆.根据坐标解析地址1.官⽅⽂档地址2.c#封装⽅法/// <summary>/// 按照定位的坐标,获取省市县/// </summary>/// <param name="lat"></param>/// <param name="lng"></param>/// <returns></returns>public static string DecodeMapPostion(string lat, string lng){string posturl = "/geocoder/v2/?output=json&ak=⾃⼰的key&location=" + lat + "," + lng; string postret =HttpGet(posturl);string citylist = "";JsonData jd = JsonMapper.ToObject(postret);if (jd["status"].ToString() == "0"){//具体地址string jtaddrs = jd["result"]["formatted_address"].ToString();string bussinsaddrs = jd["result"]["sematic_description"].ToString();citylist = "{\"province\":\"" + jd["result"]["addressComponent"]["province"].ToString() + "\",\"city\":\""+ jd["result"]["addressComponent"]["city"].ToString() +"\",\"area\":\"" + jd["result"]["addressComponent"]["district"].ToString() + "\",\"address\":\""+ HtmlEncode(jtaddrs) + "\"}";}else{citylist = "{\"province\":\"\",\"city\":\"\",\"area\":\"\"}";}return citylist;}3.调⽤string retcity= DecodeMapPostion(lat,lng);Response.Write(retcity);。

百度智能api接口汇总

百度智能api接口汇总

百度智能api接⼝汇总⼀:⾃然语⾔处理# -*- coding: utf-8 -*-# @Author : FELIX# @Date : 2018/5/18 9:47# pip install baidu-aipfrom aip import AipNlp""" 你的 APPID AK SK 从百度开发者平台申请 """APP_ID = ''API_KEY = ''SECRET_KEY = ''client = AipNlp(APP_ID, API_KEY, SECRET_KEY)text='百度是⼀家⾼科技公司'print(client.lexer(text))text = "今天天⽓怎么样?"""" 调⽤依存句法分析 """print(client.depParser(text))""" 如果有可选参数 """options = {}options["mode"] = 1""" 带参数调⽤依存句法分析 """print(client.depParser(text, options))word = "张飞"""" 调⽤词向量表⽰ """print(client.wordEmbedding(word))text = "床前明⽉光"""" 调⽤DNN语⾔模型 """print(client.dnnlm(text))word1 = "北京"word2 = "上海"""" 调⽤词义相似度 """print(client.wordSimEmbedding(word1, word2))""" 如果有可选参数 """options = {}""" 带参数调⽤词义相似度 """print(client.wordSimEmbedding(word1, word2, options))text1 = "浙富股份"text2 = "万事通⾃考⽹"""" 调⽤短⽂本相似度 """print(client.simnet(text1, text2))""" 如果有可选参数 """options = {}options["model"] = "CNN"""" 带参数调⽤短⽂本相似度 """print(client.simnet(text1, text2, options))text = "三星电脑电池不给⼒"""" 调⽤评论观点抽取 """print(mentTag(text))""" 如果有可选参数 """options = {}options["type"] = 13""" 带参数调⽤评论观点抽取 """print(mentTag(text, options))text = "苹果是⼀家伟⼤的公司"""" 调⽤情感倾向分析 """print(client.sentimentClassify(text))title = "iphone⼿机出现“⽩苹果”原因及解决办法,⽤苹果⼿机的可以看下"content = "如果下⾯的⽅法还是没有解决你的问题建议来我们门店看下成都市锦江区红星路三段99号银⽯⼴场24层01室。

百度百科API 合作介绍

百度百科API 合作介绍

百度百科API合作介绍
百度百科API 是百度百科为网站、客户端工具、互联网电视等第三方开发人员提供的编程接口。

利用百度百科API ,你可以在你的网站或程序中使用百度百科的数据,享受更全面、客观、及
时的信息服务。

API 输出知识搜索服务支持
合作方
提供百度百科品牌曝光及导流
提供合作方所需的百科词条内容的调用,
内容可包括百科概述、基本信息栏等。

百度百科
引入百科内容,平台联手共赢
畅享免费
免费使用百度百科
数百万用户
实时更新的超过1000万条优质词条,畅享百科词条库动态数据。

优质内容
百度指数最近30天百度指数≥5000的知名产品或机构(百度指数查询:)
口碑&实力所属行业内具有较高口碑、拥有一定实力的产品或机构
合作方资质要求
或者
申请流程
⏹邮件申请
邮箱地址:baike@
申请标题:(申请人姓名)申请百科API合作
附件:请填写《附件1-API合作申请单》下载,并打印盖章将扫描件以附件形式发送,同时提供公司证明(公司营业执照复印件加盖红色公章,拍照或扫描)、公司logo
⏹资质评估
百度百科在5个工作日内通过来信邮箱反馈评估结果,请您静候
⏹评估合格后
百科工作人员会与您联系,沟通具体事宜。

Thanks。

利用百度API实现文字识别

利用百度API实现文字识别

利⽤百度API实现⽂字识别简介将图⽚上⽂字识别出来,是⼀件⾮常有意思的事,⽽这样技术的实现,同样有助于我们实现图⽚验证码的识别,将图像翻译成⽂字⼀般成为光学⽂字识别(Optical Character Recognition,OCR)。

可以实现OCR的底层库并不多,⽬前很多库都是使⽤共同的⼏个底层OCR库,或者是在上⾯进⾏定制。

⼀些⼈是通过机器学习的⽅法,⾃⼰进⾏训练来实现识别,但那样识别率不⾼,并且也较为繁琐,今天我们使⽤的⽅法是调⽤现成的API,来达成我们的⽬的。

API(Application Programing Interface)应⽤编程接⼝,它们为不同的应⽤提供了⽅便友好的接⼝。

不同的开发者⽤不同的架构,甚⾄不同的语⾔编写软件都没问题。

因为API设计的⽬的就是要成为⼀种通⽤语⾔,让不同的软件进⾏信息共享。

我们通过调⽤百度AI的API,可以使⽤百度AI的⽂字识别技术,响应⼀般以XML和JSON格式返回,经验证,百度返回的是JSON格式,可见JSON格式已经越来越流⾏。

⼀些API是直接可以调⽤的,⽽另⼀些是需要收费和认证的,百度API必须经过验证,它提供每天五百次免费的使⽤机会,对于⼀般⼈这已经⾜够了,下⾯介绍获得验证指令的⽅法。

准备⼯作1.使⽤百度账号登陆百度AI开放平台2.点进控制台,选择⽂字识别,并且点击创建应⽤。

3.返回点击管理应⽤,获取需要认证信息。

另外你需要在python中安装baidu-aip模块安装⽅法如下:pip install baidu-aip代码实现这⾥我随便找了⼀张图⽚如下:⾸先我们看看百度返回的原始数据是什么1. from aip import AipOcr2. import re3. APP_ID='你获得的APPID'4. API_KEY ='你获得的APPKEY'5. SECRECT_KEY='同上'6. client=AipOcr(APP_ID,API_KEY,SECRECT_KEY)7. i=open(r'D:\博客相关资料\资料\博客图⽚\k1.png','rb')8. img=i.read()9. message=client.basicGeneral(img)10. print(message)这是json格式,并不⽅便我们阅读,所以我们把信息提取出来。

百度天气API接口

百度天气API接口

百度天⽓API接⼝接⼝说明根据经纬度/城市名查询天⽓的结果。

接⼝参数说明参数类型参数名称是否必须具体描述String ak true开发者密钥String sn false若⽤户所⽤ak的校验⽅式为sn校验时该参数必须。

String location true 输⼊城市名或经纬度,城市名称如:北京,经纬度格式为lng,lat坐标如:location=116.305145,39.982368;城市天⽓预报中间"|"分隔,location=116.305145,39.982368| 122.305145,36.982368|….String output false输出的数据格式,默认为xml格式,当output设置为’json’时,输出的为json格式的数据;String coord_type false 请求参数坐标类型,默认为gcj02经纬度坐标。

允许的值为bd09ll、bd09mc、gcj02、wgs84。

bd09ll表⽰百度经纬度坐标,bd09mc表⽰百度墨卡托坐标,gcj02表⽰经过国测局加密的坐标。

wgs84表⽰gps获取的坐标。

返回结果参数名称含义说明currentCity当前城市返回城市名status返回结果状态信息date当前时间年-⽉-⽇results天⽓预报信息⽩天可返回近期3天的天⽓情况(今天、明天、后天)、晚上可返回近期4天的天⽓情况(今天、明天、后天、⼤后天)results.currentCity当前城市results.weather_data weather_data.date天⽓预报时间weather_data.dayPictureUrl⽩天的天⽓预报图⽚urlweather_data.nightPictureUrl晚上的天⽓预报图⽚urlweather_data.weather天⽓状况所有天⽓情况(”|”分隔符):晴|多云|阴|阵⾬|雷阵⾬|雷阵⾬伴有冰雹|⾬夹雪|⼩⾬|中⾬|⼤⾬|暴⾬|⼤暴⾬|特⼤暴⾬|阵雪|⼩雪|中雪|⼤雪|暴雪|雾|冻⾬|沙尘暴|⼩⾬转中⾬|中⾬转⼤⾬|⼤⾬转暴⾬|暴⾬转⼤暴⾬|⼤暴⾬转特⼤暴⾬|⼩雪转中雪|中雪转⼤雪|⼤雪转暴雪|浮尘|扬沙|强沙尘暴|霾weather_data.wind风⼒weather_data.temperature温度返回xml格式的数据<?xml version="1.0" encoding="utf-8" ?><CityWeatherResponse><status>success</status><date>2014-05-03</date><results><currentCity>北京</currentCity><weather_data><date>周六(今天, 实时:22℃)</date><dayPictureUrl>/images/weather/day/leizhenyu.png</dayPictureUrl> <nightPictureUrl>/images/weather/night/duoyun.png</nightPictureUrl> <weather>雷阵⾬转多云</weather><wind>北风5-6级</wind><temperature>24 ~ 11℃</temperature><date>周⽇</date><dayPictureUrl>/images/weather/day/duoyun.png</dayPictureUrl><nightPictureUrl>/images/weather/night/qing.png</nightPictureUrl> <weather>多云转晴</weather><wind>北风4-5级</wind><temperature>19 ~ 8℃</temperature><date>周⼀</date><dayPictureUrl>/images/weather/day/qing.png</dayPictureUrl><nightPictureUrl>/images/weather/night/qing.png</nightPictureUrl><weather>晴</weather><wind>微风</wind><temperature>21 ~ 9℃</temperature><date>周⼆</date><dayPictureUrl>/images/weather/day/duoyun.png</dayPictureUrl> <nightPictureUrl>/images/weather/night/qing.png</nightPictureUrl> <weather>多云转晴</weather><wind>微风</wind><temperature>21 ~ 10℃</temperature></weather_data></results></CityWeatherResponse>返回json格式的数据{"error": 0,"status": "success","date": "2014-05-03","results": [{"currentCity": "北京","weather_data": [{"date": "周六(今天, 实时:22℃)","dayPictureUrl": "/images/weather/day/leizhenyu.png","nightPictureUrl": "/images/weather/night/duoyun.png","weather": "雷阵⾬转多云","wind": "北风5-6级","temperature": "24 ~ 11℃"},{"date": "周⽇","dayPictureUrl": "/images/weather/day/duoyun.png","nightPictureUrl": "/images/weather/night/qing.png","weather": "多云转晴","wind": "北风4-5级","temperature": "19 ~ 8℃"},{"date": "周⼀","dayPictureUrl": "/images/weather/day/qing.png","nightPictureUrl": "/images/weather/night/qing.png","weather": "晴","wind": "微风","temperature": "21 ~ 9℃"},{"date": "周⼆","dayPictureUrl": "/images/weather/day/duoyun.png","nightPictureUrl": "/images/weather/night/qing.png","weather": "多云转晴","wind": "微风","temperature": "21 ~ 10℃"}]}]}。

百度API城市代码CityCode官方文档

百度API城市代码CityCode官方文档

百度API城市代码CityCode官⽅⽂档100 拉萨市101 那曲地区102 ⽇喀则地区103 阿⾥地区104 昆明市105 楚雄彝族⾃治州106 ⽟溪市107 红河哈尼族彝族⾃治州108 普洱市109 西双版纳傣族⾃治州110 临沧市111 ⼤理⽩族⾃治州112 保⼭市113 怒江傈僳族⾃治州114 丽江市115 迪庆藏族⾃治州116 德宏傣族景颇族⾃治州117 张掖市118 武威市119 东莞市120 东沙群岛121 三亚市122 鄂州市123 乌海市124 莱芜市125 海⼝市126 蚌埠市1277 河南省直辖县级⾏政单位1277 济源市127 合肥市128 ⾩阳市129 芜湖市130 安庆市131 北京市132 重庆市133 南平市134 泉州市135 庆阳市136 定西市137 韶关市138 佛⼭市139 茂名市140 珠海市141 梅州市142 桂林市143 河池市144 崇左市145 钦州市146 贵阳市147 六盘⽔市148 秦皇岛市149 沧州市150 ⽯家庄市151 邯郸市152 新乡市153 洛阳市154 商丘市155 许昌市156 襄樊市157 荆州市158 长沙市167 ⼤连市168 乌兰察布市169 巴彦淖尔市170 渭南市171 宝鸡市172 枣庄市173 ⽇照市174 东营市175 威海市176 太原市177 ⽂⼭壮族苗族⾃治州178 温州市179 杭州市180 宁波市181 中卫市182 临夏回族⾃治州183 辽源市184 抚顺市185 阿坝藏族羌族⾃治州186 宜宾市187 中⼭市188 亳州市189 滁州市190 宣城市191 廊坊市192 宁德市193 龙岩市194 厦门市195 莆⽥市196 天⽔市197 清远市198 湛江市199 阳江市200 河源市201 潮州市202 来宾市203 百⾊市204 防城港市205 铜仁地区206 毕节地区207 承德市208 衡⽔市209 濮阳市210 开封市211 焦作市212 三门峡市213 平顶⼭市214 信阳市215 鹤壁市216 ⼗堰市217 荆门市218 武汉市219 常德市220 岳阳市221 娄底市222 株洲市223 盐城市224 苏州市225 景德镇市226 抚州市235 滨州市236 青岛市237 朔州市238 晋中市239 巴中市240 绵阳市241 ⼴安市242 资阳市243 衢州市244 台州市245 ⾈⼭市246 固原市247 ⽢南藏族⾃治州248 内江市249 曲靖市250 淮南市251 巢湖市252 黄⼭市253 淮北市254 三明市255 漳州市256 陇南市257 ⼴州市258 云浮市259 揭阳市260 贺州市261 南宁市262 遵义市263 安顺市264 张家⼝市265 唐⼭市266 邢台市267 安阳市268 郑州市269 驻马店市270 宜昌市271 黄冈市272 益阳市273 邵阳市274 湘西⼟家族苗族⾃治州275 郴州市276 泰州市277 宿迁市278 宜春市279 鹰潭市280 朝阳市281 营⼝市282 丹东市283 鄂尔多斯市284 延安市285 商洛市286 济宁市287 潍坊市288 济南市289 上海市290 晋城市2911 澳门特别⾏政区2912 ⾹港特别⾏政区291 南充市292 丽⽔市301 惠州市302 江门市303 汕头市304 梧州市305 柳州市306 黔南布依族苗族⾃治州307 保定市308 周⼝市309 南阳市310 孝感市311 黄⽯市312 张家界市313 湘潭市314 永州市315 南京市316 徐州市317 ⽆锡市318 吉安市319 葫芦岛市320 鞍⼭市321 呼和浩特市322 吴忠市323 咸阳市324 安康市325 泰安市326 烟台市327 吕梁市328 运城市329 ⼴元市330 遂宁市331 泸州市332 天津市333 ⾦华市334 嘉兴市335 ⽯嘴⼭市336 昭通市337 铜陵市338 肇庆市339 汕尾市33 嘉峪关市340 深圳市341 贵港市342 黔东南苗族侗族⾃治州343 黔西南布依族苗族⾃治州344 漯河市345 湖北省直辖县级⾏政单位346 扬州市347 连云港市348 常州市349 九江市34 ⾦昌市350 萍乡市351 辽阳市352 汉中市353 菏泽市354 淄博市355 ⼤同市356 长治市357 阳泉市358 马鞍⼭市366 聊城市367 忻州市368 临汾市369 达州市36 兰州市370 宿州市371 随州市372 德州市373 恩施⼟家族苗族⾃治州37 酒泉市38 ⼤兴安岭地区39 ⿊河市40 伊春市41 齐齐哈尔市42 佳⽊斯市43 鹤岗市44 绥化市45 双鸭⼭市46 鸡西市47 七台河市48 哈尔滨市49 牡丹江市50 ⼤庆市51 ⽩城市52 松原市53 长春市54 延边朝鲜族⾃治州55 吉林市56 四平市57 ⽩⼭市58 沈阳市59 ⾩新市60 铁岭市61 呼伦贝尔市62 兴安盟63 锡林郭勒盟64 通辽市65 海西蒙古族藏族⾃治州66 西宁市67 海北藏族⾃治州68 海南藏族⾃治州69 海东地区70 黄南藏族⾃治州71 ⽟树藏族⾃治州72 果洛藏族⾃治州73 ⽢孜藏族⾃治州74 德阳市75 成都市76 雅安市77 眉⼭市78 ⾃贡市79 乐⼭市80 凉⼭彝族⾃治州81 攀枝花市82 和⽥地区83 喀什地区84 克孜勒苏柯尔克孜⾃治州85 阿克苏地区86 巴⾳郭楞蒙古⾃治州87 新疆直辖县级⾏政单位93 昌吉回族⾃治州94 塔城地区95 克拉玛依市96 阿勒泰地区97 ⼭南地区98 林芝地区99 昌都地区。

相关主题
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

百度API介绍
来源:互联网
百度推广API包含哪些服务
百度推广API包括所有百度推广平台对外开放的API服务。

目前已推出的服务有搜索推广API服务和网盟推广API服务。

百度推广API有什么优势
通过百度推广API,您可以设计新的百度推广管理方式。

百度推广API具备如下特点:
1.定制:用户可以基于API搭建自己的应用程序,满足自身需求,实现更多个性化功能;
2.高效:一次API调用,可完成批量操作;
3.开放:API采用标准的Web/SOAP协议,接受主流开发语言。

百度推广API如何收费
使用百度推广API服务目前是免费的,但也不是无限制的。

百度为API用户限定了使用配额,以更合理的分配资源。

当用户的配额用完之后,在获得新分配的配额之前,用户将无法使用API提供的服务。

什么是百度搜索推广API
百度搜索推广API是百度推广API的一个子产品,搜索推广API服务是百度搜索推广系统对外开放的程序接口,开发人员能够基于百度搜索推广API开发应用程序,管理搜索推广的账户和广告,尤其是对大型、复杂账户的管理。

百度搜索推广API适用于谁
百度搜索推广API主要适用于百度搜索推广的大型广告客户和第三方。

包括SEM(搜索引擎营销商)、代理机构和其他管理多个客户账户和/或大型广告系列的在线营销专家。

由于使用百度推广API需要技术知识和编程技能以开发客户端程序,因此还需要广告客户或第三方具备编程知识或聘有开发人员。

申请百度搜索推广API需要具备哪些条件
百度搜索推广API主要面向大型客户和第三方,因此暂不对普通开发人员和用户开放。

想要申请API的用户必须具备一定的账户规模和技术实力。

百度会根据用户的账户累计投入、日均消费、关键词数量、配备的技术人员实力等因素进行综合评估,判断您是否具备申请API的条件。

您可以根据以下内容初步判断自己是否具备申请条件:
累计在百度续费3次以上;
账户累计投入RMB10万元以上;
账户日均消费RMB800元以上(数据期为最近1个月);
用户单位自身拥有2名以上的技术人员(精通任何一种支持Web服务的主流开发语言,如Java、PHP、C#等;精通Web服务相关的规范和协议:XML、SOAP、WSDL、XML Schema;精通一些Web服务测试工具,如SOATest、SoapUI),具备Web Service项目开发经验。

开通API以后收费吗
开通API以后您就可以使用API服务了,目前所有API服务都是免费的。

如何申请百度搜索推广API
1.联系您的客服人员,由客服人员帮助您发起API申请;
2.百度审核您是否具备申请API的条件;
3.审核确认您具备申请API条件后,请您登录百度推广平台,在系统中根据提示查看API 相关提示,接受相关的服务协议与条款;
4.在您接受相关服务协议与条款后,您的百度搜索推广API将开通,您将获得百度搜索推广API权限代码,并开始使用百度搜索推广API。

关于引用作品的版权声明
为了职业教育,促进知识传播、学习优秀作品,在本资料中选用了一些知名网站、公司企业的相关内容,这些内容包括:网站内容、企业LOGO、宣传图片、网站设计等。

为了尊重这些内容所有者的权利,特在此声明:
1、凡在本资料中涉及到得版权、著作权、商标权等权益,均属于原作品版权人、著作权人、商品权人。

2、如作者发现本资料涉及您的版权,请联系我们,我们核实后将删除相关内容。

在此,衷心感谢所有原作品的相关版权权益人及所属公司对职业教育的大力支持!。

相关文档
最新文档