[mapserver-users] Any examples of coordinate conversion web pages

Assefa Yewondwossen assefa at dmsolutions.ca
Thu Mar 28 14:02:27 EST 2002


Hi There,

 You can set yourslef the PROJ_LIB environnment variable to any directory where you
have your proj files.

 This variable can also be set at build time. So depending on the build it could be
diffrent.
 If you are on Windows and downloaded the php_proj.dll from our downloadsite, the
PROJ_LIB should be set to point tp c:/proj.

Later,

Mark Giesbrecht wrote:

> Hi There,
>
> I'm trying to follow your example below, but I get the following error when I run
> it:
>
> Fatal error: Object expected as argument. in
> e:\software\apache\htdocs\tmp\writeshaperectangle.php on line 40
>
> my line 40 is:
>
> $ret = pj_transform($pjlcc, $pjlat, $ingeox, $ingeoy);
>
> I had read in the previous listing about the PROJ_LIB variable, but I'm not sure
> where it points to.
>
> Any pointers?
>
> Cheers,
>
> Mark
>
> Assefa Yewondwossen wrote:
>
> > 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
> > ----------------------------------------------------------------

--
----------------------------------------------------------------
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