OGC API-功能¶
一个 OGC Features API 使用OpenAPI Web服务发布要素数据。
功能实施状态¶
版本 |
执行情况 |
|
---|---|---|
第1部分:核心 |
通过合规性测试 |
|
第2部分:参照坐标系 |
通过合规性测试 |
|
第3部分:过滤 |
已执行的草案(请记住,草案不包括过滤语言) |
|
第4部分:创建、替换、更新和删除 |
未实施(招募志愿者/赞助商) |
|
通用查询语言(CQL2) |
为文本和JSON编码实现了较早的草案。待更新。 |
|
N部分:按ID查询 |
建议已实施,但语法和语义可能会在未来版本中更改。因此,应该仔细考虑用法。 |
安装Geoserver OGC API功能模块¶
从下载OGC API Night Geoserver社区模块 geoserver-2.24.x-ogcapi-features-plugin.zip 。
警告
验证文件名中的版本号是否与您正在运行的Geoserver版本对应(例如,Geoserver- 2.24.x -ogcapi-Feature-plugin.zip)。
将存档的内容提取到
WEB-INF/lib
地理服务器安装目录。重新启动时,http://localhost:8080/geoserver上列出了这些服务
使用OGC API-功能服务¶
OGC API功能服务可通过 FEATURES 版本 1.0 主页上的链接。
能力¶
该服务通过以下方式自我描述:
html
:网页的集合,带有用于在内容之间导航的链接(并且可以由搜索引擎索引以便于发现)。OGC API功能服务¶
application/json :一组
json
文档,在每个文档之间进行引用,以供Web开发人员编程访问。{ "title": "GeoServer Web Feature Service", "description": "This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.", "links": [ { "href": "http://localhost:8080/geoserver/ogc/features/?f=application%2Fx-yaml", "rel": "alternate", "type": "application/x-yaml", "title": "This document as application/x-yaml" }, { "href": "http://localhost:8080/geoserver/ogc/features/?f=application%2Fjson", "rel": "self", "type": "application/json", "title": "This document" }, { "href": "http://localhost:8080/geoserver/ogc/features/?f=text%2Fhtml", "rel": "alternate", "type": "text/html", "title": "This document as text/html" }
application/x-yaml
:一组yaml
文档,每个文档之间有引用以供编程访问。title: GeoServer Web Feature Service description: This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction. links: - href: http://localhost:8080/geoserver/ogc/features/?f=application%2Fx-yaml rel: self type: application/x-yaml title: This document - href: http://localhost:8080/geoserver/ogc/features/?f=application%2Fjson rel: alternate type: application/json title: This document as application/json - href: http://localhost:8080/geoserver/ogc/features/?f=text%2Fhtml rel: alternate type: text/html title: This document as text/html
服务标题和描述由现有的 Web要素服务(WFS) 设置。
开放API¶
对于编程访问,请使用 OpenAPI 提供了服务的描述,其可以作为文档进行浏览,或者用于生成访问Web服务的客户端。

OGC API功能OpenAPI文档¶
收藏¶
由服务发布的要素类型的集合。
每个集合条目使用标题、描述、地理范围的层详细信息来描述。
数据可以作为网页进行浏览,也可以下载一系列格式,例如 GeoJSON
和 GML
文件。

文集SF:Roads下载格式¶
合规性¶
列出了该服务可以执行的操作,每个“一致性类”都记录了支持的功能。

OGC API功能一致性¶
联系信息¶
播发该服务的联系信息。
定义人在定义人中定义 联系方式 。
配置OGC API-功能模块¶
该服务不需要任何其他配置即可使用。该服务使用以下方式进行配置:
现有的 Web要素服务(WFS) 定义标题、摘要和输出格式的设置。
这就是为什么服务页面的标题是
GeoServer Web Feature Service
默认情况下。用于生成html的内置模板
可以按服务或按集合添加额外链接,如中所示 配置Geoserver OGC API模块 。
Html模板¶
要覆盖OGC API功能模板,请执行以下操作:
创建一个目录
ogc/features
在您要覆盖的位置中:GEOSERVER_DATA_DIR/templates/ogc/features/v1
GEOSERVER_DATA_DIR/workspace/workspace/ogc/features/v1
GEOSERVER_DATA_DIR/workspace/workspace/datastore/ogc/features/v1
GEOSERVER_DATA_DIR/workspace/workspace/datastore/featuretype/ogc/features/v1
使用Geoserver在此位置创建文件 2.24.x 示例如下:
上面的内置示例适用于Geoserver 2.24.x ,请在升级Geoserver时检查是否有任何更改。
用于列出功能内容的模板在OGC API服务之间共享。要覆盖用于列出功能的模板,请执行以下操作:
使用要覆盖的位置中的目录:
GEOSERVER_DATA_DIR/templates
GEOSERVER_DATA_DIR/workspace/workspace
GEOSERVER_DATA_DIR/workspace/workspace/datastore
GEOSERVER_DATA_DIR/workspace/workspace/datastore/featuretype
使用Geoserver在此位置创建文件 2.24.x 示例如下:
上面的内置示例适用于Geoserver 2.24.x ,请在升级Geoserver时检查是否有任何更改。
例如,自定义集合的列出方式:
档案
ogc/features/collections.ftl
列出已发布的收藏:<#global pagecrumbs="<li class='breadcrumb-item'><a href='"+serviceLink("")+"'>Home</a></li><li class='breadcrumb-item active'>Collections</li>"> <#include "common-header.ftl"> <h1>GeoServer Feature Collections</h1> <p class="my-4"> This document lists all the collections available in the Features service.<br/> </p> <div class="row"> <#list model.collections as collection> <div class="col-xs-12 col-md-6 col-lg-4 pb-4"> <div class="card h-100"> <div class="card-header"> <h2><a href="${serviceLink("collections/${collection.id}")}">${collection.id}</a></h2> </div> <#include "collection_include.ftl"> </div> </div> </#list> </div> <#include "common-footer.ftl">
将文件保存到
GEOSERVER_DATA_DIR/workspace/templates/ogc/collections.ftl
,并重写为:<#include "common-header.ftl"> <h2>OGC API Feature Collections</h2> <p>List of collections published.</p> <p>See also: <#list model.getLinksExcept(null, "text/html") as link> <a href="${link.href}">${link.type}</a><#if link_has_next>, </#if></#list>.</p> <#list model.collections as collection> <h2><a href="${serviceLink("collections/${collection.id}")}">${collection.id}</a></h2> <#include "collection_include.ftl"> </#list> <#include "common-footer.ftl">
许多模板都是使用
#include
例如,collection.ftl
以上用途<#include "common-header.ftl">
位于…旁边collections.ftl
。目前,每个模板系列都管理着自己的模板
common-header.ftl
(如以下差异所示ogc/features
服务模板和上面的getFeature模板)。由于模板被缓存,因此需要重新启动。
模板集合。已应用ftl覆盖¶
附加语言代码是为了实现国际化。对于法语,创建文件
GEOSERVER_DATA_DIR/workspace/workspace/ogc/collections_fr.ftl
并翻译内容:<#include "common-header.ftl"> <h2>OGC API Feature Service</h2> <p>Liste des collections publiées.</p> <p>Voir également: <#list model.getLinksExcept(null, "text/html") as link> <a href="${link.href}">${link.type}</a><#if link_has_next>, </#if></#list>.</p> <#list model.collections as collection> <h2><a href="${serviceLink("collections/${collection.id}")}">${collection.id}</a></h2> <#include "collection_include.ftl"> </#list> <#include "common-footer.ftl">
有关如何编写模板的详细信息,请参见 自由标记模板 教程。