1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > GIS 如何选择GeoServer WMS GetFeatureInfo请求返回的字段?

GIS 如何选择GeoServer WMS GetFeatureInfo请求返回的字段?

时间:2022-11-28 17:07:29

相关推荐

GIS 如何选择GeoServer WMS GetFeatureInfo请求返回的字段?

问题描述

我运行基于PostGIS /GeoServer /OpenLayers堆栈的简单本地映射服务。

关于opengeotutorial我把OpenLayers中的点击事件绑定到WMS GetFeatureInfo调用,使用:

map.events.register("click", map, function (e) { var url = "http://localhost:1979/geoserver/wms" + "?REQUEST=GetFeatureInfo" + "&EXCEPTIONS=application/vnd.ogc.se_xml" + "&BBOX=" + map.getExtent().toBBOX() + "&X=" + e.xy.x + "&Y=" + e.xy.y + "&INFO_FORMAT=text/html" + "&QUERY_LAYERS=MYDATA:MYLAYER" + "&LAYERS=MYDATA:MYLAYER" + "&FEATURE_COUNT=5" + "&SRS=EPSG:3857" + "&STYLES=" + "&WIDTH=" + map.size.w + "&HEIGHT=" + map.size.h; window.open(url, "getfeatureinfo", "location=0,status=0,scrollbars=1,width=800,height=125" ); });

我使用GeoServer的FreeMarkertemplates来正确格式化响应。我遇到的问题是我得到的响应将返回图层中的所有字段。

有没有办法选择与用户相关的那些?

最佳解决思路

看起来不好(source):

… GetFeatureInfo […] is a WMS request and WFS. […] One difference in their behaviour is that Geoserver sends always all the attributes with GetFeatureInfo but with WFS the list of attributes can be given in the request.

您可以创建一个视图,其中仅包含用户希望/应该看到并通过Geoserver提供的属性。

另一种选择是adjust die GetFeatureInfo template。

次佳解决思路

只需不要在您的freemarker模板中添加不需要的字段。见/trunk/en/user/tutorials/GetFeatureInfo/index.html#custom-templates

第三种解决思路

您可以使用GeoServer propertyName WMS请求参数来执行此操作:

/stable/en/user/services/wms/vendor.html#propertyname

参考文献

How to select fields returned by GeoServer WMS GetFeatureInfo request?

注:本文内容整合自google/baidu/bing辅助翻译的英文资料结果。如果您对结果不满意,可以加入我们改善翻译效果:gxnotes#(#替换为@)。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。