GIS spatial functions in PHP?
There is a PHP module of Proj4 available in the MapServer/MapScript distribution. I think it is mantanied by DM Solutions, but I could not find any documentation online. To check the available functions, I had to look at the source code.
Anyway, this is how you can tranform coordinates between projections:
<?php //UTM zone 31N $projDefSrc = array("proj=utm","zone=31","ellps=intl","units=m","no_defs"); $pjSrc = pj_init($projDefSrc); //WGS84 $projDefDest = array("proj=longlat","ellps=WGS84","datum=WGS84","no_defs"); $pjDest = pj_init($projDefDest); $x = 446423; $y = 4610005; $test = pj_transform($pjSrc,$pjDest,$x,$y); //Outputs: Array ( [u] => 2.3567240656 [v] => 41.6384346565 ) print_r($test);?>
If you want to go this way, you will have to compile php_proj.c from the Mapserver source code folder (mapserver-X.X.X/mapscript/php3) and load the extension in PHP. As I said before, there is no documentation online, so let me know if you find any problems.
Hope this helps.
You can use the api proj4php that I have translated from proj4js and is available here : https://sourceforge.net/projects/proj4php/
It works great from WGS84 to Lambert93, but need some fix to work with the others projections. I can help.
Bye.
Can you run ArcGIS Server? ESRI has a new service called a Geometry service that lets you do geometry manipulation/conversion/etc through a variety of service interfaces.
You can find a sample version at http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer that you can test with.