<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. &nbsp;<BR>
<BR>
We use it to dynamically zoom in on the results from our query. &nbsp;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. &nbsp;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, &quot;Pearson, Gregory&quot; &lt;Gregory.Pearson@baltimorecity.gov&gt; 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&#8217;re saying I can derive the coordinates from the min/max X and Y points? Have you implemented this?<BR>
&nbsp;<BR>
Greg<BR>
&nbsp;<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>
&nbsp;&nbsp;&nbsp;&nbsp;$test=@$qlayer-&gt;queryByAttributes($item,$temptest,MS_MULTIPLE);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if ($test == MS_SUCCESS) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$minX=-1;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$minY=-1;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$maxX=-1;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$maxY=-1;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ($ind = 0;$ind&lt;$qlayer-&gt;getNumResults();$ind++) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$result = $qlayer-&gt;getResult($ind);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$shpindex = $result-&gt;shapeindex;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$tilindex = $result-&gt;tileindex;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$shptemp = $qlayer-&gt;getShape($tilindex,$shpindex);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$rec = $shptemp-&gt;bounds;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($minX == -1 or $minX &gt; $rec-&gt;minx) $minX=Round($rec-&gt;minx);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($minY == -1 or $minY &gt; $rec-&gt;miny) $minY=Round($rec-&gt;miny);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($maxX == -1 or $maxX &lt; $rec-&gt;maxx) $maxX=Round($rec-&gt;maxx);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($maxY == -1 or $maxY &lt; $rec-&gt;maxy) $maxY=Round($rec-&gt;maxy);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
On 2/28/08 2:23 PM, &quot;Pearson, Gregory&quot; &lt;Gregory.Pearson@BALTIMORECITY.GOV&gt; 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&#8217;t seen anything in the API documentation that supports this. Is this possible?<BR>
&nbsp;<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>