arcgis調用國家天地圖wfs服務

1.國家天地圖wfs地址 html

getcapabilitiesapi

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

操做名網站

參數名編碼

是否必須url

備註spa

GetCapabilities.net

VERSIONcode

orm

服務版本號,支持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();
        }
    }

}
相關文章
相關標籤/搜索