[mapserver-users] Calculate Bounding Box...
Julien-Samuel Lacroix
jlacroix at mapgears.com
Thu Mar 12 07:57:21 PDT 2009
Hi,
Probably not totally exact, but enough for most people:
Miles per degree (latitude): 69
Miles per degree (Longitude): 69 * (cos(LATITUDE * PI / 180))
Julien
PS: Set of PHP functions from Chameleon
http://chameleon.maptools.org/
/**
* Number of KM in a MILE
* there are 5280 feet in a mile : start with 5280
* there are 12 inches in a foot : multiple by 12
* there are 0.0254 meters in an inch : multiple by 0.0254
* there are 1000 meters in a kilometer : divide by 1000
*/
define( "KM_PER_MILE", (5280 * 12 * 0.0254 / 1000) );
/**
* Constant returns miles per degree of latitude which is 69.
*/
define( "MilesPerDegreeLat", 69 );
define( "DegreesLatPerMile", (1 / 69.0) );
/**
* function LonToLatRatio
*
* Given a latitude in decimal degrees, it will return the ratio of
* longitude degress to latitude degrees.
*/
function LonToLatRatio ($latitude)
{
return cos($latitude * M_PI / 180);
}
/**
* MilesPerDegreeLon($latitude)
*
* Given a latitude in decimal degrees, it will return the
* miles per degree of longitude.
*/
function MilesPerDegreeLon ($latitude)
{
return 69 * LonToLatRatio($latitude);
}
/**
* DegreesLonPerMile($latitude)
*
* Given a latitude in decimal degrees, it will return the
* degrees of longitude per mile.
*/
function DegreesLonPerMile ($latitude)
{
return 1 / MilesPerDegreeLon( $latitude );
}
Oscar Fdez. wrote:
> Thanks for your answer.
>
> ¿Exist any formule to calculate the left/top lon/lan corner and the
> right/bottom corner of Bounding Box dinamic from a lon/lan point?
>
> Regards, Oscar.
>
> 2009/3/12 Gregor at HostGIS <gregor at hostgis.com <mailto:gregor at hostgis.com>>
>
> 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.
>
>
> Hit up spatialreference.org <http://spatialreference.org>
> You can look up a SRS, then move a point over a map to get
> conversions. Very handy.
>
>
>
> --
> HostGIS, Open Source solutions for the global GIS community
> Greg Allensworth - SysAdmin, Programmer, GIS Person, Security
> Network+ Server+ A+ Security+
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
--
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/
More information about the MapServer-users
mailing list