OGC WFS Filter学习心得

匿名 (未验证) 提交于 2019-12-03 00:20:01
private String formatFilter(String coordinates, String radius, String properName) {     StringBuffer buffer = new StringBuffer();     buffer.append("<ogc:Filter><ogc:Intersects>");     buffer.append("<ogc:PropertyName>Shape</ogc:PropertyName>");     if (StringUtils.isNotBlank(radius)) {         //圈选         buffer.append("<gml:Point srsName=\"http://www.opengis.net/gml/srs/epsg.xml#4326\">");         buffer.append("<gml:coordinates>"+convertSort(coordinates)+"</gml:coordinates>");         buffer.append("</gml:Point>");         buffer.append("<ogc:Distance unit=\"m\">"+radius+"</ogc:Distance>");     } else {         if (coordinates.indexOf(";") > -1) {             String coorArr[] = coordinates.split(";");             String coors = "";             int coorArrLen = coorArr.length;            //             buffer.append("<gml:Polygon srsName=\"http://www.opengis.net/gml/srs/epsg.xml#4326\">");             buffer.append("<gml:outerBoundaryIs>");             buffer.append("<gml:LinearRing>");             for (int i = 0; i < coorArrLen; i++) {                 String coor = convertSort(coorArr[i]);                 coors += coor + " ";             }             coors = coors.substring(0, coors.length() - 1);             buffer.append("<gml:coordinates>" + coors + " </gml:coordinates>");             buffer.append("</gml:LinearRing>");             buffer.append("</gml:outerBoundaryIs>");             buffer.append("</gml:Polygon>");         } else {            //             buffer.append("<gml:Point srsName=\"http://www.opengis.net/gml/srs/epsg.xml#4326\">");             buffer.append("<gml:coordinates>" + convertSort(coordinates) + "</gml:coordinates>");             buffer.append("</gml:Point>");          }     }     buffer.append("</ogc:Intersects>");     buffer.append("</ogc:Filter>");     return buffer.toString();   

}

Filter是用的Intersects,

convertSort(str)做了个坐标互换位置

调用的ArcGis server发布的WFS

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!