简体   繁体   English

使用过滤器从GeoServer获取GeoJSON

[英]Get GeoJSON from GeoServer with filter

I have published a map service in GeoServer, and there are thousands of features in there. 我已经在GeoServer中发布了地图服务,并且其中包含数千个功能。 When I generate GeoJSON from Layer Preview with out "maxFeatures=50", the process is getting extremely slow. 当我从图层预览中生成GeoJSON且没有“ maxFeatures = 50”时,该过程变得非常缓慢。 So I was wondering that if there is a way that I can put some filter in the request url so I can get specifically what I want instead of all features? 所以我想知道是否有一种方法可以在请求url中放置一些过滤器,以便我可以明确地获得想要的内容而不是所有功能?

For example, I want get features whose name equals to "test", can I make the url: 例如,我要获取名称等于“ test”的功能,是否可以创建网址:

http://domain.com:8188/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=Gistic:V_STRUCTURES_WFS&outputFormat=json&name=test http://domain.com:8188/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=Gistic:V_STRUCTURES_WFS&outputFormat=json&name=test

in order to filter? 为了过滤?

If not, is there any other way to do it? 如果没有,还有其他方法吗?

Thanks 谢谢

In the geoserver documentation (section GetFeature) its is stated that you can filter on properties exactly like you suggested with &name=test. geoserver文档 (GetFeature部分)中,声明可以按与&name = test建议的完全相同的属性进行过滤。 If you want to filter on "test" and "rest" you can comma separate the values like this: 如果要过滤“测试”和“休息”,可以用逗号分隔这些值:

&name=test,rest

You can also filter on bbox. 您也可以在bbox上进行过滤。 If you want more filter options you'll have to do a POST instead of a GET. 如果需要更多过滤器选项,则必须执行POST而不是GET。

Try to replace each character ":" by %3A 尝试将每个字符“:”替换为%3A

good luck 祝好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM