您的位置:首页 > 其它

arcgis调用国家天地图wfs服务

2013-12-26 15:52 190 查看
1.国家天地图wfs地址 

getcapabilities

http://www.tianditu.com/wfssearch.shtml?request=getcapabilities&service=wfs

操作名
参数名
是否必须
备注
GetCapabilities
VERSION

服务版本号,支持1.0.0
SERVICE

值为“WFS”
REQUEST

值为“GetCapabilities”
DescribeFeatureType
VERSION

版本号,支持“1.1.0”
REQUEST

值为“DescribeFeatureType”
TYPENAME

图层列表,以“,”分割
OUTPUTFORMAT

支持“text/xml”
GetFeature
VERSION

版本号,支持“1.1.0”
REQUEST

值为“GetFeature”
TYPENAME

图层列表,以“,”分割
OUTPUTFORMAT

支持“text/xml”
BBOX

请求的范围
PROPERTYNAME

图层的属性列表,以“,”分割
FILTER

过滤条件
MAXFEATURES

请求的最大要素记录数
FEATUREID

要素ID号
RESULTTYPE

值为“results”
希望研究这个的大神能指导我下,求交流

下面是客服给的一个demo,注意  utf-8编码,不然你post出去的中文会让你找不到错在哪里。。。

public class Simapledemo {

/**
* 该程序简单给出一个请求天地图wfs服务的简单市里,请求串按字符串拼接的形式给出,XMl格式的请求可以根据给出的请求串自行生成
* 请求记录最多支持300条
* 不支持只含有*的搜索,必须有明确的搜索关键词
* 目前不支持视野内搜索,不支持统计搜索,如果需要的可以等待我们网站api出炉
* 搜索格式 全国搜索 在 <ogc:Literal>***北京 超市**</ogc:Literal>  *之间只输入关键字就可以  如果指定城市搜索 输入 城市名 + “ ” +搜索关键字
* @param args
*/

public static void main(String[] args) throws Exception {
try {
URL url = new URL("http://www.tianditu.com/wfssearch.shtml");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setDoOutput(true);
con.setRequestMethod("POST");
OutputStream out = con.getOutputStream();

String strQuest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<wfs:GetFeature maxFeatures=\"100\" service=\"WFS\" version=\"1.0.0\" xsi:schemaLocation=\"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/wfs.xsd\" xmlns:wfs=\"http://www.opengis.net/wfs\" xmlns:gml=\"http://www.opengis.net/gml\" xmlns:ogc=\"http://www.opengis.net/ogc\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"> "
+ " <wfs:Query typeName=\"DOMAIN_POI_NEW\" srsName=\"EPSG:4326\">"
+ "<ogc:Filter>"
+ "<ogc:And> "
+ "<ogc:PropertyIsLike wildCard=\"*\" singleChar=\".\" escape=\"!\"> "
+ " <ogc:PropertyName>NAME</ogc:PropertyName>"
+ " <ogc:Literal>***北京 超市**</ogc:Literal> "
+ // 请求的时候仅需要替换 超市 这个关键词就好,如果指定城市搜索,搜索关键词为指定城市的名称  加上空格要搜索的关键字就可以
"</ogc:PropertyIsLike>" + " </ogc:And>" + "</ogc:Filter>"
+ "</wfs:Query>" + "</wfs:GetFeature>";

out.write(strQuest.getBytes());

out.close();
BufferedReader br = new BufferedReader(new InputStreamReader(con
.getInputStream()));
String line = "";
FileWriter fw = null;
fw = new FileWriter("seachresult.xml", false);
for (line = br.readLine(); line != null; line = br.readLine()) {
fw.write(line);
System.out.println(line);
}
fw.close();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

}


 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: