php and PROJ

Assefa Yewondwossen assefa at dmsolutions.ca
Wed Apr 11 11:10:07 EDT 2001


Hi There,

 Here is an answer posted earlier on the list:


 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 could use the functions to convert the Georeferenced
coordinated to Lat/Long
coordinates.

If you are on a Windows platform, You can download the binary versions at :

 http://www2.dmsolutions.ca/mapserver/dl/php4.0.4pl1_php_proj_dll.zip
 http://www2.dmsolutions.ca/mapserver/dl/php4.0.3_php_proj_dll.zip

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);
 *
 **********************************************************************/



Chad Streck wrote:

> Thanks everyone for the help in getting our demo up and running.  Its
> looking like we may be getting this job, which means that for a point
> file, I'll have to be dynamically creating lat/long points on the map
> that is projected in AZ-C.  I plan on placing the points on a blank
> geographic projected layer which will place the points in the correct
> position, but I'll need to be able to get the world coordinates of a
> click on the image in lat/long and not AZ-C.  Is there an easy way to do
> this with php_mapscript or a way to access the PROJ library directly
> from PHP other than system/exec?
>
> Thanks,
> Chad Streck

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