<HTML>
<HEAD>
<TITLE>Re: [UMN_MAPSERVER-USERS] Mapscript Question</TITLE>
</HEAD>
<BODY>
<FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
Each shape can be projected using the following. &nbsp;<BR>
<BR>
The shape&#8217;s current projection. &nbsp;(epsg 2266 in this case.) $insridtext=&quot;proj=lcc,lat_1=47.48333333333333,lat_2=46.18333333333333,lat_0=45.66666666666666,lon_0=-100.5,x_0=599999.9999976,y_0=0,ellps=GRS80,datum=NAD83,to_meter=0.3048,no_defs&quot;; <BR>
The projection you want the shape to be. &nbsp;(epsg 4269 in this case)<BR>
$outsridtext=&quot;+proj=longlat +ellps=GRS80 +datum=NAD83 +no_defs&quot;;<BR>
<BR>
$projin = ms_newProjectionObj($insridtext);<BR>
$projout = ms_newProjectionObj($outsridtext);<BR>
$shptemp-&gt;project($projin,$projout);<BR>
<BR>
On 2/29/08 12:33 PM, &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 took a look and what I have found is that most of the information available to me through the shape object is defined in the *dbf file. But, I have another issue you may be able to help with. Have you done projections?<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> Friday, February 29, 2008 10:19 AM<BR>
<B>To:</B> Pearson, Gregory; mapserver-users@lists.osgeo.org<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'>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>
</SPAN></FONT><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;
</SPAN></FONT></FONT></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 FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
</SPAN></FONT><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> <a href="mailto:pmoen@nd.gov%5d">&lt;mailto:pmoen@nd.gov%5d&gt;</a> &nbsp;<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 FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
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><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'><BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:12.0px'><BR>
<BR>
Paul T. Moen<BR>
pmoen@nd.gov<BR>
701-328-2434<BR>
701-328-3696 (fax)<BR>
ND State Water Commission<BR>
</SPAN></FONT>
</BODY>
</HTML>