<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV>For first excuse my english. I'm from Brazil and im speaking a bad
english.</DIV>
<DIV>I' m working on a project for public safety in my country.</DIV>
<DIV>I'm using maplab v2.0, mapserver 4.0.1 and PHP 4.3.3 on
windows<BR></DIV>
<DIV><FONT face=Arial size=2>I read the message post by Paul Spencer at
<FONT face="Times New Roman" size=3><EM>07 Oct 2002 </EM>about locate a
address (see above) and I put this code in my application:</FONT></FONT></DIV>
<DIV> </DIV>
<DIV>if ( $http_form_vars["parcel-number"] )<BR>{<BR>        // the parcel number to
query for<BR>        $szParcelNumber = $http_form_vars["parcel-number"];<BR><BR>        // the
current extents will be the default if we fail.<BR>        $oExtents =
$oMapSession->oMap->extents;<BR><BR>        //first we need a handle on the
layer, let's assume that we have<BR>        //it's name<BR>        $oParcelLayer =
$oMapSession->oMap->getLayerByName( "Parcels" );<BR><BR>        // set up the
layer for a query in ms 3.6 - in 3.7 we don't need<BR>        // to do this, we can
just use querybyattribute. Here we assume<BR>        // that the data file
associated with the layer has an attribute<BR>        // called parcel_number that we
are querying.<BR>        $oParcelLayer->set( "FILTERITEM", "parcel_number"
);<BR>        $oParcelLayer->setFilter( $szParcelNumber );<BR>        <BR>        // use
querybyattribute to generate the result, assume a single<BR>        // one for
simplicity but this can be extended to multiple<BR>        // results
easily<BR>        $oParcelLayer->queryByAttribute( MS_SINGLE );<BR><BR>        //now check
to see if there are any results?<BR>        if ($oParcelLayer->getNumResults() >
0 )<BR>        {<BR>                //at least one result, assume only one for this
example<BR>                $oResult = $oParcelLayer->getResult( 0 );<BR>                //oResult is a
resultCacheMemberObj<BR>                $oShape = $oParcelLayer->getShape(
$oResult->tileindex,<BR>                                                 $oResult->shapeid
);<BR>                $oExtents = $oShape->bounds;<BR>                $oShape->free();<BR><BR>                //at
this point we might add a buffer to the extents<BR>                $nXBuffer = (
$oExtents->maxx - $oExtents->minx )*0.05;<BR>                $nYBuffer = (
$oExtents->maxy - $oExtents->miny )*0.05;<BR>                $nMinX = $oExtents->minx
- $nXBuffer;<BR>                $nMaxX = $oExtents->maxx + $nXBuffer;<BR>                $nMinY =
$oExtents->miny - $nYBuffer;<BR>                $nMaxY = $oExtents->maxy +
$nYBuffer;<BR>                $oExtents->setExtents( $nMinX, $nMinY, $nMaxX, $nMaxY
);<BR>        }<BR><BR>        // now use $oMapNavigator to navigate to the parcel<BR>        //
location. There are two useful options now. We<BR>        // can zoom to a
rectangle which we have calculated or<BR>        // to a point and scale. Let's
assume we have calculated<BR>        // a rectangle and put a buffer around it if
necessary.<BR>        $oMapNavigator->zoomRectangle($oExtents->minx,
$oExtents->miny,<BR>                                 $oExtents->maxx,
$oExtents->maxy);<BR><BR>        // alternately if it's a point and a scale
...<BR>        // $oMapNavigator->zoomScale( $nScale, $nX, $nY );<BR>}<BR></DIV>
<DIV><FONT face=Arial size=2>Whem I enter the parcel-number value, I get the
error: </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><STRONG>Fatal error</STRONG>: [MapServer Error]: msCalculateScale():
Invalid image extent. in <B>c:\......etc</B></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>What is wrong???</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Claudio</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>