MapTools.org

[maplab-users] Query question

William A. Bronsema, C.E.T. bronsema@dmsolutions.ca
Tue, 25 Nov 2003 09:36:10 -0500
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
____________________________________




This archive was generated by Pipermail.