center lat long
Gregor Mosheh
stigmata_blackangel at YAHOO.COM
Sun Apr 3 09:36:31 PDT 2005
--- joerg pfeiffer <superbla3000 at GMX.NET> wrote:
> I have a lat long coordinate and would like to
> center this with php mapscript.
Step 1: Find the coords of the center.
$center_x = ($map->extent[0] + $map->extent[2]) /2
$center_y = ($map->extent[1] + $map->extent[3]) /2
Step 2: Convert to latlong, if you're not already
using latlong.
$projInObj =
ms_newprojectionobj($map->getProjection());
$projOutObj =
ms_newprojectionobj("init=epsg:4269");
$poPoint = ms_newpointobj();
$poPoint->setXY($x, $y);
$poPoint->project($projInObj, $projOutObj);
$x = $poPoint->x;
$y = $poPoint->y;
Step 3: Now call whatever JavaScript or PHP/MS thing
you use to set extents and draw your map.
__________________________________
Do you Yahoo!?
Yahoo! Personals - Better first dates. More second dates.
http://personals.yahoo.com
More information about the MapServer-users
mailing list