[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mapserver-dev
Subject:    Re: [mapserver-dev] Calculate Bounding Box...
From:       "Oscar Fdez." <ofarcis () gmail ! com>
Date:       2009-03-13 10:58:39
Message-ID: 7b2807360903130358o4da80ae7hbcd1b0d6b46acb5d () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Thanks so much to all for help.

Regards, Oscar.



2009/3/12 Dan Little <danlittle@yahoo.com>

> I'm thinking the most accurate way to do it is to use a projection that
> supports miles that is close to your current extent...  or  use something
> crappy like Mercator.
>
> This code is off the top of my head, without looking at any docs... so bear
> with me if there are errors.
>
> $latlon = ms_newProjectionObj("proj=EPSG:4230"); # IIRC
> $proj = ms_newProjectionObj("proj=EPSG:3758"); # Popular Web-mapping
> projection
>
> $centerPoint = ms_newPointObj($x, $y); # in lat long
>
> $centerPoint->project($latlon, $proj);
>
> $minPoint = ms_newPointObj();
> $maxPoint = ms_newPointObj();
>
> $mInM = 1609; # mile in meters, as 3758 is in meters
> $minPoint->setXY($centerPoint.x - $mInM, $centerPoint.y - $mInM);
> $maxPoint->setXY($centerPoint.x + $mInM, $centerPoint.y + $mInM);
>
> $minPoint->project($proj, $latlon);
> $maxPoint->project($proj, $latlon);
>
> return
> implode(',',array($minPoint->x,$minPoint->y,$maxPoint->x,$maxPoint->y));
>
>
>
>
> ------------------------------
> *From:* Oscar Fdez. <ofarcis@gmail.com>
> *To:* mapserver-dev@lists.osgeo.org
> *Sent:* Wednesday, March 11, 2009 11:53:26 PM
> *Subject:* [mapserver-dev] Calculate Bounding Box...
>
>  Hi to all,
>
> Any people know how to calculate the bounding box from lon/lat coordinates.
>
> An example:
>
> I have a point in -8.0572,42.4702 (lon/lan). I like a bounding box arround
> 1 mile of this site. Can use any SRS like EPSG:4230 or another.
>
> Any solution is accepted independent of language. I translate to my need. I
> hope develop in php mapscript, but the solution can made in any language…
>
>
>
> Thanks for all,
>
> Oscar.
>
>
>
>
>
>
>
>

[Attachment #5 (text/html)]

Thanks so much to all for help.<br><br>Regards, Oscar.<br><br><br><br><div \
class="gmail_quote">2009/3/12 Dan Little <span dir="ltr">&lt;<a \
href="mailto:danlittle@yahoo.com">danlittle@yahoo.com</a>&gt;</span><br><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;"> <div><div style="font-family: \
arial,helvetica,sans-serif; font-size: 10pt;"><div style="font-family: \
arial,helvetica,sans-serif; font-size: 10pt;">I&#39;m thinking the most accurate way \
to do it is to use a projection that supports miles that is close to your current \
extent...  or  use something crappy like Mercator.<br> <br>This code is off the top \
of my head, without looking at any docs... so bear with me if there are \
errors.<br><br>$latlon = ms_newProjectionObj(&quot;proj=EPSG:4230&quot;); # \
IIRC<br>$proj = ms_newProjectionObj(&quot;proj=EPSG:3758&quot;); # Popular \
Web-mapping projection<br> <br>$centerPoint = ms_newPointObj($x, $y); # in lat \
long<br><br>$centerPoint-&gt;project($latlon, $proj);<br><br>$minPoint = \
ms_newPointObj();<br>$maxPoint = ms_newPointObj();<br><br>$mInM = 1609; # mile in \
meters, as 3758 is in meters<br> $minPoint-&gt;setXY($centerPoint.x - $mInM, \
$centerPoint.y -  $mInM);<br>$maxPoint-&gt;setXY($centerPoint.x + $mInM, \
$centerPoint.y + $mInM);<br><br>$minPoint-&gt;project($proj, \
$latlon);<br>$maxPoint-&gt;project($proj, $latlon);<br><br>return \
implode(&#39;,&#39;,array($minPoint-&gt;x,$minPoint-&gt;y,$maxPoint-&gt;x,$maxPoint-&gt;y));<br>
 <br><br><br><br><div style="font-family: times new roman,new york,times,serif; \
font-size: 12pt;"><font size="2" face="Tahoma"><div class="im"><hr size="1"><b><span \
style="font-weight: bold;">From:</span></b> Oscar Fdez. &lt;<a \
href="mailto:ofarcis@gmail.com" target="_blank">ofarcis@gmail.com</a>&gt;<br> \
<b><span style="font-weight: bold;">To:</span></b> <a \
href="mailto:mapserver-dev@lists.osgeo.org" \
target="_blank">mapserver-dev@lists.osgeo.org</a><br></div><b><span \
style="font-weight: bold;">Sent:</span></b> Wednesday, March 11, 2009 11:53:26 PM<div \
class="im"> <br><b><span style="font-weight: bold;">Subject:</span></b> \
[mapserver-dev] Calculate Bounding Box...<br></div></font><div><div></div><div \
class="h5"><br>



 
 




<div>

<p><span style="color: black;" lang="EN-US">Hi to all,<br>
<br>
Any people know how to calculate the bounding box from lon/lat coordinates.<br>
<br>
An example:<br>
<br>
I have a point in -8.0572,42.4702 (lon/lan). I like a bounding box arround 1
mile of this site. Can use any SRS like EPSG:4230 or another.<br>
<br>
</span><span style="font-size: 11pt; color: black;" lang="EN-US">Any solution is \
accepted independent of language. I translate to my need. I hope develop in php \
mapscript, but the solution can made in any language…</span></p> 

<p><span style="font-size: 11pt; color: black;" lang="EN-US">  </span></p> 

<p><span style="font-size: 11pt; color: black;" lang="EN-US">Thanks for \
all,</span></p> 

<p><span style="font-size: 11pt; color: black;" lang="EN-US">Oscar.</span></p> 

<p>  </p> 

<p>  </p> 

<p><span style="font-size: 11pt;">  </span></p> 

</div>

</div></div></div></div></div><br>

      </div></blockquote></div><br>



_______________________________________________
mapserver-dev mailing list
mapserver-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic