<HTML>
<HEAD>
<TITLE>Re: [UMN_MAPSERVER-USERS] Mapscript Question</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>It will give you the bounding coordinates of the all the shapes in your result. <BR>
<BR>
We use it to dynamically zoom in on the results from our query. It works fine for our purposes.<BR>
<BR>
Keep in mind that you can get most everything you need from shape objects that the loop iterates through. You can parse out the lines, get the wkt, centroid or whatever you want.<BR>
<BR>
Check out <a href="http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/shapeobj">http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/shapeobj</a><BR>
<BR>
Hope this helps,<BR>
<BR>
Paul<BR>
<BR>
On 2/29/08 7:54 AM, "Pearson, Gregory" <Gregory.Pearson@baltimorecity.gov> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT COLOR="#000080"><FONT SIZE="4"><FONT FACE="Arial"><SPAN STYLE='font-size:13.0px'>Thanks, Paul. I was hoping the API provided this function. So, you’re saying I can derive the coordinates from the min/max X and Y points? Have you implemented this?<BR>
<BR>
Greg<BR>
<BR>
</SPAN></FONT></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>
</SPAN></FONT>
<P ALIGN=CENTER>
<FONT SIZE="5"><FONT FACE="Times New Roman"><SPAN STYLE='font-size:16.0px'><HR ALIGN=CENTER SIZE="2" WIDTH="100%"></SPAN></FONT></FONT>
<P>
<FONT SIZE="4"><FONT FACE="Tahoma"><SPAN STYLE='font-size:13.0px'><B>From:</B> Paul Moen [<a href="mailto:pmoen@nd.gov]">mailto:pmoen@nd.gov]</a> <BR>
<B>Sent:</B> Thursday, February 28, 2008 4:16 PM<BR>
<B>To:</B> Pearson, Gregory; MAPSERVER-USERS@LISTS.UMN.EDU<BR>
<B>Subject:</B> Re: [UMN_MAPSERVER-USERS] Mapscript Question<BR>
</SPAN></FONT></FONT><FONT SIZE="5"><FONT FACE="Times New Roman"><SPAN STYLE='font-size:16.0px'> <BR>
</SPAN></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'>You could try to use the bounds and loop through the results.<BR>
<BR>
$test=@$qlayer->queryByAttributes($item,$temptest,MS_MULTIPLE);<BR>
if ($test == MS_SUCCESS) {<BR>
$minX=-1;<BR>
$minY=-1;<BR>
$maxX=-1;<BR>
$maxY=-1;<BR>
for ($ind = 0;$ind<$qlayer->getNumResults();$ind++) {<BR>
$result = $qlayer->getResult($ind);<BR>
$shpindex = $result->shapeindex;<BR>
$tilindex = $result->tileindex;<BR>
$shptemp = $qlayer->getShape($tilindex,$shpindex);<BR>
$rec = $shptemp->bounds;<BR>
if ($minX == -1 or $minX > $rec->minx) $minX=Round($rec->minx);<BR>
if ($minY == -1 or $minY > $rec->miny) $minY=Round($rec->miny);<BR>
if ($maxX == -1 or $maxX < $rec->maxx) $maxX=Round($rec->maxx);<BR>
if ($maxY == -1 or $maxY < $rec->maxy) $maxY=Round($rec->maxy);<BR>
}<BR>
}<BR>
<BR>
On 2/28/08 2:23 PM, "Pearson, Gregory" <Gregory.Pearson@BALTIMORECITY.GOV> wrote:<BR>
</SPAN></FONT><FONT SIZE="4"><FONT FACE="Arial"><SPAN STYLE='font-size:13.0px'>I am doing a layer search using the method queryByAttributes and want to know if I can get the map coordinates from the result. So far, I haven’t seen anything in the API documentation that supports this. Is this possible?<BR>
<BR>
Greg<BR>
</SPAN></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
<BR>
Paul<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
</SPAN></FONT>
</BODY>
</HTML>