<!DOCTYPE html><html><head><title></title><style type="text/css">p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Hi Sven,<br></div><div><br></div><div>I ran into a couple of performance issues with PostGIS / OGC Features API, see:<br></div><div><br></div><div><a href="https://github.com/MapServer/MapServer/pull/7198">https://github.com/MapServer/MapServer/pull/7198</a><br></div><div><a href="https://github.com/MapServer/MapServer/pull/7197">https://github.com/MapServer/MapServer/pull/7197</a><br></div><div><br></div><div>So maybe try setting the type for your ID field, and wfs_use_default_extent_for_getfeature. If you are using MapServer 8.4 they might help. <br></div><div><br></div><div>Seth</div><div><br></div><div id="sig62266145"><div class="signature">--<br></div><div class="signature">web:<a href="https://geographika.net">https://geographika.net</a> & <a href="https://mapserverstudio.net">https://mapserverstudio.net</a><br></div><div class="signature">mastodon: @<a href="mailto:geographika@mastodon.social">geographika@mastodon.social</a><br></div></div><div><br></div><div>On Wed, Apr 9, 2025, at 11:52 AM, Schroeter via MapServer-users wrote:<br></div><blockquote type="cite" id="qt" style=""><div><span class="font" style="font-family:Arial;">Hi Jukka,<br> <br> Thank you very much, that was the solution for QGIS.<br> I now also have an interim solution for performance.<br> I have exported the table as a geopackage and connected it, and lo
      and behold, everything runs very quickly:<br> <a class="qt-moz-txt-link-freetext" href="https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections/kdb_alle/items?f=json&limit=10000">https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections/kdb_alle/items?f=json&limit=10000</a><br> Since my queries to the Postgis table also run very quickly via
      PHP, it can't really be the Postgis DB. Is the performance problem
      in MS with Postgis a bug?<br><br></span></div><div class="qt-moz-signature"><div>Greetings<br></div><div> <br></div><div> Sven Schröter<br></div><div> <br></div><div> **************************************<br></div><div> NETGIS GbR<br></div><div> Benediktinerstr. 32a<br></div><div> 54292 Trier<br></div><div> Tel.: 0651-1704731<br></div><div> Fax: 0651-1704733<br></div><div> <a class="qt-moz-txt-link-abbreviated" href="mailto:schroeter@netgis.de">schroeter@netgis.de</a><br></div><div> <a class="qt-moz-txt-link-abbreviated" href="http://www.netgis.de">www.netgis.de</a><br></div><div><br></div><div><br></div></div><div class="qt-moz-cite-prefix">Am 09.04.2025 um 11:03 schrieb Rahkonen
      Jukka:<br></div><blockquote type="cite" cite="mid:DB9PR09MB68870F321DD23D8A9DE2DF42FDB42@DB9PR09MB6887.eurprd09.prod.outlook.com"><pre class="qt-moz-quote-pre">The URL to use for the connection is the URL of the landing page

<a class="qt-moz-txt-link-freetext" href="https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/">https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/</a>

That link opens as http on a browser but QGIS knows how to read the document as JSON.

-Jukka Rahkonen-

________________________________________
Lähettäjä: MapServer-users käyttäjän Schroeter via MapServer-users puolesta
Lähetetty: Keskiviikko 9. huhtikuuta 2025 11.50
Vastaanottaja: <a class="qt-moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>
Aihe: Re: [MapServer-users] OGCAPI


Hello Jörg,

thanks for the answer, strangely enough Qgis (version 3.4) is still
stubbornly trying to send me a WFS request. I have now also cleared the
cache and explicitly set OGC-Api. The wrong request is always set in the
diagnostic tools. Which url do you enter as the source in Qgis? Have you
ever created a service with > 40,000 objects?

Sven





Am 09.04.2025 um 09:28 schrieb Jörg Thomsen (WhereGroup) via
MapServer-users:
<br></pre><blockquote type="cite"><pre class="qt-moz-quote-pre">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'.

<a class="qt-moz-txt-link-freetext" href="https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections/kdb_alle/items?f=json&limit=10000">https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections/kdb_alle/items?f=json&limit=10000</a>


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:
<br></pre><blockquote type="cite"><pre class="qt-moz-quote-pre">Hi all,

I am currently testing the ogcapi function in the current Mapserver
8.4 and already have an example online:
<a class="qt-moz-txt-link-freetext" href="https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections?f=html">https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections?f=html</a>
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.:
<a class="qt-moz-txt-link-freetext" href="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">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</a>


With the second collection with only 333 objects, it works quite well:
<a class="qt-moz-txt-link-freetext" href="https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections/kdb_brunnen/items?f=html">https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi/collections/kdb_brunnen/items?f=html</a>


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"
<a class="qt-moz-txt-link-rfc2396E" href="https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi">"https://kulturdb.de/cgi-bin/mapserv/kdb_ogcapi/ogcapi"</a>
     "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
<a class="qt-moz-txt-link-abbreviated" href="mailto:MapServer-users@lists.osgeo.org">MapServer-users@lists.osgeo.org</a>
<a class="qt-moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a>
<br></pre></blockquote><pre class="qt-moz-quote-pre"><br></pre></blockquote><pre class="qt-moz-quote-pre">_______________________________________________
MapServer-users mailing list
<a class="qt-moz-txt-link-abbreviated" href="mailto:MapServer-users@lists.osgeo.org">MapServer-users@lists.osgeo.org</a>
<a class="qt-moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a>


<br></pre></blockquote><div><br></div><div>_______________________________________________<br></div><div>MapServer-users mailing list<br></div><div><a href="mailto:MapServer-users@lists.osgeo.org">MapServer-users@lists.osgeo.org</a><br></div><div><a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br></div><div><br></div></blockquote><div><br></div></body></html>