diff --git a/.github/workflows/regression-test.yml b/.github/workflows/regression-test.yml index 6cb9e2f..bb8fc53 100644 --- a/.github/workflows/regression-test.yml +++ b/.github/workflows/regression-test.yml @@ -151,3 +151,27 @@ jobs: docker stop mapserver-rdnap-wfs exit $exit_code + - name: Regression test => Different CRS (RDNAPTRANS -> EPSG:4258) + run: | + # start mapserver + docker run --rm -d -p 8181:80 --name mapserver-crs -v `pwd`/testdata/crs:/srv/data -e MAPSERVER_CONFIG_FILE=/srv/data/natpark.conf -e SERVICE_TYPE=wfs -e MS_MAPFILE=/srv/data/natpark.map pdok/mapserver:local-nl + + # execute request + mkdir -p `pwd`/testdata/crs/actual + curl "http://localhost:8181/mapserver?service=WFS&request=GetFeature&count=1&version=2.0.0&outputFormat=application/json&typeName=nationaleparken&srsName=EPSG:4258" -sL > `pwd`/testdata/crs/actual/output.json + + # assert results are as expected + exit_code=0 + [ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.crs.properties.name') == "urn:ogc:def:crs:EPSG::4258" ] || exit_code=1; + [ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[0]' | xargs -I '{}' echo "scale=5;" "({}-4.3646379084)/1 == 0" | bc) ] || exit_code=1; + [ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[1]' | xargs -I '{}' echo "scale=5;" "({}-51.3620482342678)/1 == 0" | bc) ] || exit_code=1; + [ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[2]' | xargs -I '{}' echo "scale=5;" "({}-4.46528581228022)/1 == 0" | bc) ] || exit_code=1; + [ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[3]' | xargs -I '{}' echo "scale=5;" "({}-51.4268875774673)/1 == 0" | bc) ] || exit_code=1; + + # cleanup + rm -rf `pwd`/testdata/crs/actual + + # stop mapserver + docker stop mapserver-crs + + exit $exit_code \ No newline at end of file diff --git a/config/lighttpd.conf b/config/lighttpd.conf index e40710e..3f4cad4 100644 --- a/config/lighttpd.conf +++ b/config/lighttpd.conf @@ -1,8 +1,8 @@ server.modules += ( "mod_setenv" ) +server.modules += ( "mod_indexfile" ) server.modules += ( "mod_fastcgi" ) server.modules += ( "mod_rewrite" ) server.modules += ( "mod_magnet" ) -server.modules += ( "mod_indexfile" ) index-file.names = ( "index.html" ) server.document-root = "/var/www/" diff --git a/testdata/ETRS89andRDNAP/README.md b/testdata/ETRS89andRDNAP/README.md index 5ec2425..16ab29e 100644 --- a/testdata/ETRS89andRDNAP/README.md +++ b/testdata/ETRS89andRDNAP/README.md @@ -3,8 +3,6 @@ This is to test if RDNAPTRANS transformations are used properly. The test source data originates from NSGI. -TODO automate this test in the build - ## Run mapserver ### existing 7.6.4-patch5-2-buster-lighttpd diff --git a/testdata/crs/README.md b/testdata/crs/README.md new file mode 100644 index 0000000..6eb5113 --- /dev/null +++ b/testdata/crs/README.md @@ -0,0 +1,57 @@ +# ERTS89andRDNAP test + +This tests projecting WFS features in different coordinate systems, in particular: +- EPSG:3034 +- EPSG:3035 +- EPSG:4258 +- EPSG:4326 +- CRS:84 + +This dataset has only 1 feature to have a reduced size in the Git repository. + +## Run mapserver + +### existing 7.6.4-patch5-2-buster-lighttpd + +```docker +docker run --rm -p 80:80 -v `pwd`/testdata/crs:/srv/data -e MAPSERVER_CONFIG_FILE=/srv/data/natpark.conf -e SERVICE_TYPE=wfs -e MS_MAPFILE=/srv/data/natpark.map pdok/mapserver:7.6.4-patch5-2-buster-lighttpd + +``` + +The server then can be contact at `http://localhost:80/mapserver?request=GetCapabilities&service=WFS` + +### local built 8 + +Warning: This docker build compiles dependencies and will take a long time when running for the first time +```docker +docker build --target NL -t pdok/mapserver:8-local-NL . +``` + +Serving Nationale Parken source + +```docker +docker run --rm -p 80:80 -v `pwd`/testdata/crs:/srv/data -e MAPSERVER_CONFIG_FILE=/srv/data/natpark.conf -e SERVICE_TYPE=wfs -e MS_MAPFILE=/srv/data/natpark.map pdok/mapserver:8-local-NL +``` + +The server then can be contact at `http://localhost:80/mapserver?request=GetCapabilities&service=WFS` + +## Verify the output + + +```shell +exit_code=0 +mkdir -p `pwd`/testdata/crs/actual/; +IMAGE=pdok/mapserver:8-local-NL && \ +SOURCE_NAME=natpark && \ +OUT_NAME=etrs89 && \ +OUT_EPSG=4258 && \ +docker run --rm -p 80:80 -v `pwd`/testdata/crs:/srv/data -e MAPSERVER_CONFIG_FILE=/srv/data/natpark.conf -e SERVICE_TYPE=wfs -e MS_MAPFILE=/srv/data/natpark.map --entrypoint=mapserv \ + "${IMAGE}" \ + -nh "QUERY_STRING=service=WFS&request=GetFeature&count=1&version=2.0.0&outputFormat=application/json&typeName=nationaleparken&srsName=EPSG:${OUT_EPSG}" > `pwd`/testdata/crs/actual/output.json; +[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.crs.properties.name') == "urn:ogc:def:crs:EPSG::4258" ] || exit_code=1; +[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[0]' | xargs -I '{}' echo "scale=5;" "({}-4.3646379084)/1 == 0" | bc) ] || exit_code=1; +[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[1]' | xargs -I '{}' echo "scale=5;" "({}-51.3620482342678)/1 == 0" | bc) ] || exit_code=1; +[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[2]' | xargs -I '{}' echo "scale=5;" "({}-4.46528581228022)/1 == 0" | bc) ] || exit_code=1; +[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[3]' | xargs -I '{}' echo "scale=5;" "({}-51.4268875774673)/1 == 0" | bc) ] || exit_code=1; +echo $exit_code +``` diff --git a/testdata/crs/natpark.conf b/testdata/crs/natpark.conf new file mode 100644 index 0000000..d0b4f62 --- /dev/null +++ b/testdata/crs/natpark.conf @@ -0,0 +1,9 @@ +CONFIG + ENV + MS_MAP_NO_PATH "true" + END + MAPS + MAP "/srv/data/natpark.map" + END + +END \ No newline at end of file diff --git a/testdata/crs/natpark.gpkg b/testdata/crs/natpark.gpkg new file mode 100644 index 0000000..1afe07d Binary files /dev/null and b/testdata/crs/natpark.gpkg differ diff --git a/testdata/crs/natpark.map b/testdata/crs/natpark.map new file mode 100644 index 0000000..a2626d7 --- /dev/null +++ b/testdata/crs/natpark.map @@ -0,0 +1,146 @@ +MAP +NAME "" # empty so ETF geonovum test doesn't try to test it +CONFIG "MS_ERRORFILE" "stderr" +EXTENT -25000 250000 280000 860000 +UNITS meters +STATUS ON +SIZE 1 1 # filler value, to prevent mapserver complaining in logs no width or height are set +#DEBUG 5 +PROJECTION +"init=epsg:28992" +END + +WEB +METADATA +"ows_enable_request" "*" +"ows_fees" "NONE" +"ows_contactorganization" "PDOK" +"ows_schemas_location" "http://schemas.opengis.net" +"ows_service_onlineresource" "https://service.pdok.nl/" +"ows_contactperson" "KlantContactCenter PDOK" +"ows_contactposition" "pointOfContact" +"ows_contactvoicetelephone" "" +"ows_contactfacsimiletelephone" "" +"ows_addresstype" "Work" +"ows_address" "" +"ows_city" "Apeldoorn" +"ows_stateorprovince" "" +"ows_postcode" "" +"ows_country" "Nederland" +"ows_contactelectronicmailaddress" "BeheerPDOK@kadaster.nl" +"ows_hoursofservice" "" +"ows_contactinstructions" "https://www.pdok.nl/contact" +"ows_role" "" +"ows_srs" "EPSG:28992 EPSG:25831 EPSG:25832 EPSG:3034 EPSG:3035 EPSG:3857 EPSG:4258 EPSG:4326" +"ows_accessconstraints" "otherRestrictions;http://creativecommons.org/publicdomain/mark/1.0/deed.nl;Geen beperkingen" +END +END + +OUTPUTFORMAT +NAME "GEOJSON" # format name (visible as format in the 1.0.0 capabilities) +DRIVER "OGR/GEOJSON" +MIMETYPE "application/json; subtype=geojson" +FORMATOPTION "STORAGE=stream" +FORMATOPTION "FORM=SIMPLE" +FORMATOPTION "USE_FEATUREID=true" +FORMATOPTION "LCO:ID_FIELD=fuuid" +FORMATOPTION "LCO:ID_TYPE=STRING" +FORMATOPTION "LCO:WRITE_BBOX=YES" +END + +OUTPUTFORMAT +NAME "JSON" +DRIVER "OGR/GEOJSON" +MIMETYPE "application/json" +FORMATOPTION "STORAGE=stream" +FORMATOPTION "FORM=SIMPLE" +FORMATOPTION "USE_FEATUREID=true" +FORMATOPTION "LCO:ID_FIELD=fuuid" +FORMATOPTION "LCO:ID_TYPE=STRING" +FORMATOPTION "LCO:WRITE_BBOX=YES" +END + +OUTPUTFORMAT +NAME "XML" +DRIVER "OGR/GML" +MIMETYPE "text/xml" +FORMATOPTION "STORAGE=stream" +FORMATOPTION "FORM=SIMPLE" +FORMATOPTION "USE_FEATUREID=true" +END + +OUTPUTFORMAT +NAME "GML3" +DRIVER "OGR/GML" +MIMETYPE "text/xml; subtype=gml/3.1.1" +FORMATOPTION "STORAGE=stream" +FORMATOPTION "FORM=SIMPLE" +FORMATOPTION "USE_FEATUREID=true" +END + +WEB +METADATA +"ows_title" "Nationale parken WFS" +"ows_abstract" "Dit bestand geeft de grenzen van de Nationale Parken weer, zoals die door de Secretarissen van de Parken zijn aangegeven in de periode augustus 2005 - november 2005, met een update in januari 2007 en in augustus 2007. Op de grenzen van NP Drents-Friese Wold volgt nog een correctie. Het bestand bevat in totaal 21 Nationale Parken: 18 door de Minister van LNV vastgestelde Parken (waarvan 1 in oprichting), 2 Particuliere Parken en 1 grensoverschrijdend Park, vastgesteld door het Commité van Ministers van de Benelux. Daarnaast komen in het GIS-bestand "uitwerkingsgebieden" voor. Dit zijn gebieden die bij voorkeur op termijn onderdeel moeten gaan uitmaken van een Nationaal Park, maar nu nog niet zijn aangewezen. Ze maken dan ook GEEN deel uit van het betreffende Park en hebben geen enkele status! De grenzen in het GIS-bestand kunnen afwijken van de grenzen in het BIP (Beheers- en Inrichtingsplan). Elk Nationaal Park heeft een BIP, dat ter goedkeuring wordt voorgelegd aan de Minister van LNV. Elk BIP bevat een kaart met de begrenzing van het Park. Die grens is een momentopname. In de loop der tijd kunnen de grenzen van een Park licht wijzigen door kleine aankopen of uitruil van gronden. Die wijzigingen worden bij periodieke updates doorgevoerd in het BIP. Een BIP kan daardoor achter- of juist vooruitlopen op de grenzen in dit bestand." +"ows_keywordlist" "Protected sites,Beschermde gebieden,HVD,Aardobservatie en milieu,infoFeatureAccessService" +"wfs_languages" "eng" #first default, values according ISO 639-2/B +"wfs_extent" "-25000 250000 280000 860000" +"wfs_namespace_prefix" "nationaleparken" +"wfs_namespace_uri" "http://nationaleparken.geonovum.nl" +"wfs_onlineresource" "https://service.pdok.nl/rvo/nationaleparken/wfs/v2_0" +"wfs_getfeature_formatlist" "GEOJSON,JSON,XML,GML3" # List of earlier defined outputformat names +"wfs_maxfeatures" "1000" +"wfs_maxfeatures_ignore_for_resulttype_hits" "true" +"wfs_storedqueries" "urn:x-inspire:storedQuery:nationaleparken:FullDataset" +"wfs_urn:x-inspire:storedQuery:nationaleparken:FullDataset_filedef" "/srv/data/config/storedquery_fulldataset.xml" +"wfs_inspire_metadataurl_href" "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=b87a0095-2ad7-4dbb-81a1-fed060df79e1" +"wfs_inspire_metadataurl_format" "application/vnd.ogc.csw.GetRecordByIdResponse_xml" +"wfs_inspire_capabilities" "url" +"wfs_inspire_dsid_code" "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=#MD_DataIdentification" +END +END + +LAYER +STATUS ON +NAME "nationaleparken" +CONNECTIONTYPE OGR +CONNECTION "/srv/data/natpark.gpkg" +DATA "natpark" +TYPE POLYGON +PROJECTION +"init=epsg:28992" # Define the source projection to enable reprojection +END +TEMPLATE void +METADATA +"wfs_title" "Nationale Parken" +"wfs_abstract" "Nationaleparken Beschermde gebieden" +"wfs_keywordlist" "Beschermde gebieden" +"wfs_srs" "EPSG:28992 EPSG:25831 EPSG:25832 EPSG:3034 EPSG:3035 EPSG:3857 EPSG:4258 EPSG:4326" +"wfs_extent" "-25000 250000 280000 860000" #DEFAULT !!! belangrijk, anders is performance slecht +"wfs_include_items" "all" # required for getfeatureinfo +"wfs_bbox_extended" "true" +"wfs_enable_request" "*" +"wfs_featureid" "puuid" +"wfs_geomtype" "MultiPolygon" +"wfs_use_default_extent_for_getfeature" "false" +"gml_include_items" "fuuid,objectid,naam,instrument,nr,datum,bron,fiat_secr,hectares" # required for getfeatureinfo +"gml_fuuid_alias" "fuuid" +"gml_objectid_alias" "objectid" +"gml_naam_alias" "naam" +"gml_instrument_alias" "instrument" +"gml_nr_alias" "nr" +"gml_datum_alias" "datum" +"gml_bron_alias" "bron" +"gml_fiat_secr_alias" "fiatSecr" +"gml_hectares_alias" "hectares" +"gml_featureid" "puuid" +"gml_exclude_items" "puuid" +"gml_geometries" "geom" +"gml_types" "auto" +"ows_metadataurl_type" "TC211" +"ows_metadataurl_format" "text/plain" +"ows_metadataurl_href" "https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=4961d305-fbb5-426a-9ba3-53e1ca5f3b18" +END + +END # LAYER +END # MAP \ No newline at end of file