[mapserver-users] Any examples of coordinate conversion web pages
Assefa Yewondwossen
assefa at dmsolutions.ca
Wed Mar 27 12:25:02 PST 2002
Are yo using php ? If this is the case there is a module provided with
php/mapscript (php_proj.dll/so) that you can use to do the conversion. The
module basically gives you access to some functions of the Proj4 projection
library used by mapserver. Here is an example of usage transforming from lcc
to latlong:
Later,
<?php
if (PHP_OS == "WINNT" || PHP_OS == "WIN32")
{
dl("php_proj.dll");
}
else
{
dl("php_proj.so");
}
$projarray[0] = "proj=lcc";
$projarray[1] = "ellps=GRS80";
$projarray[2] = "lat_0=49";
$projarray[3] = "lon_0=-95";
$projarray[4] = "lat_1=49";
$projarray[5] = "lat_2=77";
$projarray[6] = "";
$pjlcc = pj_init($projarray);
$projarray2[0] = "proj=latlong";
$pjlat = pj_init($projarray2);
$lat = 45.25;
$long = -75.42;
$ingeox = 1537490.335842;
$ingeoy = -181633.471555;
$ret = pj_transform($pjlcc, $pjlat, $ingeox, $ingeoy);
printf("ret x = %f<br>\n", $ret["u"]);
printf("ret y = %f<br>\n",$ret["v"]);
$ret = pj_transform($pjlat, $pjlcc, $long, $lat);
printf("ret x = %f<br>\n", $ret["u"]);
printf("ret y = %f<br>\n",$ret["v"]);
pj_free($pj);
?>
Tyler Mitchell wrote:
> Hi gang, I want to put together a simple web page that allows a user to
> enter lat/long and/or UTM coordinates and have them converted one to
> another. Is anyone doing this already? If you are willing to share some
> of the info with me, it would save me from reinventing the wheel. ;)
--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst
Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/
Phone: (613) 565-5056
Fax: (613) 565-0925
----------------------------------------------------------------
More information about the MapServer-users
mailing list