Skip to content

Commit 3cf682d

Browse files
ajolmarouault
authored andcommitted
OGR: implement expression conversion to Spatialite SQL
When serving a Spatialite DB through WFS for example, the WFS filter was only evaluated on MapServer side instead of being evaluated by SQLite + Spatialite functions.
1 parent 1058774 commit 3cf682d

36 files changed

+7123
-289
lines changed

mapogr.cpp

Lines changed: 756 additions & 289 deletions
Large diffs are not rendered by default.

msautotest/wxs/data/db.sqlite

138 KB
Binary file not shown.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
Content-Type: text/xml; charset=UTF-8
2+
3+
<?xml version='1.0' encoding="UTF-8" ?>
4+
<wfs:FeatureCollection
5+
xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
6+
xmlns:wfs="http://www.opengis.net/wfs"
7+
xmlns:gml="http://www.opengis.net/gml"
8+
xmlns:ogc="http://www.opengis.net/ogc"
9+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
11+
http://mapserver.gis.umn.edu/mapserver http://localhost/path/to/wfs_simple?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=towns&amp;OUTPUTFORMAT=XMLSCHEMA">
12+
<gml:boundedBy>
13+
<gml:Box srsName="EPSG:32632">
14+
<gml:coordinates>660036.840000,4879402.970000 690357.250000,4892926.890000</gml:coordinates>
15+
</gml:Box>
16+
</gml:boundedBy>
17+
<!-- WARNING: FeatureId item 'ID' not found in typename 'towns'. -->
18+
<gml:featureMember>
19+
<ms:towns>
20+
<gml:boundedBy>
21+
<gml:Box srsName="EPSG:32632">
22+
<gml:coordinates>660036.840000,4885407.410000 660036.840000,4885407.410000</gml:coordinates>
23+
</gml:Box>
24+
</gml:boundedBy>
25+
<ms:msGeometry>
26+
<gml:Point srsName="EPSG:32632">
27+
<gml:coordinates>660036.840000,4885407.410000</gml:coordinates>
28+
</gml:Point>
29+
</ms:msGeometry>
30+
<ms:name>Sambuca Pistoiese</ms:name>
31+
<ms:peoples>1604</ms:peoples>
32+
<ms:localcounc>1</ms:localcounc>
33+
<ms:county>0</ms:county>
34+
<ms:region>0</ms:region>
35+
</ms:towns>
36+
</gml:featureMember>
37+
<gml:featureMember>
38+
<ms:towns>
39+
<gml:boundedBy>
40+
<gml:Box srsName="EPSG:32632">
41+
<gml:coordinates>672279.270000,4879402.970000 672279.270000,4879402.970000</gml:coordinates>
42+
</gml:Box>
43+
</gml:boundedBy>
44+
<ms:msGeometry>
45+
<gml:Point srsName="EPSG:32632">
46+
<gml:coordinates>672279.270000,4879402.970000</gml:coordinates>
47+
</gml:Point>
48+
</ms:msGeometry>
49+
<ms:name>Vernio</ms:name>
50+
<ms:peoples>5535</ms:peoples>
51+
<ms:localcounc>1</ms:localcounc>
52+
<ms:county>0</ms:county>
53+
<ms:region>0</ms:region>
54+
</ms:towns>
55+
</gml:featureMember>
56+
<gml:featureMember>
57+
<ms:towns>
58+
<gml:boundedBy>
59+
<gml:Box srsName="EPSG:32632">
60+
<gml:coordinates>666989.570000,4892926.890000 666989.570000,4892926.890000</gml:coordinates>
61+
</gml:Box>
62+
</gml:boundedBy>
63+
<ms:msGeometry>
64+
<gml:Point srsName="EPSG:32632">
65+
<gml:coordinates>666989.570000,4892926.890000</gml:coordinates>
66+
</gml:Point>
67+
</ms:msGeometry>
68+
<ms:name>Camugnano</ms:name>
69+
<ms:peoples>2132</ms:peoples>
70+
<ms:localcounc>1</ms:localcounc>
71+
<ms:county>0</ms:county>
72+
<ms:region>0</ms:region>
73+
</ms:towns>
74+
</gml:featureMember>
75+
<gml:featureMember>
76+
<ms:towns>
77+
<gml:boundedBy>
78+
<gml:Box srsName="EPSG:32632">
79+
<gml:coordinates>662773.000000,4891987.410000 662773.000000,4891987.410000</gml:coordinates>
80+
</gml:Box>
81+
</gml:boundedBy>
82+
<ms:msGeometry>
83+
<gml:Point srsName="EPSG:32632">
84+
<gml:coordinates>662773.000000,4891987.410000</gml:coordinates>
85+
</gml:Point>
86+
</ms:msGeometry>
87+
<ms:name>Castel di Casio</ms:name>
88+
<ms:peoples>3174</ms:peoples>
89+
<ms:localcounc>1</ms:localcounc>
90+
<ms:county>0</ms:county>
91+
<ms:region>0</ms:region>
92+
</ms:towns>
93+
</gml:featureMember>
94+
<gml:featureMember>
95+
<ms:towns>
96+
<gml:boundedBy>
97+
<gml:Box srsName="EPSG:32632">
98+
<gml:coordinates>673068.120000,4889949.750000 673068.120000,4889949.750000</gml:coordinates>
99+
</gml:Box>
100+
</gml:boundedBy>
101+
<ms:msGeometry>
102+
<gml:Point srsName="EPSG:32632">
103+
<gml:coordinates>673068.120000,4889949.750000</gml:coordinates>
104+
</gml:Point>
105+
</ms:msGeometry>
106+
<ms:name>Castiglione dei Pepoli</ms:name>
107+
<ms:peoples>6008</ms:peoples>
108+
<ms:localcounc>1</ms:localcounc>
109+
<ms:county>0</ms:county>
110+
<ms:region>0</ms:region>
111+
</ms:towns>
112+
</gml:featureMember>
113+
<gml:featureMember>
114+
<ms:towns>
115+
<gml:boundedBy>
116+
<gml:Box srsName="EPSG:32632">
117+
<gml:coordinates>690357.250000,4888070.830000 690357.250000,4888070.830000</gml:coordinates>
118+
</gml:Box>
119+
</gml:boundedBy>
120+
<ms:msGeometry>
121+
<gml:Point srsName="EPSG:32632">
122+
<gml:coordinates>690357.250000,4888070.830000</gml:coordinates>
123+
</gml:Point>
124+
</ms:msGeometry>
125+
<ms:name>Firenzuola</ms:name>
126+
<ms:peoples>4812</ms:peoples>
127+
<ms:localcounc>1</ms:localcounc>
128+
<ms:county>0</ms:county>
129+
<ms:region>0</ms:region>
130+
</ms:towns>
131+
</gml:featureMember>
132+
</wfs:FeatureCollection>
133+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Content-Type: text/xml; charset=UTF-8
2+
3+
<?xml version='1.0' encoding="UTF-8" ?>
4+
<wfs:FeatureCollection
5+
xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
6+
xmlns:wfs="http://www.opengis.net/wfs"
7+
xmlns:gml="http://www.opengis.net/gml"
8+
xmlns:ogc="http://www.opengis.net/ogc"
9+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
11+
http://mapserver.gis.umn.edu/mapserver http://localhost/path/to/wfs_simple?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=towns&amp;OUTPUTFORMAT=XMLSCHEMA">
12+
<gml:boundedBy>
13+
<gml:Box srsName="EPSG:32632">
14+
<gml:coordinates>643513.360000,4896928.190000 643513.360000,4896928.190000</gml:coordinates>
15+
</gml:Box>
16+
</gml:boundedBy>
17+
<!-- WARNING: FeatureId item 'ID' not found in typename 'towns'. -->
18+
<gml:featureMember>
19+
<ms:towns>
20+
<gml:boundedBy>
21+
<gml:Box srsName="EPSG:32632">
22+
<gml:coordinates>643513.360000,4896928.190000 643513.360000,4896928.190000</gml:coordinates>
23+
</gml:Box>
24+
</gml:boundedBy>
25+
<ms:msGeometry>
26+
<gml:Point srsName="EPSG:32632">
27+
<gml:coordinates>643513.360000,4896928.190000</gml:coordinates>
28+
</gml:Point>
29+
</ms:msGeometry>
30+
<ms:name>Fanano</ms:name>
31+
<ms:peoples>2910</ms:peoples>
32+
<ms:localcounc>1</ms:localcounc>
33+
<ms:county>0</ms:county>
34+
<ms:region>0</ms:region>
35+
</ms:towns>
36+
</gml:featureMember>
37+
</wfs:FeatureCollection>
38+
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
Content-Type: text/xml; charset=UTF-8
2+
3+
<?xml version='1.0' encoding="UTF-8" ?>
4+
<wfs:FeatureCollection
5+
xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
6+
xmlns:wfs="http://www.opengis.net/wfs"
7+
xmlns:gml="http://www.opengis.net/gml"
8+
xmlns:ogc="http://www.opengis.net/ogc"
9+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
11+
http://mapserver.gis.umn.edu/mapserver http://localhost/path/to/wfs_simple?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=towns&amp;OUTPUTFORMAT=XMLSCHEMA">
12+
<gml:boundedBy>
13+
<gml:Box srsName="EPSG:32632">
14+
<gml:coordinates>643513.360000,4879402.970000 690357.250000,4896928.190000</gml:coordinates>
15+
</gml:Box>
16+
</gml:boundedBy>
17+
<!-- WARNING: FeatureId item 'ID' not found in typename 'towns'. -->
18+
<gml:featureMember>
19+
<ms:towns>
20+
<gml:boundedBy>
21+
<gml:Box srsName="EPSG:32632">
22+
<gml:coordinates>660036.840000,4885407.410000 660036.840000,4885407.410000</gml:coordinates>
23+
</gml:Box>
24+
</gml:boundedBy>
25+
<ms:msGeometry>
26+
<gml:Point srsName="EPSG:32632">
27+
<gml:coordinates>660036.840000,4885407.410000</gml:coordinates>
28+
</gml:Point>
29+
</ms:msGeometry>
30+
<ms:name>Sambuca Pistoiese</ms:name>
31+
<ms:peoples>1604</ms:peoples>
32+
<ms:localcounc>1</ms:localcounc>
33+
<ms:county>0</ms:county>
34+
<ms:region>0</ms:region>
35+
</ms:towns>
36+
</gml:featureMember>
37+
<gml:featureMember>
38+
<ms:towns>
39+
<gml:boundedBy>
40+
<gml:Box srsName="EPSG:32632">
41+
<gml:coordinates>672279.270000,4879402.970000 672279.270000,4879402.970000</gml:coordinates>
42+
</gml:Box>
43+
</gml:boundedBy>
44+
<ms:msGeometry>
45+
<gml:Point srsName="EPSG:32632">
46+
<gml:coordinates>672279.270000,4879402.970000</gml:coordinates>
47+
</gml:Point>
48+
</ms:msGeometry>
49+
<ms:name>Vernio</ms:name>
50+
<ms:peoples>5535</ms:peoples>
51+
<ms:localcounc>1</ms:localcounc>
52+
<ms:county>0</ms:county>
53+
<ms:region>0</ms:region>
54+
</ms:towns>
55+
</gml:featureMember>
56+
<gml:featureMember>
57+
<ms:towns>
58+
<gml:boundedBy>
59+
<gml:Box srsName="EPSG:32632">
60+
<gml:coordinates>643513.360000,4896928.190000 643513.360000,4896928.190000</gml:coordinates>
61+
</gml:Box>
62+
</gml:boundedBy>
63+
<ms:msGeometry>
64+
<gml:Point srsName="EPSG:32632">
65+
<gml:coordinates>643513.360000,4896928.190000</gml:coordinates>
66+
</gml:Point>
67+
</ms:msGeometry>
68+
<ms:name>Fanano</ms:name>
69+
<ms:peoples>2910</ms:peoples>
70+
<ms:localcounc>1</ms:localcounc>
71+
<ms:county>0</ms:county>
72+
<ms:region>0</ms:region>
73+
</ms:towns>
74+
</gml:featureMember>
75+
<gml:featureMember>
76+
<ms:towns>
77+
<gml:boundedBy>
78+
<gml:Box srsName="EPSG:32632">
79+
<gml:coordinates>666989.570000,4892926.890000 666989.570000,4892926.890000</gml:coordinates>
80+
</gml:Box>
81+
</gml:boundedBy>
82+
<ms:msGeometry>
83+
<gml:Point srsName="EPSG:32632">
84+
<gml:coordinates>666989.570000,4892926.890000</gml:coordinates>
85+
</gml:Point>
86+
</ms:msGeometry>
87+
<ms:name>Camugnano</ms:name>
88+
<ms:peoples>2132</ms:peoples>
89+
<ms:localcounc>1</ms:localcounc>
90+
<ms:county>0</ms:county>
91+
<ms:region>0</ms:region>
92+
</ms:towns>
93+
</gml:featureMember>
94+
<gml:featureMember>
95+
<ms:towns>
96+
<gml:boundedBy>
97+
<gml:Box srsName="EPSG:32632">
98+
<gml:coordinates>662773.000000,4891987.410000 662773.000000,4891987.410000</gml:coordinates>
99+
</gml:Box>
100+
</gml:boundedBy>
101+
<ms:msGeometry>
102+
<gml:Point srsName="EPSG:32632">
103+
<gml:coordinates>662773.000000,4891987.410000</gml:coordinates>
104+
</gml:Point>
105+
</ms:msGeometry>
106+
<ms:name>Castel di Casio</ms:name>
107+
<ms:peoples>3174</ms:peoples>
108+
<ms:localcounc>1</ms:localcounc>
109+
<ms:county>0</ms:county>
110+
<ms:region>0</ms:region>
111+
</ms:towns>
112+
</gml:featureMember>
113+
<gml:featureMember>
114+
<ms:towns>
115+
<gml:boundedBy>
116+
<gml:Box srsName="EPSG:32632">
117+
<gml:coordinates>673068.120000,4889949.750000 673068.120000,4889949.750000</gml:coordinates>
118+
</gml:Box>
119+
</gml:boundedBy>
120+
<ms:msGeometry>
121+
<gml:Point srsName="EPSG:32632">
122+
<gml:coordinates>673068.120000,4889949.750000</gml:coordinates>
123+
</gml:Point>
124+
</ms:msGeometry>
125+
<ms:name>Castiglione dei Pepoli</ms:name>
126+
<ms:peoples>6008</ms:peoples>
127+
<ms:localcounc>1</ms:localcounc>
128+
<ms:county>0</ms:county>
129+
<ms:region>0</ms:region>
130+
</ms:towns>
131+
</gml:featureMember>
132+
<gml:featureMember>
133+
<ms:towns>
134+
<gml:boundedBy>
135+
<gml:Box srsName="EPSG:32632">
136+
<gml:coordinates>690357.250000,4888070.830000 690357.250000,4888070.830000</gml:coordinates>
137+
</gml:Box>
138+
</gml:boundedBy>
139+
<ms:msGeometry>
140+
<gml:Point srsName="EPSG:32632">
141+
<gml:coordinates>690357.250000,4888070.830000</gml:coordinates>
142+
</gml:Point>
143+
</ms:msGeometry>
144+
<ms:name>Firenzuola</ms:name>
145+
<ms:peoples>4812</ms:peoples>
146+
<ms:localcounc>1</ms:localcounc>
147+
<ms:county>0</ms:county>
148+
<ms:region>0</ms:region>
149+
</ms:towns>
150+
</gml:featureMember>
151+
</wfs:FeatureCollection>
152+

0 commit comments

Comments
 (0)