Skip to content

Commit dacb284

Browse files
authored
Merge pull request #62 from Daimanta/mapserver_8_crs_test
Added regression test for Mapserver 8
2 parents 453eed3 + fde867d commit dacb284

File tree

7 files changed

+237
-3
lines changed

7 files changed

+237
-3
lines changed

.github/workflows/regression-test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,27 @@ jobs:
151151
docker stop mapserver-rdnap-wfs
152152
153153
exit $exit_code
154+
- name: Regression test => Different CRS (RDNAPTRANS -> EPSG:4258)
155+
run: |
156+
# start mapserver
157+
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
158+
159+
# execute request
160+
mkdir -p `pwd`/testdata/crs/actual
161+
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
162+
163+
# assert results are as expected
164+
exit_code=0
165+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.crs.properties.name') == "urn:ogc:def:crs:EPSG::4258" ] || exit_code=1;
166+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[0]' | xargs -I '{}' echo "scale=5;" "({}-4.3646379084)/1 == 0" | bc) ] || exit_code=1;
167+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[1]' | xargs -I '{}' echo "scale=5;" "({}-51.3620482342678)/1 == 0" | bc) ] || exit_code=1;
168+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[2]' | xargs -I '{}' echo "scale=5;" "({}-4.46528581228022)/1 == 0" | bc) ] || exit_code=1;
169+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[3]' | xargs -I '{}' echo "scale=5;" "({}-51.4268875774673)/1 == 0" | bc) ] || exit_code=1;
170+
171+
# cleanup
172+
rm -rf `pwd`/testdata/crs/actual
173+
174+
# stop mapserver
175+
docker stop mapserver-crs
176+
177+
exit $exit_code

config/lighttpd.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
server.modules += ( "mod_setenv" )
2+
server.modules += ( "mod_indexfile" )
23
server.modules += ( "mod_fastcgi" )
34
server.modules += ( "mod_rewrite" )
45
server.modules += ( "mod_magnet" )
5-
server.modules += ( "mod_indexfile" )
66

77
index-file.names = ( "index.html" )
88
server.document-root = "/var/www/"

testdata/ETRS89andRDNAP/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
This is to test if RDNAPTRANS transformations are used properly.
44
The test source data originates from NSGI.
55

6-
TODO automate this test in the build
7-
86
## Run mapserver
97

108
### existing 7.6.4-patch5-2-buster-lighttpd

testdata/crs/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# ERTS89andRDNAP test
2+
3+
This tests projecting WFS features in different coordinate systems, in particular:
4+
- EPSG:3034
5+
- EPSG:3035
6+
- EPSG:4258
7+
- EPSG:4326
8+
- CRS:84
9+
10+
This dataset has only 1 feature to have a reduced size in the Git repository.
11+
12+
## Run mapserver
13+
14+
### existing 7.6.4-patch5-2-buster-lighttpd
15+
16+
```docker
17+
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
18+
19+
```
20+
21+
The server then can be contact at `http://localhost:80/mapserver?request=GetCapabilities&service=WFS`
22+
23+
### local built 8
24+
25+
Warning: This docker build compiles dependencies and will take a long time when running for the first time
26+
```docker
27+
docker build --target NL -t pdok/mapserver:8-local-NL .
28+
```
29+
30+
Serving Nationale Parken source
31+
32+
```docker
33+
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
34+
```
35+
36+
The server then can be contact at `http://localhost:80/mapserver?request=GetCapabilities&service=WFS`
37+
38+
## Verify the output
39+
40+
41+
```shell
42+
exit_code=0
43+
mkdir -p `pwd`/testdata/crs/actual/;
44+
IMAGE=pdok/mapserver:8-local-NL && \
45+
SOURCE_NAME=natpark && \
46+
OUT_NAME=etrs89 && \
47+
OUT_EPSG=4258 && \
48+
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 \
49+
"${IMAGE}" \
50+
-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;
51+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.crs.properties.name') == "urn:ogc:def:crs:EPSG::4258" ] || exit_code=1;
52+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[0]' | xargs -I '{}' echo "scale=5;" "({}-4.3646379084)/1 == 0" | bc) ] || exit_code=1;
53+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[1]' | xargs -I '{}' echo "scale=5;" "({}-51.3620482342678)/1 == 0" | bc) ] || exit_code=1;
54+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[2]' | xargs -I '{}' echo "scale=5;" "({}-4.46528581228022)/1 == 0" | bc) ] || exit_code=1;
55+
[ $(cat `pwd`/testdata/crs/actual/output.json | jq -r '.bbox[3]' | xargs -I '{}' echo "scale=5;" "({}-51.4268875774673)/1 == 0" | bc) ] || exit_code=1;
56+
echo $exit_code
57+
```

testdata/crs/natpark.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CONFIG
2+
ENV
3+
MS_MAP_NO_PATH "true"
4+
END
5+
MAPS
6+
MAP "/srv/data/natpark.map"
7+
END
8+
9+
END

testdata/crs/natpark.gpkg

96 KB
Binary file not shown.

testdata/crs/natpark.map

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
MAP
2+
NAME "" # empty so ETF geonovum test doesn't try to test it
3+
CONFIG "MS_ERRORFILE" "stderr"
4+
EXTENT -25000 250000 280000 860000
5+
UNITS meters
6+
STATUS ON
7+
SIZE 1 1 # filler value, to prevent mapserver complaining in logs no width or height are set
8+
#DEBUG 5
9+
PROJECTION
10+
"init=epsg:28992"
11+
END
12+
13+
WEB
14+
METADATA
15+
"ows_enable_request" "*"
16+
"ows_fees" "NONE"
17+
"ows_contactorganization" "PDOK"
18+
"ows_schemas_location" "http://schemas.opengis.net"
19+
"ows_service_onlineresource" "https://service.pdok.nl/"
20+
"ows_contactperson" "KlantContactCenter PDOK"
21+
"ows_contactposition" "pointOfContact"
22+
"ows_contactvoicetelephone" ""
23+
"ows_contactfacsimiletelephone" ""
24+
"ows_addresstype" "Work"
25+
"ows_address" ""
26+
"ows_city" "Apeldoorn"
27+
"ows_stateorprovince" ""
28+
"ows_postcode" ""
29+
"ows_country" "Nederland"
30+
"ows_contactelectronicmailaddress" "BeheerPDOK@kadaster.nl"
31+
"ows_hoursofservice" ""
32+
"ows_contactinstructions" "https://www.pdok.nl/contact"
33+
"ows_role" ""
34+
"ows_srs" "EPSG:28992 EPSG:25831 EPSG:25832 EPSG:3034 EPSG:3035 EPSG:3857 EPSG:4258 EPSG:4326"
35+
"ows_accessconstraints" "otherRestrictions;http://creativecommons.org/publicdomain/mark/1.0/deed.nl;Geen beperkingen"
36+
END
37+
END
38+
39+
OUTPUTFORMAT
40+
NAME "GEOJSON" # format name (visible as format in the 1.0.0 capabilities)
41+
DRIVER "OGR/GEOJSON"
42+
MIMETYPE "application/json; subtype=geojson"
43+
FORMATOPTION "STORAGE=stream"
44+
FORMATOPTION "FORM=SIMPLE"
45+
FORMATOPTION "USE_FEATUREID=true"
46+
FORMATOPTION "LCO:ID_FIELD=fuuid"
47+
FORMATOPTION "LCO:ID_TYPE=STRING"
48+
FORMATOPTION "LCO:WRITE_BBOX=YES"
49+
END
50+
51+
OUTPUTFORMAT
52+
NAME "JSON"
53+
DRIVER "OGR/GEOJSON"
54+
MIMETYPE "application/json"
55+
FORMATOPTION "STORAGE=stream"
56+
FORMATOPTION "FORM=SIMPLE"
57+
FORMATOPTION "USE_FEATUREID=true"
58+
FORMATOPTION "LCO:ID_FIELD=fuuid"
59+
FORMATOPTION "LCO:ID_TYPE=STRING"
60+
FORMATOPTION "LCO:WRITE_BBOX=YES"
61+
END
62+
63+
OUTPUTFORMAT
64+
NAME "XML"
65+
DRIVER "OGR/GML"
66+
MIMETYPE "text/xml"
67+
FORMATOPTION "STORAGE=stream"
68+
FORMATOPTION "FORM=SIMPLE"
69+
FORMATOPTION "USE_FEATUREID=true"
70+
END
71+
72+
OUTPUTFORMAT
73+
NAME "GML3"
74+
DRIVER "OGR/GML"
75+
MIMETYPE "text/xml; subtype=gml/3.1.1"
76+
FORMATOPTION "STORAGE=stream"
77+
FORMATOPTION "FORM=SIMPLE"
78+
FORMATOPTION "USE_FEATUREID=true"
79+
END
80+
81+
WEB
82+
METADATA
83+
"ows_title" "Nationale parken WFS"
84+
"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."
85+
"ows_keywordlist" "Protected sites,Beschermde gebieden,HVD,Aardobservatie en milieu,infoFeatureAccessService"
86+
"wfs_languages" "eng" #first default, values according ISO 639-2/B
87+
"wfs_extent" "-25000 250000 280000 860000"
88+
"wfs_namespace_prefix" "nationaleparken"
89+
"wfs_namespace_uri" "http://nationaleparken.geonovum.nl"
90+
"wfs_onlineresource" "https://service.pdok.nl/rvo/nationaleparken/wfs/v2_0"
91+
"wfs_getfeature_formatlist" "GEOJSON,JSON,XML,GML3" # List of earlier defined outputformat names
92+
"wfs_maxfeatures" "1000"
93+
"wfs_maxfeatures_ignore_for_resulttype_hits" "true"
94+
"wfs_storedqueries" "urn:x-inspire:storedQuery:nationaleparken:FullDataset"
95+
"wfs_urn:x-inspire:storedQuery:nationaleparken:FullDataset_filedef" "/srv/data/config/storedquery_fulldataset.xml"
96+
"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"
97+
"wfs_inspire_metadataurl_format" "application/vnd.ogc.csw.GetRecordByIdResponse_xml"
98+
"wfs_inspire_capabilities" "url"
99+
"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"
100+
END
101+
END
102+
103+
LAYER
104+
STATUS ON
105+
NAME "nationaleparken"
106+
CONNECTIONTYPE OGR
107+
CONNECTION "/srv/data/natpark.gpkg"
108+
DATA "natpark"
109+
TYPE POLYGON
110+
PROJECTION
111+
"init=epsg:28992" # Define the source projection to enable reprojection
112+
END
113+
TEMPLATE void
114+
METADATA
115+
"wfs_title" "Nationale Parken"
116+
"wfs_abstract" "Nationaleparken Beschermde gebieden"
117+
"wfs_keywordlist" "Beschermde gebieden"
118+
"wfs_srs" "EPSG:28992 EPSG:25831 EPSG:25832 EPSG:3034 EPSG:3035 EPSG:3857 EPSG:4258 EPSG:4326"
119+
"wfs_extent" "-25000 250000 280000 860000" #DEFAULT !!! belangrijk, anders is performance slecht
120+
"wfs_include_items" "all" # required for getfeatureinfo
121+
"wfs_bbox_extended" "true"
122+
"wfs_enable_request" "*"
123+
"wfs_featureid" "puuid"
124+
"wfs_geomtype" "MultiPolygon"
125+
"wfs_use_default_extent_for_getfeature" "false"
126+
"gml_include_items" "fuuid,objectid,naam,instrument,nr,datum,bron,fiat_secr,hectares" # required for getfeatureinfo
127+
"gml_fuuid_alias" "fuuid"
128+
"gml_objectid_alias" "objectid"
129+
"gml_naam_alias" "naam"
130+
"gml_instrument_alias" "instrument"
131+
"gml_nr_alias" "nr"
132+
"gml_datum_alias" "datum"
133+
"gml_bron_alias" "bron"
134+
"gml_fiat_secr_alias" "fiatSecr"
135+
"gml_hectares_alias" "hectares"
136+
"gml_featureid" "puuid"
137+
"gml_exclude_items" "puuid"
138+
"gml_geometries" "geom"
139+
"gml_types" "auto"
140+
"ows_metadataurl_type" "TC211"
141+
"ows_metadataurl_format" "text/plain"
142+
"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"
143+
END
144+
145+
END # LAYER
146+
END # MAP

0 commit comments

Comments
 (0)