纯http形式访问wfs服务范例
来源:互联网 发布:after effect mac 编辑:程序博客网 时间:2024/05/01 08:57
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();
}
}
}
- 纯http形式访问wfs服务范例
- osgearth访问自配置wfs矢量服务
- wfs服务查询详解
- wfs-T服务CRUD
- IIS环境下OpenLayers使用WFS服务跨域访问问题之解决方案
- C#环境下使用 Get 和Post 的方式访问WFS服务
- geoserver服务wfs之GetFeature
- openlayer之加载wfs服务
- C# Http协议访问服务
- Android访问Http流媒体服务
- 基于Restful形式访问远程服务并封装对象
- 使用OpenLayers访问天地图WFS数据
- ms4w发布wfs,用qgis可以访问
- arcgis调用国家天地图wfs服务
- 地图服务 WMS WFS WCS TMS
- SuperMap iClient如何使用WFS服务
- 针对wfs服务的增删改查
- openlayer3加载geoserver发布的WFS服务
- 矩形覆盖
- 11月5号感想
- codeblocks 调试
- 用python来开发webgame服务端(3)
- redis 的环境搭建 (win和linux下)
- 纯http形式访问wfs服务范例
- Java中重载和重写的区别
- 根据中国气象局提供的API接口实现天气查询
- PHP学习 # mvc
- CI框架连接数据库配置操作以及多数据库操作
- 用python来开发webgame服务端(4)
- Entity Framework实践系列
- mysql基于二进制文件的恢复
- stopPropagation, preventDefault 和 return false 的区别