Skip to content

Commit b959c34

Browse files
authored
Merge pull request #94 from rouault/fixes_nov_2020
Fix axis order issue on GetFeature 1.1, and add continuous integration
2 parents f1abcce + 2852676 commit b959c34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1426
-152
lines changed

.github/workflows/linux.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
apt-get update
6+
7+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
8+
gcc libxml2-dev libpq-dev libfcgi-dev \
9+
autoconf make flex libfl-dev \
10+
postgresql-12 postgresql-client postgis postgresql-12-postgis-3 postgresql-12-postgis-3-scripts \
11+
wget ca-certificates patch valgrind
12+
13+
cd "${WORK_DIR}"
14+
./autogen.sh
15+
CFLAGS="-Werror" ./configure
16+
make
17+
make install
18+
19+
cp /etc/postgresql/12/main/pg_hba.conf /etc/postgresql/12/main/pg_hba.conf.bak
20+
echo "local all postgres trust" | cat - /etc/postgresql/12/main/pg_hba.conf.bak > /etc/postgresql/12/main/pg_hba.conf
21+
echo "host all all 127.0.0.1/32 trust" | cat - /etc/postgresql/12/main/pg_hba.conf.bak > /etc/postgresql/12/main/pg_hba.conf
22+
/etc/init.d/postgresql start
23+
24+
make install-demo
25+
cp -f demo/tinyows_no_checkschema.xml /etc/tinyows.xml
26+
make check
27+
28+
# wget https://github.com/MapServer/tinyows/commit/633ca487113d032e261a4a5c8b5f3b7850580f4f.patch
29+
# patch -p1 -R < 633ca487113d032e261a4a5c8b5f3b7850580f4f.patch
30+
31+
# rm -f /etc/tinyows.xml
32+
# make install-test100
33+
34+
# rm -f /etc/tinyows.xml
35+
# make install-test110

.github/workflows/linux.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Linux build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
linux_build:
8+
runs-on: ubuntu-latest
9+
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Build
15+
run: docker run --rm -e WORK_DIR=$PWD -v $PWD:$PWD ubuntu:20.04 $PWD/.github/workflows/linux.sh

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Makefile
2+
configure
3+
demo/install.sh
4+
demo/tinyows.xml
5+
src/ows_define.h
6+
test/wfs_100/config_wfs_100.xml
7+
test/wfs_100/install_wfs_100.sh
8+
test/wfs_110/config_wfs_110.xml
9+
test/wfs_110/install_wfs_110.sh
10+
tinyows

Makefile.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ install-demo:
5858
@demo/install.sh
5959
cp -i demo/tinyows.xml /etc/tinyows.xml
6060

61+
check:
62+
@demo/check.sh
63+
6164
install-test100:
6265
@chmod +x test/wfs_100/install_wfs_100.sh
6366
@test/wfs_100/install_wfs_100.sh

autogen.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
#
3+
# Autotools boostrapping script
4+
#
5+
giveup()
6+
{
7+
echo
8+
echo " Something went wrong, giving up!"
9+
echo
10+
exit 1
11+
}
12+
13+
echo "Running autoconf"
14+
autoconf || giveup
15+
16+
echo "======================================"
17+
echo "Now you are ready to run './configure'"
18+
echo "======================================"

demo/check.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/sh
2+
3+
set -eu
4+
5+
RET=0
6+
7+
PGUSER=postgres
8+
DB=tinyows_demo
9+
10+
for i in demo/tests/input/*; do
11+
echo "Running $i"
12+
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt
13+
if ! diff -u /tmp/output.txt demo/tests/expected/$(basename $i); then
14+
mkdir -p demo/tests/got
15+
mv /tmp/output.txt demo/tests/got/$(basename $i)
16+
echo "Result got put in demo/tests/got/$(basename $i)"
17+
RET=1
18+
fi
19+
done
20+
21+
if test "$RET" -eq "0"; then
22+
echo "Tests OK !"
23+
else
24+
echo "Tests failed !"
25+
exit $RET
26+
fi
27+
28+
i=demo/tests/transactions/input/wfst10_france_insert.xml
29+
echo "Running $i"
30+
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
31+
cat /tmp/output.txt | grep SUCCESS || (cat /tmp/output.txt && /bin/false)
32+
echo "select st_astext(geom) from france where id_geofla = -1234;" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2171610 802820,2171611 802820,2171611 802821,2171610 802820)))"
33+
echo "delete from france where id_geofla = -1234" | su $PGUSER -c "psql $DB"
34+
35+
36+
i=demo/tests/transactions/input/wfst10_world_insert.xml
37+
echo "Running $i"
38+
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
39+
cat /tmp/output.txt | grep SUCCESS || (cat /tmp/output.txt && /bin/false)
40+
echo "select st_astext(geom) from world where name = '-1234';" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2 49,2 50,3 50,2 49)))"
41+
echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB"
42+
43+
44+
i=demo/tests/transactions/input/wfst11_france_insert.xml
45+
echo "Running $i"
46+
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
47+
cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false)
48+
echo "select st_astext(geom) from france where id_geofla = -1234;" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2171610 802820,2171611 802820,2171611 802821,2171610 802820)))"
49+
echo "delete from france where id_geofla = -1234" | su $PGUSER -c "psql $DB"
50+
51+
52+
i=demo/tests/transactions/input/wfst11_world_insert.xml
53+
echo "Running $i"
54+
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
55+
cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false)
56+
echo "select st_astext(geom) from world where name = '-1234';" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2 49,2 50,3 50,2 49)))"
57+
echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB"
58+
59+
60+
i=demo/tests/transactions/input/wfst11_world_insert_srsname_in_wfsinsert.xml
61+
echo "Running $i"
62+
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
63+
cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false)
64+
echo "select st_astext(geom) from world where name = '-1234';" | su $PGUSER -c "psql -t $DB" | grep "MULTIPOLYGON(((2 49,2 50,3 50,2 49)))"
65+
echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB"

demo/install.sh.in

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,25 @@
33
# don't launch directly this script
44
# use 'make install-demo' to do so
55

6+
set -e
7+
68
PGBIN=@POSTGIS_BIN@
79
PGSHARE=@POSTGIS_SHARE@/contrib/postgis-1.5
810
PGUSER=postgres
911
SHP2PGSQL=@SHP2PGSQL@
1012
DB=tinyows_demo
1113

12-
if [ -d @POSTGIS_SHARE@/contrib/postgis-2.1 ]; then
14+
if [ -d @POSTGIS_SHARE@/contrib/postgis-3.0 ]; then
15+
PGSHARE=@POSTGIS_SHARE@/contrib/postgis-3.0
16+
elif [ -d @POSTGIS_SHARE@/contrib/postgis-2.5 ]; then
17+
PGSHARE=@POSTGIS_SHARE@/contrib/postgis-2.5
18+
elif [ -d @POSTGIS_SHARE@/contrib/postgis-2.4 ]; then
19+
PGSHARE=@POSTGIS_SHARE@/contrib/postgis-2.4
20+
elif [ -d @POSTGIS_SHARE@/contrib/postgis-2.3 ]; then
21+
PGSHARE=@POSTGIS_SHARE@/contrib/postgis-2.3
22+
elif [ -d @POSTGIS_SHARE@/contrib/postgis-2.2 ]; then
23+
PGSHARE=@POSTGIS_SHARE@/contrib/postgis-2.2
24+
elif [ -d @POSTGIS_SHARE@/contrib/postgis-2.1 ]; then
1325
PGSHARE=@POSTGIS_SHARE@/contrib/postgis-2.1
1426
elif [ -d @POSTGIS_SHARE@/contrib/postgis-2.0 ]; then
1527
PGSHARE=@POSTGIS_SHARE@/contrib/postgis-2.0
@@ -20,9 +32,11 @@ else
2032
fi
2133

2234
echo "Create Spatial Database: $DB"
23-
su $PGUSER -c "$PGBIN/dropdb $DB > /dev/null 2> /dev/null"
35+
su $PGUSER -c "$PGBIN/dropdb $DB > /dev/null 2> /dev/null || /bin/true"
2436
su $PGUSER -c "$PGBIN/createdb $DB"
25-
su $PGUSER -c "$PGBIN/createlang plpgsql $DB"
37+
if test -f "$PGBIN/createlang"; then
38+
su $PGUSER -c "$PGBIN/createlang plpgsql $DB"
39+
fi
2640
su $PGUSER -c "$PGBIN/psql $DB < $PGSHARE/postgis.sql"
2741
su $PGUSER -c "$PGBIN/psql $DB < $PGSHARE/spatial_ref_sys.sql"
2842

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Content-Type: text/xml; subtype=gml/2.1.2;
2+
3+
<?xml version='1.0' encoding='UTF-8'?>
4+
<xs:schema targetNamespace='http://www.tinyows.org/' xmlns:tows='http://www.tinyows.org/' xmlns:ogc='http://www.opengis.net/ogc' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:gml='http://www.opengis.net/gml' elementFormDefault='qualified' version='1.0'>
5+
<xs:import namespace='http://www.opengis.net/gml' schemaLocation='http://schemas.opengis.net/gml/2.1.2/feature.xsd'/>
6+
<xs:element name='world' type='tows:worldType' substitutionGroup='gml:_Feature' />
7+
<xs:complexType name='worldType'>
8+
<xs:complexContent>
9+
<xs:extension base='gml:AbstractFeatureType'>
10+
<xs:sequence>
11+
<xs:element name ='name' nillable='true' minOccurs='0' maxOccurs='1'>
12+
<xs:simpleType><xs:restriction base='string'><xs:maxLength value='40'/></xs:restriction></xs:simpleType></xs:element> <xs:element name ='gmi_cntry' nillable='true' minOccurs='0' maxOccurs='1'>
13+
<xs:simpleType><xs:restriction base='string'><xs:maxLength value='3'/></xs:restriction></xs:simpleType></xs:element> <xs:element name ='region' nillable='true' minOccurs='0' maxOccurs='1'>
14+
<xs:simpleType><xs:restriction base='string'><xs:maxLength value='25'/></xs:restriction></xs:simpleType></xs:element> <xs:element name ='geom' type='gml:MultiPolygonPropertyType' nillable='true' minOccurs='0' maxOccurs='1'/>
15+
</xs:sequence>
16+
</xs:extension>
17+
</xs:complexContent>
18+
</xs:complexType>
19+
<xs:element name='france' type='tows:franceType' substitutionGroup='gml:_Feature' />
20+
<xs:complexType name='franceType'>
21+
<xs:complexContent>
22+
<xs:extension base='gml:AbstractFeatureType'>
23+
<xs:sequence>
24+
<xs:element name ='id_geofla' type='long' nillable='true' minOccurs='0' maxOccurs='1'/>
25+
<xs:element name ='code_chf_l' nillable='true' minOccurs='0' maxOccurs='1'>
26+
<xs:simpleType><xs:restriction base='string'><xs:maxLength value='3'/></xs:restriction></xs:simpleType></xs:element> <xs:element name ='nom_chf_l' nillable='true' minOccurs='0' maxOccurs='1'>
27+
<xs:simpleType><xs:restriction base='string'><xs:maxLength value='50'/></xs:restriction></xs:simpleType></xs:element> <xs:element name ='x_chf_lieu' type='int' nillable='true' minOccurs='0' maxOccurs='1'/>
28+
<xs:element name ='y_chf_lieu' type='int' nillable='true' minOccurs='0' maxOccurs='1'/>
29+
<xs:element name ='x_centroid' type='int' nillable='true' minOccurs='0' maxOccurs='1'/>
30+
<xs:element name ='y_centroid' type='int' nillable='true' minOccurs='0' maxOccurs='1'/>
31+
<xs:element name ='nom_dept' nillable='true' minOccurs='0' maxOccurs='1'>
32+
<xs:simpleType><xs:restriction base='string'><xs:maxLength value='30'/></xs:restriction></xs:simpleType></xs:element> <xs:element name ='code_reg' nillable='true' minOccurs='0' maxOccurs='1'>
33+
<xs:simpleType><xs:restriction base='string'><xs:maxLength value='2'/></xs:restriction></xs:simpleType></xs:element> <xs:element name ='nom_region' nillable='true' minOccurs='0' maxOccurs='1'>
34+
<xs:simpleType><xs:restriction base='string'><xs:maxLength value='30'/></xs:restriction></xs:simpleType></xs:element> <xs:element name ='code_dept' nillable='true' minOccurs='0' maxOccurs='1'>
35+
<xs:simpleType><xs:restriction base='string'><xs:maxLength value='3'/></xs:restriction></xs:simpleType></xs:element> <xs:element name ='geom' type='gml:MultiPolygonPropertyType' nillable='true' minOccurs='0' maxOccurs='1'/>
36+
</xs:sequence>
37+
</xs:extension>
38+
</xs:complexContent>
39+
</xs:complexType>
40+
</xs:schema>
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
Content-Type: application/xml
2+
3+
<?xml version='1.0' encoding='UTF-8'?>
4+
<WFS_Capabilities
5+
version='1.0.0' updateSequence='0'
6+
xmlns='http://www.opengis.net/wfs'
7+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
8+
xmlns:ogc='http://www.opengis.net/ogc'
9+
xsi:schemaLocation='http://www.opengis.net/wfs
10+
http://schemas.opengis.net/wfs/1.0.0/WFS-capabilities.xsd' >
11+
<Service>
12+
<Name>TinyOWS Server</Name>
13+
<Title>TinyOWS Server - Demo Service</Title>
14+
<OnlineResource>http://127.0.0.1/cgi-bin/tinyows</OnlineResource>
15+
</Service>
16+
<Capability>
17+
<Request>
18+
<GetCapabilities>
19+
<DCPType>
20+
<HTTP>
21+
<Get onlineResource="http://127.0.0.1/cgi-bin/tinyows?"/>
22+
</HTTP>
23+
</DCPType>
24+
<DCPType>
25+
<HTTP>
26+
<Post onlineResource="http://127.0.0.1/cgi-bin/tinyows"/>
27+
</HTTP>
28+
</DCPType>
29+
</GetCapabilities>
30+
<DescribeFeatureType>
31+
<SchemaDescriptionLanguage>
32+
<XMLSCHEMA/>
33+
</SchemaDescriptionLanguage>
34+
<DCPType>
35+
<HTTP>
36+
<Get onlineResource="http://127.0.0.1/cgi-bin/tinyows?"/>
37+
</HTTP>
38+
</DCPType>
39+
<DCPType>
40+
<HTTP>
41+
<Post onlineResource="http://127.0.0.1/cgi-bin/tinyows"/>
42+
</HTTP>
43+
</DCPType>
44+
</DescribeFeatureType>
45+
<GetFeature>
46+
<ResultFormat>
47+
<GML2/>
48+
</ResultFormat>
49+
<DCPType>
50+
<HTTP>
51+
<Get onlineResource="http://127.0.0.1/cgi-bin/tinyows?"/>
52+
</HTTP>
53+
</DCPType>
54+
<DCPType>
55+
<HTTP>
56+
<Post onlineResource="http://127.0.0.1/cgi-bin/tinyows"/>
57+
</HTTP>
58+
</DCPType>
59+
</GetFeature>
60+
<Transaction>
61+
<DCPType>
62+
<HTTP>
63+
<Get onlineResource="http://127.0.0.1/cgi-bin/tinyows?"/>
64+
</HTTP>
65+
</DCPType>
66+
<DCPType>
67+
<HTTP>
68+
<Post onlineResource="http://127.0.0.1/cgi-bin/tinyows"/>
69+
</HTTP>
70+
</DCPType>
71+
</Transaction>
72+
</Request>
73+
</Capability>
74+
<FeatureTypeList>
75+
<Operations>
76+
<Query/>
77+
<Insert/>
78+
<Update/>
79+
<Delete/>
80+
</Operations>
81+
<FeatureType xmlns:tows="http://www.tinyows.org/">
82+
<Name>tows:world</Name>
83+
<Title>World Administrative Boundaries</Title>
84+
<SRS>EPSG:4326</SRS>
85+
<LatLongBoundingBox minx='-180.000183' miny='-90.000000' maxx='180.000000' maxy='83.623032' />
86+
</FeatureType>
87+
<FeatureType xmlns:tows="http://www.tinyows.org/">
88+
<Name>tows:france</Name>
89+
<Title>French Administrative Sub Boundaries (IGN - GeoFLA Departements)</Title>
90+
<SRS>EPSG:27582</SRS>
91+
<LatLongBoundingBox minx='-6.091001' miny='41.347435' maxx='10.812651' maxy='50.803540' />
92+
</FeatureType>
93+
</FeatureTypeList>
94+
<ogc:Filter_Capabilities>
95+
<ogc:Spatial_Capabilities>
96+
<ogc:Spatial_Operators>
97+
<ogc:Disjoint/>
98+
<ogc:Equals/>
99+
<ogc:DWithin/>
100+
<ogc:Beyond/>
101+
<ogc:Intersect/>
102+
<ogc:Touches/>
103+
<ogc:Crosses/>
104+
<ogc:Within/>
105+
<ogc:Contains/>
106+
<ogc:Overlaps/>
107+
<ogc:BBOX/>
108+
</ogc:Spatial_Operators>
109+
</ogc:Spatial_Capabilities>
110+
<ogc:Scalar_Capabilities>
111+
<ogc:Logical_Operators/>
112+
<ogc:Comparison_Operators>
113+
<ogc:Simple_Comparisons/>
114+
<ogc:Between/>
115+
<ogc:Like/>
116+
<ogc:NullCheck/>
117+
</ogc:Comparison_Operators>
118+
<ogc:Arithmetic_Operators>
119+
<ogc:Simple_Arithmetic/>
120+
<ogc:Functions>
121+
<ogc:Function_Names>
122+
<ogc:Function_Name nArgs='1'>abs</ogc:Function_Name>
123+
<ogc:Function_Name nArgs='1'>acos</ogc:Function_Name>
124+
<ogc:Function_Name nArgs='1'>asin</ogc:Function_Name>
125+
<ogc:Function_Name nArgs='1'>atan</ogc:Function_Name>
126+
<ogc:Function_Name nArgs='1'>avg</ogc:Function_Name>
127+
<ogc:Function_Name nArgs='1'>cbrt</ogc:Function_Name>
128+
<ogc:Function_Name nArgs='1'>ceil</ogc:Function_Name>
129+
<ogc:Function_Name nArgs='1'>ceiling</ogc:Function_Name>
130+
<ogc:Function_Name nArgs='1'>cos</ogc:Function_Name>
131+
<ogc:Function_Name nArgs='1'>cot</ogc:Function_Name>
132+
<ogc:Function_Name nArgs='1'>count</ogc:Function_Name>
133+
<ogc:Function_Name nArgs='1'>degrees</ogc:Function_Name>
134+
<ogc:Function_Name nArgs='1'>exp</ogc:Function_Name>
135+
<ogc:Function_Name nArgs='1'>floor</ogc:Function_Name>
136+
<ogc:Function_Name nArgs='1'>length</ogc:Function_Name>
137+
<ogc:Function_Name nArgs='1'>ln</ogc:Function_Name>
138+
<ogc:Function_Name nArgs='1'>log</ogc:Function_Name>
139+
<ogc:Function_Name nArgs='1'>min</ogc:Function_Name>
140+
<ogc:Function_Name nArgs='1'>max</ogc:Function_Name>
141+
<ogc:Function_Name nArgs='1'>radians</ogc:Function_Name>
142+
<ogc:Function_Name nArgs='1'>round</ogc:Function_Name>
143+
<ogc:Function_Name nArgs='1'>sin</ogc:Function_Name>
144+
<ogc:Function_Name nArgs='1'>sqrt</ogc:Function_Name>
145+
<ogc:Function_Name nArgs='1'>tan</ogc:Function_Name>
146+
<ogc:Function_Name nArgs='1'>trunc</ogc:Function_Name>
147+
</ogc:Function_Names>
148+
</ogc:Functions>
149+
</ogc:Arithmetic_Operators>
150+
</ogc:Scalar_Capabilities>
151+
</ogc:Filter_Capabilities>
152+
</WFS_Capabilities>

0 commit comments

Comments
 (0)