Pois/add poi
Zhangchao2 (讨论 | 贡献) (→新增POI数据) |
|||
(未显示1个用户的5个中间版本) | |||
第4行: | 第4行: | ||
== '''URL''' == | == '''URL''' == | ||
− | http://api.t.sina.com.cn/pois/add_poi.(json|xml) | + | http://api.t.sina.com.cn/location/pois/add_poi.(json|xml) |
== '''支持格式''' == | == '''支持格式''' == | ||
第17行: | 第17行: | ||
== '''请求参数''' == | == '''请求参数''' == | ||
{| style="width:100%; height:200px;" border="1" cellspacing="0" cellpadding="0" | {| style="width:100%; height:200px;" border="1" cellspacing="0" cellpadding="0" | ||
− | ! style="width:20%" |参数 | + | ! style="text-align:center;width:20%" |参数 |
− | ! style="width:10%" |必选 | + | ! style="text-align:center;width:10%" |必选 |
− | ! style="width:20%" |类型及范围 | + | ! style="text-align:center;width:20%" |类型及范围 |
− | ! style="width:50%" |说明 | + | ! style="text-align:center;width:50%" |说明 |
|- style="height:px" | |- style="height:px" | ||
| style="text-align:center;" |source | | style="text-align:center;" |source | ||
第45行: | 第45行: | ||
| style="text-align:center;" |true | | style="text-align:center;" |true | ||
| style="text-align:center;" |string | | style="text-align:center;" |string | ||
− | | POI点类别,填写类别中文名 (详见[[ | + | | POI点类别,填写类别中文名 (详见[[location/category|分类代码对照表]]) |
|- | |- | ||
| style="text-align:center;" |city | | style="text-align:center;" |city | ||
| style="text-align:center;" |true | | style="text-align:center;" |true | ||
| style="text-align:center;" |string | | style="text-align:center;" |string | ||
− | | POI点城市,填写城市中文名 (详见[[ | + | | POI点城市,填写城市中文名 (详见[[location/citycode|城市代码对照表]]) |
|- | |- | ||
| style="text-align:center;" |longitude | | style="text-align:center;" |longitude | ||
第117行: | 第117行: | ||
:num:结果总数 | :num:结果总数 | ||
− | == ''' | + | == '''其它''' == |
− | + | ||
+ | === '''PHP示例''' === | ||
+ | 需要开启PHP的cURL扩展 | ||
<pre> | <pre> | ||
− | + | <?php | |
+ | //改为你的微博账号,用户名和密码之间用:隔开 | ||
+ | $userPwd = 'user@sina.com:pwd'; | ||
+ | //改为你微博应用的appkey | ||
+ | $appkey = '0123456789'; | ||
+ | |||
+ | $url = "http://api.t.sina.com.cn/location/pois/add_poi.xml?srcid=test001&name=123&address=abc&city=north&category=010000&longitude=116.30995&latitude=39.98465&source=$appkey"; | ||
+ | |||
+ | $rst = curlSample($url,$userPwd); | ||
+ | |||
+ | echo $rst; | ||
+ | |||
+ | function curlSample($url,$userPwd,$postFields = '',$header = ''){ | ||
+ | $ch = curl_init() or die (curl_error()) ; | ||
+ | curl_setopt($ch,CURLOPT_URL,$url); | ||
+ | curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); | ||
+ | curl_setopt($ch,CURLOPT_TIMEOUT,30); | ||
+ | if(!empty($userPwd)){ | ||
+ | curl_setopt($ch,CURLOPT_USERPWD,$userPwd); | ||
+ | } | ||
+ | if(!empty($postFields)){ | ||
+ | curl_setopt($ch,CURLOPT_POST,true); | ||
+ | curl_setopt($ch,CURLOPT_POSTFIELDS,$postFields); | ||
+ | } | ||
+ | if(!empty($header)){ | ||
+ | curl_setopt($ch, CURLOPT_HTTPHEADER,$header); | ||
+ | } | ||
+ | $result = curl_exec($ch) or die (curl_error($ch)); | ||
+ | curl_close($ch); | ||
+ | return $result; | ||
+ | } | ||
+ | ?> | ||
</pre> | </pre> |
2011年8月11日 (四) 14:32的最后版本
目录 |
pois/add_poi
提交POI点信息。请求必须用POST方式提交。 新增POI数据,新增的POI数据会进入数据处理流程,数据处理流程主要包括地理编码、数据排重、信息整合、质量改进等多项具体工作,凡是与位置相关的任何信息都可以通过上述几个环节的处理加入到地理信息库里,并且可通过接口查询到数据处理结果信息,帮助您提高数据质量
URL
http://api.t.sina.com.cn/location/pois/add_poi.(json%7Cxml)
支持格式
JSON/XML
HTTP请求方式
POST
是否需要登录
true
请求参数
参数 | 必选 | 类型及范围 | 说明 |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey |
srcid | true | int | 来源ID,用户自己生成,用于取回自己上传的poi信息 |
name | true | string | POI点名称 |
address | true | string | POI点地址 |
category | true | string | POI点类别,填写类别中文名 (详见分类代码对照表) |
city | true | string | POI点城市,填写城市中文名 (详见城市代码对照表) |
longitude | true | string | POI点经度 (如:116.30636) |
latitude | true | string | POI点维度 (如:39.84985) |
telephone | false | string | POI点电话 |
url | false | string | POI点网址 |
tags | false | string | POI点标签(根据类别填写标签,比如:湘菜,川菜) |
description | false | string | POI点介绍 |
traffic | false | string | POI点交通情况描述(换乘,公交地铁到达) |
intro | false | string | POI点其他特色信息(将特色信息组织成数组array('key1'=>value,'key2'=>value)后转成json格式存入) |
返回结果
XML示例
<?xml version="1.0" encoding="UTF-8" ?> <geoResult> <result>1</result> <info>Submit success</info> <num>1</num> </geoResult>
JSON示例
{ "result":1, "info":"Submit success", "num":1 }
字段说明
- result:结果标志 (1表示成功)
- info:提示信息
- num:结果总数
其它
PHP示例
需要开启PHP的cURL扩展
<?php //改为你的微博账号,用户名和密码之间用:隔开 $userPwd = 'user@sina.com:pwd'; //改为你微博应用的appkey $appkey = '0123456789'; $url = "http://api.t.sina.com.cn/location/pois/add_poi.xml?srcid=test001&name=123&address=abc&city=north&category=010000&longitude=116.30995&latitude=39.98465&source=$appkey"; $rst = curlSample($url,$userPwd); echo $rst; function curlSample($url,$userPwd,$postFields = '',$header = ''){ $ch = curl_init() or die (curl_error()) ; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_TIMEOUT,30); if(!empty($userPwd)){ curl_setopt($ch,CURLOPT_USERPWD,$userPwd); } if(!empty($postFields)){ curl_setopt($ch,CURLOPT_POST,true); curl_setopt($ch,CURLOPT_POSTFIELDS,$postFields); } if(!empty($header)){ curl_setopt($ch, CURLOPT_HTTPHEADER,$header); } $result = curl_exec($ch) or die (curl_error($ch)); curl_close($ch); return $result; } ?>
文档更新时间: 2011-08-11