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

Mark Giesbrecht mgiesbrecht@geoarctic.com
Thu, 28 Mar 2002 11:34:25 -0700


This is a multi-part message in MIME format.
--------------E4DDC2B7A781B455FF3A3886
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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@dmsolutions.ca
> http://www.dmsolutions.ca/
>
> Phone: (613) 565-5056
> Fax:   (613) 565-0925
> ----------------------------------------------------------------

--------------E4DDC2B7A781B455FF3A3886
Content-Type: text/x-vcard; charset=us-ascii;
 name="mgiesbrecht.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Mark Giesbrecht
Content-Disposition: attachment;
 filename="mgiesbrecht.vcf"

begin:vcard 
n:Giesbrecht;Mark
tel;fax:403-264-5848
tel;work:403-290-1320 ext25
x-mozilla-html:TRUE
url:http://www.geoarctic.com
org:GeoArctic International Services, Ltd.
adr:;;#1250 815 8 Ave SW;Calgary;Alberta;T2P 3P2;Canada
version:2.1
email;internet:mgiesbrecht@geoarctic.com
title:GIS Programmer/Analyst
fn:Mark Giesbrecht, M.Sc.
end:vcard

--------------E4DDC2B7A781B455FF3A3886--