标签: web-feature-service

如何通过 POST 正确请求地理服务器 WFS?

我有一个geoserver实例,其中包含我们的数据。通过 GET 请求可以正常工作并返回预期结果。但遗憾的是它不适用于 POST。

准确地说,这是对带有 GET 的 Capabilities 的请求,它返回一个有效的 GetCapabilities-Response:

http://myserver:8080/geoserver/wfs?service=wfs&version=1.1.0&request=GetCapabilities
Run Code Online (Sandbox Code Playgroud)

我用 wget 对此进行了测试,因此命令如下所示:

wget -O wfs 'http://myserver:8080/geoserver/wfs?service=wfs&version=1.1.0&request=GetCapabilities'
Run Code Online (Sandbox Code Playgroud)

现在我尝试使用 POST 的 Capabilities-request。我创建一个包含以下内容的请求(命名请求)文件:

<GetCapabilities
 service="WFS"
 xmlns="http://www.opengis.net/wfs"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.opengis.net/wfs
 http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>
Run Code Online (Sandbox Code Playgroud)

我使用以下 wget 对 Geoserver 运行:

wget -O wfs --post-file=request 'http://myserver:8080/geoserver/wfs'
Run Code Online (Sandbox Code Playgroud)

但现在我得到一个 OWS-Exception:

<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://moa:8080/geoserver/schemas/ows/1.1.0/owsAll.xsd">
  <ows:Exception exceptionCode="MissingParameterValue" locator="request">
    <ows:ExceptionText>Could not determine geoserver request from http request org.geoserver.platform.AdvancedDispatchFilter$AdvancedDispatchHttpRequest@1e5c2cc</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>
Run Code Online (Sandbox Code Playgroud)

这看起来好像没有发送 POST-body 或者它被忽略了。我在这里做错了什么?


编辑:好的,我解决了这个问题。问题是 Geoserver 需要一个 Content-Type-Header 来发布 XML 文件。所以正确的请求如下所示:

wget -O wfs --header='Content-Type: text/xml' --post-file=request.xml 'http://myserver:8080/geoserver/wfs' …
Run Code Online (Sandbox Code Playgroud)

post geoserver web-feature-service

5
推荐指数
1
解决办法
9459
查看次数

列出可用的WFS图层并使用rgdal读入数据框

我根据不同的来源有以下问题它应该能够在R中读取WFS层使用rgdal.

dsn<-"WFS:http://geomap.reteunitaria.piemonte.it/ws/gsareprot/rp-01/areeprotwfs/wfs_gsareprot_1?service=WFS&request=getCapabilities"

ogrListLayers(dsn)
readOGR(dsn,"SIC")
Run Code Online (Sandbox Code Playgroud)

该代码的结果应该是1)列出可用的WFS层,2)将特定的层(SIC)读入R作为空间(点)数据帧.

我尝试了其他几个WFS服务器,但它不起作用.我总是收到警告:

Cannot open data source
Run Code Online (Sandbox Code Playgroud)

检查WFS驱动程序,我得到以下结果:

> "WFS" %in% ogrDrivers()$name
[1] FALSE
Run Code Online (Sandbox Code Playgroud)

好吧看起来WFS驱动程序没有在rgdal中实现(不再?)或者为什么有这么多例子"声称"相反?

我也尝试过这个gdalUtils包,但是它有效但是它给出了ogrinfo.exe的整个控制台消息,而不仅仅是可用的层.(我猜它"只是"调用ogrinfo.exe并将结果发送回R,就像使用[R shellsystem命令).

那么有谁知道我做错了什么,或者如果这样的东西甚至可能与rgdal任何类似的包裹?

r rgdal web-feature-service

4
推荐指数
1
解决办法
1966
查看次数

具有时间参数的WFS GetFeature查询未在Geoserver中过滤

我正在尝试通过在geoserver中使用WFS GetFeature来按GML格式按日期过滤一些数据,但是该操作会忽略time参数,而仅返回包含所有数据的巨大GML文件。这是我正在使用的查询:

http://localhost:8082/geoserver/it.geosolutions/ows?service=WFS&version=1.2.0&request=GetFeature&typeName=it.geosolutions:tsige&time=2011-07-25T00:00:00.0Z/2011-07-25T23:59:59.999Z
Run Code Online (Sandbox Code Playgroud)

根据这个,时间参数应在WFS GetFeature操作的支持,所以我不知道什么是错。此外,我还有什么其他选择来按时间以XML或JSON格式或其他易于解析的格式过滤数据?

wms geoserver web-feature-service

3
推荐指数
1
解决办法
3911
查看次数

标签 统计

web-feature-service ×3

geoserver ×2

post ×1

r ×1

rgdal ×1

wms ×1