[MapServer-users] How to cascade data from OGC API Features service?

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Tue Nov 14 01:44:40 PST 2023


Hi,

MS4W 5.0.0 RC1 contains GDAL version that does not include this enhancement https://github.com/OSGeo/gdal/issues/8522.
It means that my Mapserver was reading OGCFeat only 10 features at a time. That gives all too bad impression about the speed of the OGCFeat source. The VRT below works also with older GDAL versions, it is reading a thousand times bigger pages, it is faster, and it does not bloat our server logs. A hint for debuggers: the document https://mapserver.org/optimization/debugging.html#table-of-contentseven is not totally accurate. Even when MS_ERRORFILE is set, some debug data, including the outgoing http requests, go to the Apache error_log.

<OGRVRTDataSource>
    <OGRVRTLayer name="building">
        <SrcDataSource>OAPIF:https://beta-paikkatieto.maanmittauslaitos.fi/inspire-buildings/features/v1/</SrcDataSource>
        <SrcLayer>building</SrcLayer>
        <OpenOptions>
                <OOI key="PAGE_SIZE">10000</OOI>
      </OpenOptions>
    </OGRVRTLayer>
</OGRVRTDataSource>

-Jukka Rahkonen-

Lähettäjä: MapServer-users <mapserver-users-bounces at lists.osgeo.org> Puolesta Rahkonen Jukka via MapServer-users
Lähetetty: tiistai 14. marraskuuta 2023 10.09
Vastaanottaja: Richard Greenwood <richard.greenwood at gmail.com>
Kopio: Mapserver-Users (mapserver-users at lists.osgeo.org) <mapserver-users at lists.osgeo.org>
Aihe: Re: [MapServer-users] How to cascade data from OGC API Features service?

Hi,

Oh yes, it was a typo. As a user who tries to be standard compliant I had upgraded the name in one place to match with the OGC approved abbreviation “OGCFeat” instead of the GDAL driver name “OAPIF”.

The MAXSCALEDENOM value 60000 (naturally copy-pasted from some old mapfile) is all too large for that service in areas with lots of buildings. Scale 1:5000 is probably safe everywhere. A EPSG:3067 bbox for testing:
BBOX=390723,6671479,392177,6672231

Positive thing is that now also other Mapserver users know that it is possible to use OGCFeat services as source data with OGR connection. Thanks to you and TC Haddad who also found the typo.

-Jukka Rahkonen-

Lähettäjä: Richard Greenwood <richard.greenwood at gmail.com<mailto:richard.greenwood at gmail.com>>
Lähetetty: tiistai 14. marraskuuta 2023 5.38
Vastaanottaja: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>>
Kopio: Mapserver-Users (mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>) <mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>>
Aihe: Re: [MapServer-users] How to cascade data from OGC API Features service?

Are you sure that you don't just have a typo? Your file is named "ogcfeat.vrt" but your CONNECTION "c:/ms4w_data/oapif.vrt"

I set up a quick test and I haven't gotten a map (it timed out 504 error after several minutes) but I didn't get an error. Maybe you could share a smaller test data set and a reasonable bounding box. My test:
http://localhost/cgi-bin/mapserv?map=MAP_TEST&REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&LAYERS=building&WIDTH=696&HEIGHT=870&CRS=EPSG:3067&BBOX=-359700,6615190,-359500,6615199&FORMAT=png

On Mon, Nov 13, 2023 at 2:48 PM Rahkonen Jukka via MapServer-users <mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>> wrote:
Hi,

I tried to make a WMS layer from OGC API Features service but I did not success. This is my best trial so far:

I am using Mapserver from MS4W 5.0.0 RC1
I wrote this ORG VRT file (ogcfeat.vrt)

<OGRVRTDataSource>
    <OGRVRTLayer name="building">
        <SrcDataSource>OAPIF:https://beta-paikkatieto.maanmittauslaitos.fi/inspire-buildings/features/v1/</SrcDataSource>
        <SrcLayer>building</SrcLayer>
    </OGRVRTLayer>
</OGRVRTDataSource>

The GDAL included in MS4W reads the vrt OK with
ogrinfo ogcfeat.vrt -al -so --debug on
(there are 5 millions polygons so hit Ctrl-C if you are just testing)

I wrote a layer that can be at the bottom of this message below.  The WMS GetCapabilities show the new layer but GetMaps fail. The log file collects these errors

msDrawMap(): Image handling error. Failed to draw layer named 'building'.
msOGRFileOpen(): OGR error. Open failed for OGR connection in layer `building'.  File not found or unsupported format. Check server logs.
Open failed for OGR connection in layer `building'.

Am I missing something from my configuration? My LAYER is like this

LAYER
        NAME "building"
        STATUS ON
        CONNECTIONTYPE OGR
                          CONNECTION "c:/ms4w_data/oapif.vrt"
        DATA "building"
        TYPE POLYGON
#        DEBUG 5
        UNITS METERS
        SIZEUNITS PIXELS
       MAXSCALEDENOM  60000
       TOLERANCE 3
        TOLERANCEUNITS PIXELS
        METADATA
        "wms_title" "OGCFeat-building"
        "wms_include_items" "all"
        END #metadata
        PROJECTION
                                "init=epsg:3067"   ##recommended
                          END
                          CLASS
                            NAME "building"
                                STYLE
                                  COLOR 200 255 200
                                  OUTLINECOLOR 120 120 120
                                END # Style
        END # Class
    TEMPLATE "empty" ##recommended (enable GetFeatureInfo / can point to valid .html template)

 END # Layer
-Jukka Rahkonen-
_______________________________________________
MapServer-users mailing list
MapServer-users at lists.osgeo.org<mailto:MapServer-users at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/mapserver-users


--
Richard W. Greenwood
www.greenwoodmap.com<http://www.greenwoodmap.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20231114/9641b625/attachment.htm>


More information about the MapServer-users mailing list