[mapserver-users] WFS Intersect with gml:box

Joaquín Rodriguez-Guerra Urcelay jrguerra at gmv.com
Thu Mar 31 07:42:34 PDT 2011


Hello,

Here I am again, this is not over :(

I have been testing this all morning, and I have seen that intersect only returns results when the first feature in the mysql table belongs to the resultset, very weird :(

When I request a filter which should return results, but the first feature is not in the resultset, then I get this:

<?xml version='1.0' encoding="ISO-8859-1" ?>
<wfs:FeatureCollection...>
      <gml:boundedBy>
      	<gml:Box srsName="EPSG:4326">
      		<gml:coordinates>-1.000000,-1.000000 -1.000000,-1.000000</gml:coordinates>
      	</gml:Box>
      </gml:boundedBy>
</wfs:FeatureCollection>

Which is diffrent to when I make a query which should not return any results, then I get:

<?xml version='1.0' encoding="ISO-8859-1" ?>
<wfs:FeatureCollection...">
   <gml:boundedBy>
      <gml:null>missing</gml:null>
   </gml:boundedBy>
</wfs:FeatureCollection>

So, it detects when there are results, but only show them when the first feature is on the result set. Does this make any sense?

This is my database (mysql 5):

CREATE DATABASE mmi_spatial_db;
USE mmi_spatial_db;
CREATE TABLE positionReal (id INTEGER, point GEOMETRY);
INSERT INTO positionReal(id, point) VALUES (2, GeomFromText('POINT(10 10)',4326));
INSERT INTO positionReal(id, point) VALUES (1, GeomFromText('POINT(0 20)',4326));
INSERT INTO positionReal(id, point) VALUES (3, GeomFromText('POINT(-10 -10)',4326));

The following query returns the expected result

http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal&Filter=
<Filter xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><Intersects><PropertyName>point</PropertyName>
<gml:Box srsName="epsg:4326"><gml:coordinates decimal="." cs="," ts=" ">10,10 10,10</gml:coordinates>
</gml:Box>
</Intersects>
</Filter>

result:

<wfs:FeatureCollection...
      <gml:boundedBy>
      	<gml:Box srsName="EPSG:4326">
      		<gml:coordinates>10.000000,10.000000 10.000000,10.000000</gml:coordinates>
      	</gml:Box>
      </gml:boundedBy>
    <gml:featureMember>
      <ms:PositionReal fid="PositionReal.2">
        <gml:boundedBy>
        	<gml:Box srsName="EPSG:4326">
        		<gml:coordinates>10.000000,10.000000 10.000000,10.000000</gml:coordinates>
        	</gml:Box>
        </gml:boundedBy>
        <ms:msGeometry>
        <gml:Point srsName="EPSG:4326">
          <gml:coordinates>10.000000,10.000000</gml:coordinates>
        </gml:Point>
        </ms:msGeometry>
        <ms:id>2</ms:id>
      </ms:PositionReal>
    </gml:featureMember>
</wfs:FeatureCollection>

And any other query where the point 10,10 is belonging the bounding box, works. If I change the order INSERTS, then this magic point changes for the one I insert first.

This is my map file:

MAP
  NAME MMI_WFS
  UNITS METERS
  TRANSPARENT ON
  IMAGECOLOR 0 0 0 
  IMAGETYPE PNG 
  SHAPEPATH "."  
  SYMBOLSET "../symbols.sym"
  STATUS ON

WEB
  IMAGEPATH "/opt/fsg/tmp/"
  IMAGEURL "/opt/fsg/"
  METADATA
    "wfs_title"                  "WFS MMI Server for MapServer" ## REQUIRED
    "wfs_onlineresource"         "http://localhost:8080/cgi-bin/mywfs?" ## Recommended
    "wfs_srs"                    "EPSG:4326"## Recommended
    "wfs_abstract"               "This text describes my WFS service." ## Recommended
    "wfs_schemas_location"       "http://schemas.opengeospatial.net"
  END
END

PROJECTION
  "init=epsg:4326"
END

LAYER
  NAME "PositionReal"
  STATUS ON
  TYPE POINT
  CONNECTIONTYPE OGR

  CONNECTION "MySQL:mmi_spatial_db,user=mmi,password=adminis,host=127.0.0.1,port=3306"
  DATA "SELECT id,point from positionReal"

  DUMP TRUE             ## REQUIRED
  #TOLERANCE 200
  #TOLERANCEUNITS PIXELS

  METADATA
      "wfs_featureid" "id"
      "wfs_srs" "epsg:4326"
      "wfs_onlineresource"         "http://localhost:8080/cgi-bin/mywfs?" ## Recommended
      "wfs_title" "PositionReal"
      "gml_include_items"     "all" ## Optional (serves all attributes for lay
      "gml_surface_occurances" "0,UNBOUNDED"
      "wfs_extent"      "-180 -90 180 90"
      "gml_include_items" "all"
  END
END


END # Map File

Well, this is weird, but if it sounds familliar or it rings a bell to some one, please help me :)

Thanks!

Joaquín 
________________________________________
De: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] En nombre de Joaquín Rodriguez-Guerra Urcelay [jrguerra at gmv.com]
Enviado el: jueves, 31 de marzo de 2011 11:31
CC: mapserver-users at lists.osgeo.org
Asunto: RE: [mapserver-users] WFS Intersect with gml:box

Hi,

Thank you both for your help, the filter is finally working :D
The bug is fixed, gml:box works now with intersect. I wanted to confirm this in the bug report, but I havent found they way to write anything there (is it because the bug is now closed?)
Yesterday I was not getting the results I expected because I think my connection to the mysql database had some problem. I tried with a shapefile and it was working perfectly, so I then played  a bit with the mysql connection and now it is working :)

Joaquín

________________________________________
De: Yewondwossen Assefa [yassefa at dmsolutions.ca]
Enviado el: miércoles, 30 de marzo de 2011 22:48
Para: Rahkonen Jukka
CC: mapserver-users at lists.osgeo.org; Joaquín Rodriguez-Guerra Urcelay
Asunto: Re: [mapserver-users] WFS Intersect with gml:box

On 30/03/2011 4:16 PM, Rahkonen Jukka wrote:
> Hi,
>
> "Intersect" means the same as "not disjoint", that the two geometries have at least one point in common. Thus WFS Intersects should select the point that is inside the "box" in the query. I made a quick test with OpenJUMP which is using JTS and it really does select such a point with a apatial query Intersects.
>
  Geos lib used by MapServer should  act the same as JTS I beleive.
Joaquín, you can maybe attach your simple map/data/url to the bug and I
will check it using MapServer trunk.


--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: yassefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056 (ext 14)
Fax:   (613) 565-0925
----------------------------------------------------------------



______________________
This message including any attachments may contain confidential
information, according to our Information Security Management System,
 and intended solely for a specific individual to whom they are addressed.
 Any unauthorised copy, disclosure or distribution of this message
 is strictly forbidden. If you have received this transmission in error,
 please notify the sender immediately and delete it.

______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
 puede contener informacion clasificada por su emisor como confidencial
 en el marco de su Sistema de Gestion de Seguridad de la
Informacion siendo para uso exclusivo del destinatario, quedando
prohibida su divulgacion copia o distribucion a terceros sin la
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje
 erroneamente, se ruega lo notifique al remitente y proceda a su borrado.
Gracias por su colaboracion.

______________________

_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

______________________
This message including any attachments may contain confidential 
information, according to our Information Security Management System,
 and intended solely for a specific individual to whom they are addressed.
 Any unauthorised copy, disclosure or distribution of this message
 is strictly forbidden. If you have received this transmission in error,
 please notify the sender immediately and delete it.

______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
 puede contener informacion clasificada por su emisor como confidencial
 en el marco de su Sistema de Gestion de Seguridad de la 
Informacion siendo para uso exclusivo del destinatario, quedando 
prohibida su divulgacion copia o distribucion a terceros sin la 
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje 
 erroneamente, se ruega lo notifique al remitente y proceda a su borrado. 
Gracias por su colaboracion.

______________________




More information about the MapServer-users mailing list