<p class="MsoPlainText"><span lang="EN-US">Hello,</span></p>
<p class="MsoPlainText"><span lang="EN-US">I Have been playing around with
mapserver OGR setting a layer of points comming from two different sources,
first a mysql spatial table, and then a postgis table, and I have seen that the
WFS operation Intersect behaves weird when using mysql (it works ok with
postgres). I am not sure if OGR is involved in this, I already asked in the
mapserver list with no answerd, so, thanks for reading, and please forgive me
if I am asking in the wrong place.</span></p>
<p class="MsoPlainText"><span lang="EN-US">PROBLEM:</span></p>
<p class="MsoPlainText"><span lang="EN-US">In wfs layer where the data is retrieved
from a mysql table, the intersect filter only returns a result list when the
first feature(the first inserted record in the table) is part of the result
set. If the filter shall return results, but the first feature is not among
them, then we get not list of features:</span></p>
<p class="MsoPlainText"><span lang="EN-US"><?xml version='1.0'
encoding="ISO-8859-1" ?> <wfs:FeatureCollection...></span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span><gml:boundedBy></span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span><gml:Box srsName="EPSG:4326"></span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span><gml:coordinates>-1.000000,-1.000000 -1.000000,-1.000000</gml:coordinates></span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span></gml:Box></span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span></gml:boundedBy></span></p>
<p class="MsoPlainText"><span lang="EN-US"></wfs:FeatureCollection></span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">Which is diffrent to when a query shall
not return any resultst:</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US"><?xml version='1.0'
encoding="ISO-8859-1" ?> <wfs:FeatureCollection..."></span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span><gml:boundedBy></span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span><gml:null>missing</gml:null></span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span></gml:boundedBy></span></p>
<p class="MsoPlainText"><span lang="EN-US"></wfs:FeatureCollection></span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">TEST:</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">1. Create Spatial Data</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">CREATE DATABASE mmi_spatial_db;</span></p>
<p class="MsoPlainText"><span lang="EN-US">USE mmi_spatial_db;</span></p>
<p class="MsoPlainText"><span lang="EN-US">CREATE TABLE positionReal (oid LONG,
point POINT); INSERT INTO positionReal(oid, point) VALUES (3,
GeomFromText('POINT(-10 -10)',4326)); INSERT INTO positionReal(oid, point)
VALUES (2, GeomFromText('POINT(10 10)',4326)); INSERT INTO positionReal(oid,
point) VALUES (1, GeomFromText('POINT(0 20)',4326));</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">2. Map file:</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">MAP</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>NAME MMI_WFS</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>UNITS METERS</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>TRANSPARENT ON</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>IMAGECOLOR 0 0 0</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>IMAGETYPE PNG</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>SHAPEPATH "."</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>SYMBOLSET "../symbols.sym"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>STATUS ON</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">WEB</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>IMAGEPATH "/opt/fsg/tmp/"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>IMAGEURL "/opt/fsg/"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>METADATA</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"wfs_title"<span style="mso-spacerun:yes">
</span>"WFS MMI Server for MapServer" ## REQUIRED</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"wfs_onlineresource"<span style="mso-spacerun:yes">
</span>"<a href="http://localhost:8080/cgi-bin/mywfs?">http://localhost:8080/cgi-bin/mywfs?</a>"
## Recommended</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"wfs_srs"<span style="mso-spacerun:yes">
</span>"EPSG:4326"## Recommended</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"wfs_abstract"<span style="mso-spacerun:yes">
</span>"This text describes my WFS service." ## Recommended</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"wfs_schemas_location"<span style="mso-spacerun:yes">
</span>"<a href="http://schemas.opengeospatial.net">http://schemas.opengeospatial.net</a>"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>END</span></p>
<p class="MsoPlainText"><span lang="EN-US">END</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">PROJECTION</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"init=epsg:4326"</span></p>
<p class="MsoPlainText"><span lang="EN-US">END</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">LAYER</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>NAME "PositionReal"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>STATUS ON</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>TYPE POINT</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>CONNECTIONTYPE OGR</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>CONNECTION "MySQL:mmi_spatial_db,user=mmi,password=*****,host=127.0.0.1,port=3306"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>DATA "SELECT point from positionReal"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>#CONNECTIONTYPE POSTGIS</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>#CONNECTION "host=127.0.0.1 port=5432 dbname=mmi_db user=postgres
password=postgres"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>#DATA "point from positionreal"</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>DUMP TRUE<span style="mso-spacerun:yes"> </span>## REQUIRED</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>#TOLERANCE 200</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>#TOLERANCEUNITS PIXELS</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>METADATA</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>#"wfs_featureid" "oid"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"wfs_srs" "epsg:4326"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"wfs_onlineresource"<span style="mso-spacerun:yes">
</span>"<a href="http://localhost:8080/cgi-bin/mywfs?">http://localhost:8080/cgi-bin/mywfs?</a>"
## Recommended</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"wfs_title" "PositionReal"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"gml_include_items"<span style="mso-spacerun:yes">
</span>"all" ## Optional (serves all attributes for lay</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"gml_surface_occurances" "0,UNBOUNDED"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"wfs_extent"<span style="mso-spacerun:yes">
</span>"-180 -90 180 90"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>"gml_include_items" "all"</span></p>
<p class="MsoPlainText"><span lang="EN-US"><span style="mso-spacerun:yes">
</span>END</span></p>
<p class="MsoPlainText"><span lang="EN-US">END</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">END # Map File</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">3. Intersect Filter:</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">- This one works because point (-10,-10)
is part of the resultset.</span></p>
<p class="MsoPlainText"><span lang="EN-US"><a href="http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal&Filter">http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal&Filter</a>=</span></p>
<p class="MsoPlainText"><span lang="EN-US"><Filter xmlns="<a href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>"
xmlns:gml="<a href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>"><Intersects><PropertyName>point</PropertyName></span></p>
<p class="MsoPlainText"><span lang="EN-US"><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-180,-90
-180,90 180,90 180,-90
-180,-90</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter></span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">- This one works, point (-10,-10) is
part of the resultset <a href="http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal&Filter">http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal&Filter</a>=</span></p>
<p class="MsoPlainText"><span lang="EN-US"><Filter xmlns="<a href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>"
xmlns:gml="<a href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>"><Intersects><PropertyName>point</PropertyName></span></p>
<p class="MsoPlainText"><span lang="EN-US"><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-11,-11
-11,-9 -9,-9 -9,-11
-11,-11</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter></span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">- This query fails, it should return one
feature, but we get the weird behavior because point (-10,-10) is not part of
the resultset <a href="http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal&Filter">http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal&Filter</a>=</span></p>
<p class="MsoPlainText"><span lang="EN-US"><Filter xmlns="<a href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>"
xmlns:gml="<a href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>"><Intersects><PropertyName>point</PropertyName></span></p>
<p class="MsoPlainText"><span lang="EN-US"><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>9,9
9,11 11,11 11,9 9,9</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter></span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">Notice that I use gml:polygon instead of
gml:box to be able to test this with mapserver in trunk (which works with
gml:box) but also with mapserver 5.6.3 (fgs-installer, which dont work with
intersect and gml:box)</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">The problem does not ocurr if the
database in use is postgres</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">./createdb -U postgres -T
template_postgis mmi_db; CREATE TABLE positionReal (oid int); SELECT
AddGeometryColumn('positionreal', 'point', 4326,'POINT',2); INSERT INTO
positionReal(oid, point) VALUES (3, GeomFromText('POINT(-10 -10)',4326));
INSERT INTO positionReal(oid, point) VALUES (2, GeomFromText('POINT(10
10)',4326)); INSERT INTO positionReal(oid, point) VALUES (1,
GeomFromText('POINT(0 20)',4326));</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span> </p>
<p class="MsoPlainText"><span lang="EN-US">SYSTEMS:</span> </p>
<p class="MsoPlainText"><span lang="EN-US">I tested this in the following systems:</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">OpenSuse 11</span></p>
<p class="MsoPlainText"><span lang="EN-US">fgs-mapserver_basic_5.6.3-fgs_9.5-linux-i386.bin
and building from the sources (branch 5-6) mysql<span style="mso-spacerun:yes"> </span>Ver 14.12 Distrib 5.0.67, for suse-linux-gnu
(i686) using readline 5.2 and mysql 5.5 too</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">SLES 11</span></p>
<p class="MsoPlainText"><span lang="EN-US">fgs-mapserver_basic_5.6.3-fgs_9.5-linux-i386.bin</span></p>
<p class="MsoPlainText"><span lang="EN-US">mysql<span style="mso-spacerun:yes">
</span>Ver 14.14 Distrib 5.1.43, for unknown-linux-gnu (x86_64) using readline
5.1</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">Ubunut</span></p>
<p class="MsoPlainText"><span lang="EN-US">fgs-mapserver_basic_5.6.3-fgs_9.5-linux-i386.bin</span></p>
<p class="MsoPlainText"><span lang="EN-US">mysql 5.1</span></p>
<p class="MsoPlainText"><span lang="EN-US"> </span></p>
<p class="MsoPlainText"><span lang="EN-US">Best regards,</span></p><p class="MsoPlainText"><span lang="EN-US">Jorge and Joaquin</span></p>