[MapServer-users] OGCAPI

Schroeter schroeter at netgis.de
Tue Apr 8 08:56:28 PDT 2025


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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20250408/0bae1f0f/attachment.htm>


More information about the MapServer-users mailing list