[maplab-users] Query question

Matt Doggett
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 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.


>-----Original Message-----
>From: [mailto:maplab-users-
>] On Behalf Of William A. Bronsema, C.E.T.
>Sent: Tuesday, November 25, 2003 6:36 AM
>Cc: Post,Richard [NCR];
>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
>before the execute query calls (approx line 124 in my version):
>     // commit
>     $oMapQuery->setQueryLayersByName( $aszLayers );
>     // 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] );
>William A. Bronsema, C.E.T. wrote:
>> Matt, Richard,
>> I have traced through the code and have found the problem.  It
>> that only the zoom tool uses the MIN_RECT, not the query tool.
>> when a query is performed, it is always a rectangle query (in ROSA
>> If I perform a query on the "Parks" (polygon) layer using a single
>> I get results because the tiny rectangle "hits" the polygon therefore
>> returning results.  If I perform a single click query on the
>> (point layer) it is likely that I will not get results because the
>> 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
>> point?).
>> Anyway, I will file a bug about the MIN_RECT parameter not being used
>> the query tool.
>> Regards,
>> Bill
>William A. Bronsema, C.E.T.
>Applications Developer,
>DM Solutions Group Inc.
>Phone: (613) 565-5056 ext.25
>Fax :  (613) 565-0925
>Maplab-users mailing list

This archive was generated by Pipermail.