PROJ4, PHP and projection of a single point
Assefa Yewondwossen
assefa at dmsolutions.ca
Thu Feb 22 11:12:59 PST 2001
Hi There,
I am assuming here that you use php/mapscript.
There is a php/proj module available in the mapserver distribution (.../mapserver/mapscript/php3/php_proj.c). This module give access to basic Proj4 fonctionalities. So in
your case you colud use the functions to convert the Georeferenced coordinated to Lat/Long coordinates.
Are you building mapserver/mapscrtipt yourself or do you download the binary versions ? Which platform are you on ? I am asking this so I could post the binary versions on our
download site.
Later,
PS :
Here is a little bit of docs on how to use it :
/*
* PHP PROJ4 Module
*
* This is a PHP module that gives acces to basic PROJ4 projection
* functionalities.
*
* There are four functions available in this module :
*
* 1) pj_init : create and initializes a projection structures
*
* PJ pj_init(array_of_parameters)
*
* Example : $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";
*
* $pj = pj_init($projarray);
*
* 2) pj_fwd : Performs a projection from lat/long coordinates to
* cartesian coordinates.
*
* retrun_array pj_fwd(double lat, double long, PJ pj)
*
* Example : $lat = 45.25;
* $long = -75.42;
*
* $ret = pj_fwd($ingeox, $ingeoy, $pj);
* printf("geo x = %f<br>\n", $ret["u"]);
* printf("geo y = %f<br>\n",$ret["v"]);
*
* 3) pj_inv : Performs a projection from cartesian coordinates to
* lat/long coordinates .
*
* retrun_array pj_fwd(double geox, double geoy, PJ pj)
*
* Example : $ingeox = 1537490.335842;
* $ingeoy = -181633.471555;
*
* $ret = pj_inv($ingeox, $ingeoy, $pj);
* printf("lat = %f<br>\n", $ret["u"]);
* printf("lon = %f<br>\n",$ret["v"]);
*
* 4) pj_free : frees PJ structure
*
* void pj_free(PJ pj);
*
**********************************************************************/
Stephen Lime wrote:
> The solution with MapScript and scripting languages is to use the proj4 modules written first by
> be and a better version was recently posted to the mailing list. Perhaps the folks at DMSolutions
> could dicuss how to create a php/proj module.
>
> Steve
>
> Stephen Lime
> Internet Applications Analyst
>
> Minnesota DNR
> 500 Lafayette Road
> St. Paul, MN 55155
> 651-297-2937
>
> >>> "Stein Runar Bergheim" <runar at bergheim.dk> 02/22/01 03:05AM >>>
> I am retreiving a set of points from a database, and am drawing them onto the image object of a map via a layer that is projected from lat/long to WGS84 coordinates.
>
> This is easy going, my problem occurs when I want to collect a pair of coordinates from the map, perform an inverse projection of them and use them to query the database...
>
> Is this possible or should I try some alternate approach...
>
> Regards
> SRB
--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst
Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/
Phone: (613) 565-5056
----------------------------------------------------------------
More information about the MapServer-users
mailing list