【问题标题】:Openlayers3 how to get the max feature id in postgis through geroserverOpenlayers3如何通过geroserver获取postgis中的最大特征id
【发布时间】:2016-01-13 18:52:17
【问题描述】:

我想使用openlayers 3通过geoserver获取postgis中的最大特征ID,有人有想法吗?我在 openlayers3 中尝试过使用 CQL,但语法不正确,我无法从互联网上找到好的示例来展示 openlayers3 如何使用 cql 从地理服务器查询某事。 有人有例子吗?

【问题讨论】:

    标签: openlayers-3


    【解决方案1】:

    你不需要 openlayers 甚至 CQL 来做到这一点。 只需向您的地理服务器执行获取请求,如下所示:

    http://yourhost:port/geoserver/wfs?request=GetFeature&typeName=namespace:featuretype&propertyName=ID&version=1.0.0&sortBy=ID+D&maxFeatures=1

    让我们看看我们的参数

    &typeName=namespace:featuretype -->这是你的图层名称

    &propertyName=ID --> 这些是应该在响应中返回的属性。使用逗号添加更多属性

    &sortBy=ID+D --> 表示使用 ID 字段对结果进行排序,+D 表示按降序排列

    &maxFeatures=1 -->只返回一个特征。

    总结一下。 Geoserver 先生只给我一个功能,从按 id 排序的图层“namespace:featuretype”中按降序排列。 更多信息here

    【讨论】:

    • 谢谢,很好,基于它的进一步问题,我想得到数据库中总特征的数量,有没有一些简单的方法来做
    • 对于propertyName=ID,能否举个例子
    • localhost:8080/mapassist_geoserver281/mapassist/wfs?request=GetFeature&typeName=mapassist:pand_denbosch&version=1.1.0&sortBy=gid+D&maxFeatures=1propertyname=gid 不起作用,并出现无异常错误
    • 什么错误??? gid 是数据库表中的正确字段吗????对于全部功能,将 &resultType=hits 添加到您的网址并删除 &maxFeatures=1
    • // $http.get('dbgeo01.csampubdemo.net.crotecvps.nl:8080/…) // .success(function(data) { // console.log(data); // });请检查它,它是公共服务器,你可以测试它
    猜你喜欢
    • 2017-06-26
    • 2019-02-12
    • 1970-01-01
    • 1970-01-01
    • 2019-02-18
    • 1970-01-01
    • 2014-04-05
    • 2016-08-06
    • 2015-10-07
    相关资源
    最近更新 更多