OpenLayers3/GeoServer 轮廓功能
Contouring function with OpenLayers3/GeoServer
我们正在数据库中储存栅格,我们希望在我们的网络应用程序中实现一个功能,允许用户根据栅格向地图添加等高线。我们希望用户能够自定义轮廓级别和颜色。
有人知道我应该使用哪些工具吗?我认为我应该使用 GeoServer 的 Python 脚本扩展,但我不知道是否可以实现这样的功能。
感谢您的评论!
在 GeoServer 中从栅格数据源动态创建等高线的最简单方法是使用渲染变换 gs:Contour
。有一个full example in the documentation。这显示了如何使用 SLD 文件指定轮廓值,然后在渲染时提取轮廓值并使用 SLD 文件的其余部分绘制。该示例假定使用静态文件的一组固定轮廓,这是最简单的。
但是 WMS standard allows a client (OpenLayers) to upload a new SLD file with a map request - this is exactly what you want to do here. I suggest that you generate a working SLD file and then use a templating engine of your choice to insert the user's chosen values into the file before sending it to GeoServer for processing. The downside of this is that you will need to send the SLD file with each request and tiling will probably not work well (at all?). You may be able to speed things up a bit by using library mode 的样式,但有使客户复杂化的风险。
我们正在数据库中储存栅格,我们希望在我们的网络应用程序中实现一个功能,允许用户根据栅格向地图添加等高线。我们希望用户能够自定义轮廓级别和颜色。
有人知道我应该使用哪些工具吗?我认为我应该使用 GeoServer 的 Python 脚本扩展,但我不知道是否可以实现这样的功能。
感谢您的评论!
在 GeoServer 中从栅格数据源动态创建等高线的最简单方法是使用渲染变换 gs:Contour
。有一个full example in the documentation。这显示了如何使用 SLD 文件指定轮廓值,然后在渲染时提取轮廓值并使用 SLD 文件的其余部分绘制。该示例假定使用静态文件的一组固定轮廓,这是最简单的。
但是 WMS standard allows a client (OpenLayers) to upload a new SLD file with a map request - this is exactly what you want to do here. I suggest that you generate a working SLD file and then use a templating engine of your choice to insert the user's chosen values into the file before sending it to GeoServer for processing. The downside of this is that you will need to send the SLD file with each request and tiling will probably not work well (at all?). You may be able to speed things up a bit by using library mode 的样式,但有使客户复杂化的风险。