MapServer OGC API Setup

444 Views Asked by At

I have been attempting to get MapServer 8.1-dev setup with IIS, which has been successful, but getting the new OGC API option is having some issues. I have confirmed that the mapserv.exe does support the OCG API via "SUPPORTS=OGCAPI_SERVER". Specifically it's failing via the following:

  • /mapserver/enc/ogcapi?f=json returns "msCGILoadMap(): Web application error. CGI variable "map" is not set."
  • /mapserver/enc/ogcapi returns "loadParams(): Web application error. No query information to decode. QUERY_STRING is set, but empty."
  • /mapserver/enc/ogcapi?f=html&map=enc returns "mapserv(): Web application error. Traditional BROWSE mode requires a TEMPLATE in the WEB section, but none was provided."

I have the following data setup as the mapfile

MAP
    NAME "US_ENC"
    CONFIG "PROJ_LIB" "C:/MapServer/bin/proj/share/"
    CONFIG "--config" "GDAL_HTTP_UNSAFESSL YES"
    STATUS ON
    EXTENT -180.000 -78.333333 180.0 81.6
    UNITS DD
    PROJECTION
        "init=epsg:4326"
    END

    WEB
        METADATA
            WMS_ENABLE_REQUEST "*"
            MVT_SIZE "512"
            WMS_TITLE "Test Title"
            WMS_SRS "EPSG:4326 EPSG:3857"

            WFS_ENABLE_REQUEST "*"
            WFS_SRS "EPSG:4326 EPSG:3857"
            WFS_TITLE "Test Title"
            wfs_getfeature_formatlist "text/plain,text/html,application/json,geojson,application/vnd.ogc.gml,gml"

            OGA_ONLINERESOURCE "/mapserver/ogcapi?map=/Mapserver/tiles/enc.map"
            OGA_HTML_TEMPLATE_DIRECTORY "C:/Mapserver/ogcapi/templates/html-bootstrap4/"
            OWS_SRS "EPSG:4326 EPSG:3857"
            OWS_GETFEATUREINFO_FORMATLIST "text/plain,text/html,application/json,geojson,application/vnd.ogc.gml,gml"
            OWS_ENABLE_REQUEST "*"
        END # METDATA
    END # WEB

    OUTPUTFORMAT
        NAME "geojson"
        DRIVER "OGR/GEOJSON"
        MIMETYPE "application/json; subtype=geojson"
        FORMATOPTION "STORAGE=stream"
        FORMATOPTION "FORM=SIMPLE"
    END

    OUTPUTFORMAT
        NAME "mvt"
        DRIVER MVT
        FORMATOPTION "EDGE_BUFFER=20"
    END

    LAYER
        LABELCACHE on
        NAME "chart" # To keep things simple all layer names will be chart
        METADATA
            WFS_TITLE "US_ENC"
            WFS_SRS "EPSG:4326 EPSG:3857"
            GML_INCLUDE_ITEMS "ALL"
            GML_FEATUREID "FILEID"
            GML_TYPES "AUTO"
            WFS_ENABLE_REQUEST "*"
            WFS_USE_DEFAULT_EXTENT_FOR_GETFEATURE "TRUE"
            OWS_TITLE "TEST"
        END # METADATA
        TYPE POLYGON
        STATUS ON
        CONNECTIONTYPE OGR
        CONNECTIONOPTIONS
            "--config" "GDAL_HTTP_UNSAFESSL YES"
        END
        CONNECTION "/vsizip/C:/Mapserver/apps/Data.zip/Data.gdb"
        DATA "Polygon_US"
        FILTER ([INTENDEDUSAGE] = 5)
        PROCESSING "CLOSE_CONNECTION=DEFER,LABEL_NO_CLIP=True"
        CLASS
            NAME "US ENC"
            STYLE
                COLOR 120 120 120
                OUTLINECOLOR 0 0 0
            END
            LABEL
                TEXT "[FILENAME]"
                COLOR 255 255 255
                OUTLINECOLOR 0 0 0
            END
        END
        TEMPLATE "VOID"
    END # LAYER

    LAYER
        LABELCACHE on
        NAME "chart2" # To keep things simple all layer names will be chart
        METADATA
            WFS_TITLE "US_ENC"
            WFS_SRS "EPSG:4326 EPSG:3857"
            GML_INCLUDE_ITEMS "ALL"
            GML_FEATUREID "FILEID"
            GML_TYPES "AUTO"
            WFS_ENABLE_REQUEST "*"
            WFS_USE_DEFAULT_EXTENT_FOR_GETFEATURE "TRUE"
            OWS_TITLE "TEST"
        END # METADATA
        TYPE POLYGON
        STATUS ON
        CONNECTIONTYPE OGR
        CONNECTIONOPTIONS
            "--config" "GDAL_HTTP_UNSAFESSL YES"
        END
        CONNECTION "/vsizip/C:/Mapserver/apps/Data.zip/Data.gdb"
        DATA "Polygon_US"
        FILTER ([INTENDEDUSAGE] = 6)
        PROCESSING "CLOSE_CONNECTION=DEFER,LABEL_NO_CLIP=True"
        CLASS
            NAME "US ENC"
            STYLE
                COLOR 120 120 120
                OUTLINECOLOR 0 0 0
            END
            LABEL
                TEXT "[FILENAME]"
                COLOR 255 255 255
                OUTLINECOLOR 0 0 0
            END
        END
        TEMPLATE "VOID"
    END # LAYER
END # MAP

I have also made sure I have set up the config as follows:

CONFIG
  ENV

    # allow any map from any location - suitable for development only
    MS_MAP_PATTERN "."

    # allow maps from anywhere in C:/MapServer/apps/ or subfolders
    # MS_MAP_PATTERN "^(C:)?\/MapServer\/apps\/((?!\.{2})[_A-Za-z0-9\-\.]+\/{1})*([_A-Za-z0-9\-\.]+\.(map))$"

    # path to the Proj4 projection files
    PROJ_LIB "C:/MapServer/bin/proj/share/"

    # point to the certs file for HTTPS access to OWS servers
    CURL_CA_BUNDLE "C:\MapServer\bin\curl\curl-ca-bundle.crt"

    # to set a default Mapfile uncomment below
    # MS_MAPFILE "C:/MapServer/apps/test/test.map"

    # to block MapServer from accesssing Mapfile by path uncomment below
    # MS_MAP_NO_PATH TRUE

    #
    # OGC API
    #
    OGCAPI_HTML_TEMPLATE_DIRECTORY "C:/MapServer/ogcapi/templates/html-bootstrap4/"
  END

  # allow Mapfiles to be accessed by key
  MAPS
    "enc" "C:/MapServer/apps/enc.map"
  END
END

Any help or insight to this question is appreciated. If this is related to an actual issue that needs to be addressed via their github I will post an issue there.

MapServer 8.1-dev was obtained from gisinternals

0

There are 0 best solutions below