Skip to content

Commit 19b4a0b

Browse files
authored
Merge pull request #95 from rouault/geometry_less_tables
Add support for geometry less tables
2 parents f4e0a92 + 81ef81c commit 19b4a0b

19 files changed

+270
-154
lines changed

.github/workflows/linux.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ echo "local all postgres trust" | cat - /etc/postgresql/12/main/pg_hba.conf.bak
2121
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
2222
/etc/init.d/postgresql start
2323

24+
rm -f /etc/tinyows.xml
2425
make install-demo
2526
cp -f demo/tinyows_no_checkschema.xml /etc/tinyows.xml
2627
make check
@@ -32,4 +33,4 @@ make check
3233
# make install-test100
3334

3435
# rm -f /etc/tinyows.xml
35-
# make install-test110
36+
# make install-test110

demo/check.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,11 @@ QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt &&
6363
cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false)
6464
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)))"
6565
echo "delete from world where name = '-1234'" | su $PGUSER -c "psql $DB"
66+
67+
68+
i=demo/tests/transactions/input/wfst11_geometry_less_insert.xml
69+
echo "Running $i"
70+
QUERY_STRING="$(cat $i)" ./tinyows > /tmp/output.txt || (cat /tmp/output.txt && /bin/false)
71+
cat /tmp/output.txt | grep "<wfs:totalInserted>1</wfs:totalInserted>" || (cat /tmp/output.txt && /bin/false)
72+
echo "select textcol from geometry_less where intcol = -1234;" | su $PGUSER -c "psql -t $DB" | grep "minus 1234"
73+
echo "delete from geometry_less where intcol = -1234" | su $PGUSER -c "psql $DB"

demo/install.sh.in

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,9 @@ echo "Import layer data: france_dept"
4848
$SHP2PGSQL -s 27582 -I -W latin1 demo/france.shp france > _france.sql
4949
su $PGUSER -c "$PGBIN/psql $DB < _france.sql"
5050

51-
rm _world.sql _france.sql
51+
echo "Import non spatial layer"
52+
echo "CREATE TABLE geometry_less(id SERIAL PRIMARY KEY, intcol INTEGER, textcol TEXT);" > _geometry_less.sql
53+
echo "INSERT INTO geometry_less (intcol, textcol) VALUES (123, 'foo');" >> _geometry_less.sql
54+
su $PGUSER -c "$PGBIN/psql $DB < _geometry_less.sql"
55+
56+
rm _world.sql _france.sql _geometry_less.sql

demo/tests/expected/wfs10_describe.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,15 @@ Content-Type: text/xml; subtype=gml/2.1.2;
3737
</xs:extension>
3838
</xs:complexContent>
3939
</xs:complexType>
40+
<xs:element name='geometry_less' type='tows:geometry_lessType' substitutionGroup='gml:_Feature' />
41+
<xs:complexType name='geometry_lessType'>
42+
<xs:complexContent>
43+
<xs:extension base='gml:AbstractFeatureType'>
44+
<xs:sequence>
45+
<xs:element name ='intcol' type='int' nillable='true' minOccurs='0' maxOccurs='1'/>
46+
<xs:element name ='textcol' type='string' nillable='true' minOccurs='0' maxOccurs='1'/>
47+
</xs:sequence>
48+
</xs:extension>
49+
</xs:complexContent>
50+
</xs:complexType>
4051
</xs:schema>

demo/tests/expected/wfs10_getcaps.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ version='1.0.0' updateSequence='0'
8989
<Title>French Administrative Sub Boundaries (IGN - GeoFLA Departements)</Title>
9090
<SRS>EPSG:27582</SRS>
9191
<LatLongBoundingBox minx='-6.091001' miny='41.347435' maxx='10.812651' maxy='50.803540' />
92+
</FeatureType>
93+
<FeatureType xmlns:tows="http://www.tinyows.org/">
94+
<Name>tows:geometry_less</Name>
95+
<Title>Geometry less layer</Title>
96+
<SRS></SRS>
9297
</FeatureType>
9398
</FeatureTypeList>
9499
<ogc:Filter_Capabilities>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Content-Type: text/xml; subtype=gml/2.1.2
2+
3+
<?xml version='1.0' encoding='UTF-8'?>
4+
<wfs:FeatureCollection
5+
xmlns:tows='http://www.tinyows.org/'
6+
xmlns:wfs='http://www.opengis.net/wfs'
7+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
8+
xmlns:gml='http://www.opengis.net/gml'
9+
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
10+
xmlns:ogc='http://www.opengis.net/ogc'
11+
xmlns:xlink='http://www.w3.org/1999/xlink'
12+
xmlns:ows='http://www.opengis.net/ows'
13+
xsi:schemaLocation='http://www.tinyows.org/
14+
http://127.0.0.1/cgi-bin/tinyows?service=WFS&amp;version=1.0.0&amp;request=DescribeFeatureType&amp;Typename=tows:geometry_less http://www.opengis.net/wfs
15+
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
16+
http://www.opengis.net/gml
17+
http://schemas.opengis.net/gml/2.1.2/feature.xsd'
18+
>
19+
<gml:boundedBy><gml:null>missing</gml:null></gml:boundedBy>
20+
<gml:featureMember>
21+
<tows:geometry_less fid="geometry_less.1">
22+
<tows:intcol>123</tows:intcol>
23+
<tows:textcol>foo</tows:textcol>
24+
</tows:geometry_less>
25+
</gml:featureMember>
26+
</wfs:FeatureCollection>

demo/tests/expected/wfs11_describe.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,15 @@ Content-Type: text/xml; subtype=gml/3.1.1;
3737
</xs:extension>
3838
</xs:complexContent>
3939
</xs:complexType>
40+
<xs:element name='geometry_less' type='tows:geometry_lessType' substitutionGroup='gml:_Feature' />
41+
<xs:complexType name='geometry_lessType'>
42+
<xs:complexContent>
43+
<xs:extension base='gml:AbstractFeatureType'>
44+
<xs:sequence>
45+
<xs:element name ='intcol' type='int' nillable='true' minOccurs='0' maxOccurs='1'/>
46+
<xs:element name ='textcol' type='string' nillable='true' minOccurs='0' maxOccurs='1'/>
47+
</xs:sequence>
48+
</xs:extension>
49+
</xs:complexContent>
50+
</xs:complexType>
4051
</xs:schema>

demo/tests/expected/wfs11_getcaps.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ Content-Type: application/xml
126126
<DefaultSRS>urn:ogc:def:crs:EPSG::27582</DefaultSRS>
127127
<ows:WGS84BoundingBox> <ows:LowerCorner>-6.091001 41.347435</ows:LowerCorner> <ows:UpperCorner>10.812651 50.803540</ows:UpperCorner> </ows:WGS84BoundingBox>
128128
</FeatureType>
129+
<FeatureType xmlns:tows="http://www.tinyows.org/">
130+
<Name>tows:geometry_less</Name>
131+
<Title>Geometry less layer</Title>
132+
<NoSRS/></FeatureType>
129133
</FeatureTypeList>
130134
<SupportsGMLObjectTypeList>
131135
<GMLObjectType>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Content-Type: text/xml; subtype=gml/3.1.1
2+
3+
<?xml version='1.0' encoding='UTF-8'?>
4+
<wfs:FeatureCollection
5+
xmlns:tows='http://www.tinyows.org/'
6+
xmlns:wfs='http://www.opengis.net/wfs'
7+
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
8+
xmlns:gml='http://www.opengis.net/gml'
9+
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
10+
xmlns:ogc='http://www.opengis.net/ogc'
11+
xmlns:xlink='http://www.w3.org/1999/xlink'
12+
xmlns:ows='http://www.opengis.net/ows'
13+
xsi:schemaLocation='http://www.tinyows.org/
14+
http://127.0.0.1/cgi-bin/tinyows?service=WFS&amp;version=1.1.0&amp;request=DescribeFeatureType&amp;Typename=tows:geometry_less http://www.opengis.net/wfs
15+
http://schemas.opengis.net/wfs/1.1.0/wfs.xsd
16+
http://www.opengis.net/gml
17+
http://schemas.opengis.net/gml/3.1.1/base/gml.xsd'
18+
>
19+
<gml:featureMember>
20+
<tows:geometry_less gml:id="geometry_less.1">
21+
<tows:intcol>123</tows:intcol>
22+
<tows:textcol>foo</tows:textcol>
23+
</tows:geometry_less>
24+
</gml:featureMember>
25+
</wfs:FeatureCollection>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
service=WFS&version=1.0.0&request=GetFeature&typename=tows:geometry_less

0 commit comments

Comments
 (0)