function getLocationByWfsPolygon(layerName,func,bBox){
var _this = this
var href = window.location.href.split("/")[2]
var sql = "1=1"
,typeName = 'xatree:' + layerName
//,url = wfsUrl
,url = 'https://web.skyimin.com/geoserver/xatree/ows/'
,cql = 'cql_filter=' + sql
console.log(bBox)
var params={
service:'WFS',
version:'1.0.0',
request:'GetFeature',
typeName:typeName,
outputFormat:'application/json',
//cql_filter:sql,
maxFeatures:"50",
filter:`
<Filter xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">
<Intersects>
<PropertyName>The_Geom</PropertyName>
<gml:Polygon srsName="EPSG:4326">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts="">116.707206,32.6651 116.705943,32.665517 116.70605,32.664144 116.707338,32.663457 116.708475,32.664723 116.707206,32.6651</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</Intersects>
</Filter>
`
}
var u = url + L.Util.getParamString(params, url)
console.log(u)
$.ajax({
url:u,
type:"get",
contentType: 'application/json',
success: function(res){
console.log(res)
if(func) func(res)
},
error:function(err){
console.log(err,'错误');
}
})
}
1.要注意的是,这里一定得是1.0.0不能是1.1.0,我就是在这里被坑了
2.这里一定要写上
image.png
decimal="." //小数点
cs="," //分隔符1
ts="" //分隔符2
网友评论