[MapServer-users] OGCAPI

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Wed Apr 9 01:50:19 PDT 2025


Hi,

When it comes to max 10000 items, if you have a look at the bottom of the GeoJSON output you will see what happens.

{"href":"https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections/kdb_alle/items?f=json&limit=10000&offset=10000%22,%22rel%22:%22next%22,%22title%22:%22next page","type":"application/geo+json"}],"numberMatched":48151,"numberReturned":10000,"type":"FeatureCollection"}

So there are 48151 items in the collection, the request returned first 10000 of those, and response includes a "next" link that will give more items. That's how paging in OGC API Features is planned to work.  As far as I know QGIS does support paging when the setting "Feature paging" in the "WFS Options" is set to "Default" or "Enabled".

I agree that the service is slow. The following service is not running on Mapserver but on another open source server (hakunapi) and the speed is something totally different. Hopefully some configuration trick will make you Mapserver fast as well.

https://beta-paikkatieto.maanmittauslaitos.fi/inspire-addresses/features/v1/collections/addresses/items?f=json&limit=10000

-Jukka Rahkonen-
________________________________________
Lähettäjä: MapServer-users käyttäjän Jörg Thomsen (WhereGroup) via MapServer-users puolesta
Lähetetty: Keskiviikko 9. huhtikuuta 2025 10.28
Vastaanottaja: mapserver-users at lists.osgeo.org
Aihe: Re: [MapServer-users] OGCAPI


Hello Sven,

somehow qgis tried to use a wfs-request. I had to configure your service
explizit as OGC-Api (not "Maximum") and delete the cache in QGIS. Now I
can use both collections.

The kdb_alle works not for all items, I have tried up to 10.000 (in QGIS
with checkbox 'only load items i curent mapxtent'.

https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections/kdb_alle/items?f=json&limit=10000

Don't know what ist happening, perhaps the MapServer log can tell you more.

Jörg

Am 08.04.25 um 17:56 schrieb Schroeter via MapServer-users:
> Hi all,
>
> I am currently testing the ogcapi function in the current Mapserver 8.4
> and already have an example online:
> https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections?f=html
> In the first collection, all objects (approx. 48,000 point objects from
> a Postgis DB) are queried. Unfortunately extremely slow.
> If I query all objects via a WMS, they come very quickly, it should not
> be due to the DB or the connection, everything is cleanly indexed etc.:
> https://kulturdb.de/cgi-bin/mapserv?map=kdb&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=49.49%2C6.0739%2C50.4%2C7.296&CRS=EPSG%3A4326&WIDTH=762&HEIGHT=588&LAYERS=kdb_alle&STYLES=&FORMAT=image%2Fpng
>
> With the second collection with only 333 objects, it works quite well:
> https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections/kdb_brunnen/items?f=html
>
> Here is the map file for it
>
> MAP
>    NAME "kdb_trier"
>    STATUS ON
>    SIZE 400 400
>    EXTENT 6.074 49.492 7.296 50.435
>    UNITS METERS
>
>    PROJECTION
>      "init=epsg:4326"
>    END
>
>    WEB
>    METADATA
>      # OGC API Features Konfiguration
>      "ows_enable_request"                     "*"
>      "ows_getfeatureinfo_formatlist"
> "text/plain,text/html,application/json,application/vnd.ogc.gml,gml"
>      "oga_onlineresource"
> "https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi"
>      "oga_title"                              "KDB Trier"
>      "oga_abstract"                           "Objekte der
> Kulturdatenbank der Region Trier"
>      "oga_srs"                                "EPSG:25832 EPSG:4326
> EPSG:3857"
>      "oga_html_template_directory"
> "/var/www/html/ogcapi/templates/html-bootstrap4/"
>      "oga_extent"                             "6.074 49.492 7.296 50.435"
>      "oga_use_default_extent_for_getfeature"  "true"
>      "oga_limit_default"                      "10"
>      "oga_limit_max"                          "500"
>      "oga_paging"                             "true"
>      "oga_paging_linkheader"                  "true"
>      "gml_include_items"                         "all"
>      "gml_featureid"                             "lfdnr"
>    END
>
>      TEMPLATE "/var/www/mapserver/template/dummy.html"
>
>    END
>
>   OUTPUTFORMAT
>      NAME "png"
>      DRIVER AGG/PNG
>      MIMETYPE "image/png"
>      IMAGEMODE RGB
>      EXTENSION "png"
>      FORMATOPTION "GAMMA=0.75"
>    END
>
>    OUTPUTFORMAT
>      NAME "application/json"
>      DRIVER "OGR/GEOJSON"
>      MIMETYPE "application/json"
>      FORMATOPTION "FORM=SIMPLE"
>      FORMATOPTION "STORAGE=memory"
>    END
>
>    SYMBOL
>      NAME "circle"
>      TYPE ELLIPSE
>      POINTS
>        1 1
>      END
>      FILLED TRUE
>    END
>
>    LAYER
>      NAME "kdb_alle"
>      TYPE POINT
>      STATUS ON
>      INCLUDE "_connection_kdb.inc"
>      DATA "the_geom FROM kdb_kultur_ogr  USING UNIQUE lfdnr"
>      PROJECTION
>        "init=epsg:4326"
>      END
>
>      METADATA
>
>        # OGC API Features Metadaten
>        "oga_title"                              "KDB Trier - alle Objekte"
>        "oga_description"                        "Alle Objekte der
> Kulturdatenbank der Region Trier"
>        "oga_id_field"                           "lfdnr"
>        "oga_queryable"                          "true"
>        "oga_extent"                             "6.074 49.492 7.296 50.435"
>        "ows_title"                                "KDB Trier - alle Objekte"
>        "ows_abstract"                            "Alle Objekte der
> Kulturdatenbank der Region Trier"
>        "oga_extent"                             "6.074 49.492 7.296 50.435"
>        "oga_use_default_extent_for_getfeature"  "true"
>        "oga_limit_default"                      "10"
>        "oga_limit_max"                          "500"
>        "oga_paging"                             "true"
>        "oga_paging_linkheader"                  "true"
>        "gml_include_items"                        "all"
>        "gml_featureid"                            "lfdnr"
>
>      END
>
>      TEMPLATE "/var/www/mapserver/template/dummy.html"
>
>      CLASS
>        NAME "KDB"
>        STYLE
>          SYMBOL "circle"
>          SIZE 6
>          COLOR 255 0 0
>          OUTLINECOLOR 255 255 255
>        END
>      END
>    END  # LAYER
>
>
>    LAYER
>      NAME "kdb_brunnen"
>      TYPE POINT
>      STATUS ON
>      INCLUDE "_connection_kdb.inc"
>      DATA "the_geom FROM (SELECT * FROM kdb_kultur_ogr WHERE b_kateg =
> 'Brunnen') AS foo  USING UNIQUE lfdnr"
>      PROJECTION
>        "init=epsg:4326"
>      END
>
>      METADATA
>
>        # OGC API Features Metadaten
>        "oga_title"                               "KDB Trier - Brunnen"
>        "oga_description"                         "Brunnen Objekte der
> Kulturdatenbank der Region Trier"
>        "oga_id_field"                            "lfdnr"
>        "oga_queryable"                           "true"
>        "oga_extent"                              "6.074 49.492 7.296
> 50.435"
>        "ows_title"                                 "KDB Trier - Brunnen"
>        "ows_abstract"                             "Brunnen Objekte der
> Kulturdatenbank der Region Trier"
>        "oga_extent"                              "6.074 49.492 7.296 50.435"
>        "oga_use_default_extent_for_getfeature"  "true"
>        "oga_limit_default"                      "10"
>        "oga_limit_max"                          "500"
>        "oga_paging"                             "true"
>        "oga_paging_linkheader"                  "true"
>        "gml_include_items"                        "all"
>        "gml_featureid"                            "lfdnr"
>
>      END
>
>     TEMPLATE "/var/www/mapserver/template/dummy.html"
>
>      CLASS
>        NAME "KDB"
>        STYLE
>          SYMBOL "circle"
>          SIZE 6
>          COLOR 255 0 0
>          OUTLINECOLOR 255 255 255
>        END
>      END
>    END  # LAYER
>
>
> END  # MAP
>
> THE MS Version:
> MapServer version 8.4.0 PROJ version 9.1 GDAL version 3.6 OUTPUT=PNG
> OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE
> SUPPORTS=CAIRO SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT
> SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER
> SUPPORTS=SOS_SERVER SUPPORTS=OGCAPI_SERVER SUPPORTS=FASTCGI
> SUPPORTS=THREADS SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR
> INPUT=GDAL INPUT=SHAPEFILE INPUT=FLATGEOBUF
>
> 1. How can I speed up the display for the first collection?
> 2. the collections are not recognised in QGIS, What ist wrong?
>
> Thanx
> Sven
>
>
>
>
>
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users

--
Viele Grüße,
Jörg Thomsen

****************************************
WhereGroup Shorts 2025 - am 15. Mai
Im Fokus: PostgreSQL & PostGIS
Online als Zoom-Meeting
https://wheregroup-shorts.de/
****************************************



Jörg Thomsen
WhereGroup GmbH
Bundesallee 23
10717 Berlin
Germany

Tel: +49 (0)30 / 5130 278 74
Fax: +49 (0)30 / 5130 278 11

joerg.thomsen at wheregroup.com
http://www.wheregroup.com/

Geschäftsführer:
Olaf Knopp, Peter Stamm
Amtsgericht Bonn, HRB 9885


_______________________________________________
MapServer-users mailing list
MapServer-users at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the MapServer-users mailing list