MapTools.org

[maplab-users] Query question

Matt Doggett mdoggett@coas.oregonstate.edu
Tue, 2 Dec 2003 11:08:42 -0800
Thanks Bill for tracking this down for us.  This quickie patch does help
fix part of the problem.  I've discovered a few more "features" related
to this which may or may not be intended behavior:

The following behavior relates only to projected maps (data are in
latlong and map is projected to aea). My unprojected maps have always
behaved well.

* TOLERANCE must be set in the mapfile for each LAYER you want to query.
The documentation suggests a default value for TOLERANCE, but I found if
it is not set in the mapfile, my point queries still return no data,
even with your quick-fix.

* If the user performs a point query (ie. $adMin and $adMax in
query.phtml are the exact same location), then the selected query does
NOT show up highlighted (yellow in my case) in the resultant map. The
query results window however, does show the correct table of returned
values from the query (thanks to your patch).

* If the user performs a very-small rectangle query (ie. $adMax-$adMin <
MIN_RECT), a point query is performed and the resultant map DOES show
highlighted query results. In other words, it works fine.

* Rectangle queries have always behaved normally...no matter how big or
small the selected rectangle.

* Unprojected maps have always behaved normally.

I'm not sure where to go from here on this one. It seems to me that
something is amiss in the executePointQuery() and/or executeRectQuery()
functions that is somehow related to projected space/coordinates. I can
get by with workarounds for now. Just thought you could use this extra
information that helps explain where the problem might really be.

Matt


>-----Original Message-----
>From: maplab-users-admin@lists.maptools.org [mailto:maplab-users-
>admin@lists.maptools.org] On Behalf Of William A. Bronsema, C.E.T.
>Sent: Tuesday, November 25, 2003 6:36 AM
>To: Maplab-users@dmsolutions.ca
>Cc: Post,Richard [NCR]; mdoggett@coas.oregonstate.edu
>Subject: Re: [maplab-users] Query question
>
>Matt, Richard,
>
>Here is the code necessary to fix the problem (perhaps not the most
>optimal, but it is the most self contained).  This fix may or may not
>make it into the next release:
>
>You will need to add the following code to the query.phtml file in any
>application created by gmapfactory as well as the
>/maplab/htdocs/gmapfactory/templates/app_query.phtml file to fix the
>application itself:
>
>/***************************************************/
>     // restrict to point if min rect is set
>     if ( is_numeric( $adMax[0] ) && is_numeric( $adMax[1] ) )
>     {
>         if ( abs( $adMax[1] - $adMin[1] ) <= MIN_RECT &&
>              abs( $adMax[0] - $adMin[0] ) <= MIN_RECT )
>         {
>             unset( $adMax[0] );
>             unset( $adMax[1] );
>         }
>     }
>/***************************************************/
>
>
>
>This code needs to be inserted after the "setQueryLayersByName" call
and
>before the execute query calls (approx line 124 in my version):
>
>
>i.e.
>
>     // commit
>     $oMapQuery->setQueryLayersByName( $aszLayers );
>
>**********************
>INSERT HERE
>**********************
>
>     // execute query
>     if ( is_numeric( $adMax[0] ) && is_numeric( $adMax[1] ) )
>         $oResultSet = $oMapQuery->executeRectQuery( $adMin[0],
>                                     $adMin[1],$adMax[0], $adMax[1] );
>     else
>         $oResultSet = $oMapQuery->executePointQuery( $adMin[0],
>                                                         $adMin[1] );
>
>...
>
>HTH.
>
>Regards,
>William A. Bronsema, C.E.T. wrote:
>
>> Matt, Richard,
>>
>> I have traced through the code and have found the problem.  It
appears
>> that only the zoom tool uses the MIN_RECT, not the query tool.
Therefore
>> when a query is performed, it is always a rectangle query (in ROSA
mode).
>>
>> If I perform a query on the "Parks" (polygon) layer using a single
click
>> I get results because the tiny rectangle "hits" the polygon therefore
>> returning results.  If I perform a single click query on the
"popplace"
>> (point layer) it is likely that I will not get results because the
click
>> would have to be on the exact location of the point (tolerance is not
>> used).  Make sense?
>>
>> I'm not sure why re-projected would behave differently (lucky hit on
the
>> point?).
>>
>> Anyway, I will file a bug about the MIN_RECT parameter not being used
on
>> the query tool.
>>
>> Regards,
>> Bill
>>
>
>--
>
>William A. Bronsema, C.E.T.
>Applications Developer,
>DM Solutions Group Inc.
>
>http://www.dmsolutions.ca
>email: bronsema@dmsolutions.ca
>Phone: (613) 565-5056 ext.25
>Fax :  (613) 565-0925
>____________________________________
>
>
>_______________________________________________
>Maplab-users mailing list
>Maplab-users@lists.maptools.org
>http://lists.maptools.org/mailman/listinfo/maplab-users



This archive was generated by Pipermail.