Skip to content
Permalink
Browse files

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.
  • Loading branch information
ajolma authored and rouault committed May 31, 2016
1 parent 1058774 commit 3cf682d17003521213868f1e727d7be7a3263c7e
Showing with 7,123 additions and 289 deletions.
  1. +756 −289 mapogr.cpp
  2. BIN msautotest/wxs/data/db.sqlite
  3. +133 −0 msautotest/wxs/expected/wfs_ogr_native_sql_01.xml
  4. +38 −0 msautotest/wxs/expected/wfs_ogr_native_sql_02.xml
  5. +152 −0 msautotest/wxs/expected/wfs_ogr_native_sql_03.xml
  6. +114 −0 msautotest/wxs/expected/wfs_ogr_native_sql_04.xml
  7. +38 −0 msautotest/wxs/expected/wfs_ogr_native_sql_05.xml
  8. +38 −0 msautotest/wxs/expected/wfs_ogr_native_sql_06.xml
  9. +38 −0 msautotest/wxs/expected/wfs_ogr_native_sql_07.xml
  10. +798 −0 msautotest/wxs/expected/wfs_ogr_native_sql_08.xml
  11. +817 −0 msautotest/wxs/expected/wfs_ogr_native_sql_09.xml
  12. +266 −0 msautotest/wxs/expected/wfs_ogr_native_sql_10.xml
  13. +551 −0 msautotest/wxs/expected/wfs_ogr_native_sql_11.xml
  14. +285 −0 msautotest/wxs/expected/wfs_ogr_native_sql_12.xml
  15. +570 −0 msautotest/wxs/expected/wfs_ogr_native_sql_13.xml
  16. +38 −0 msautotest/wxs/expected/wfs_ogr_native_sql_14.xml
  17. +190 −0 msautotest/wxs/expected/wfs_ogr_native_sql_15.xml
  18. +57 −0 msautotest/wxs/expected/wfs_ogr_native_sql_16.xml
  19. +190 −0 msautotest/wxs/expected/wfs_ogr_native_sql_17.xml
  20. +38 −0 msautotest/wxs/expected/wfs_ogr_native_sql_18.xml
  21. +171 −0 msautotest/wxs/expected/wfs_ogr_native_sql_19.xml
  22. +95 −0 msautotest/wxs/expected/wfs_ogr_native_sql_20.xml
  23. +95 −0 msautotest/wxs/expected/wfs_ogr_native_sql_21.xml
  24. +57 −0 msautotest/wxs/expected/wfs_ogr_native_sql_22.xml
  25. +57 −0 msautotest/wxs/expected/wfs_ogr_native_sql_23.xml
  26. +779 −0 msautotest/wxs/expected/wfs_ogr_native_sql_24.xml
  27. +16 −0 msautotest/wxs/expected/wfs_ogr_native_sql_25.xml
  28. +16 −0 msautotest/wxs/expected/wfs_ogr_native_sql_26.xml
  29. +16 −0 msautotest/wxs/expected/wfs_ogr_native_sql_27.xml
  30. +57 −0 msautotest/wxs/expected/wfs_ogr_native_sql_28.xml
  31. +16 −0 msautotest/wxs/expected/wfs_ogr_native_sql_29.xml
  32. +38 −0 msautotest/wxs/expected/wfs_ogr_native_sql_30.xml
  33. +304 −0 msautotest/wxs/expected/wfs_ogr_native_sql_31.xml
  34. +57 −0 msautotest/wxs/expected/wfs_ogr_native_sql_32.xml
  35. +121 −0 msautotest/wxs/wfs_ogr_native_sql.map
  36. +121 −0 msautotest/wxs/wfs_ogr_no_native_sql.map
1,045 mapogr.cpp

Large diffs are not rendered by default.

Binary file not shown.
@@ -0,0 +1,133 @@
Content-Type: text/xml; charset=UTF-8

<?xml version='1.0' encoding="UTF-8" ?>
<wfs:FeatureCollection
xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
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">
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>660036.840000,4879402.970000 690357.250000,4892926.890000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<!-- WARNING: FeatureId item 'ID' not found in typename 'towns'. -->
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>660036.840000,4885407.410000 660036.840000,4885407.410000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>660036.840000,4885407.410000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Sambuca Pistoiese</ms:name>
<ms:peoples>1604</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>672279.270000,4879402.970000 672279.270000,4879402.970000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>672279.270000,4879402.970000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Vernio</ms:name>
<ms:peoples>5535</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>666989.570000,4892926.890000 666989.570000,4892926.890000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>666989.570000,4892926.890000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Camugnano</ms:name>
<ms:peoples>2132</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>662773.000000,4891987.410000 662773.000000,4891987.410000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>662773.000000,4891987.410000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Castel di Casio</ms:name>
<ms:peoples>3174</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>673068.120000,4889949.750000 673068.120000,4889949.750000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>673068.120000,4889949.750000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Castiglione dei Pepoli</ms:name>
<ms:peoples>6008</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>690357.250000,4888070.830000 690357.250000,4888070.830000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>690357.250000,4888070.830000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Firenzuola</ms:name>
<ms:peoples>4812</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
</wfs:FeatureCollection>

@@ -0,0 +1,38 @@
Content-Type: text/xml; charset=UTF-8

<?xml version='1.0' encoding="UTF-8" ?>
<wfs:FeatureCollection
xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
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">
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>643513.360000,4896928.190000 643513.360000,4896928.190000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<!-- WARNING: FeatureId item 'ID' not found in typename 'towns'. -->
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>643513.360000,4896928.190000 643513.360000,4896928.190000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>643513.360000,4896928.190000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Fanano</ms:name>
<ms:peoples>2910</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
</wfs:FeatureCollection>

@@ -0,0 +1,152 @@
Content-Type: text/xml; charset=UTF-8

<?xml version='1.0' encoding="UTF-8" ?>
<wfs:FeatureCollection
xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd
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">
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>643513.360000,4879402.970000 690357.250000,4896928.190000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<!-- WARNING: FeatureId item 'ID' not found in typename 'towns'. -->
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>660036.840000,4885407.410000 660036.840000,4885407.410000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>660036.840000,4885407.410000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Sambuca Pistoiese</ms:name>
<ms:peoples>1604</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>672279.270000,4879402.970000 672279.270000,4879402.970000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>672279.270000,4879402.970000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Vernio</ms:name>
<ms:peoples>5535</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>643513.360000,4896928.190000 643513.360000,4896928.190000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>643513.360000,4896928.190000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Fanano</ms:name>
<ms:peoples>2910</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>666989.570000,4892926.890000 666989.570000,4892926.890000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>666989.570000,4892926.890000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Camugnano</ms:name>
<ms:peoples>2132</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>662773.000000,4891987.410000 662773.000000,4891987.410000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>662773.000000,4891987.410000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Castel di Casio</ms:name>
<ms:peoples>3174</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>673068.120000,4889949.750000 673068.120000,4889949.750000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>673068.120000,4889949.750000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Castiglione dei Pepoli</ms:name>
<ms:peoples>6008</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
<gml:featureMember>
<ms:towns>
<gml:boundedBy>
<gml:Box srsName="EPSG:32632">
<gml:coordinates>690357.250000,4888070.830000 690357.250000,4888070.830000</gml:coordinates>
</gml:Box>
</gml:boundedBy>
<ms:msGeometry>
<gml:Point srsName="EPSG:32632">
<gml:coordinates>690357.250000,4888070.830000</gml:coordinates>
</gml:Point>
</ms:msGeometry>
<ms:name>Firenzuola</ms:name>
<ms:peoples>4812</ms:peoples>
<ms:localcounc>1</ms:localcounc>
<ms:county>0</ms:county>
<ms:region>0</ms:region>
</ms:towns>
</gml:featureMember>
</wfs:FeatureCollection>

0 comments on commit 3cf682d

Please sign in to comment.
You can’t perform that action at this time.