Thanks for the reply Nicol. That looks simple enough. My initial test gave me this error message:<b><br><br>Fatal error</b>: [MapServer Error]: msProcessProjection(): projection not named
in <b>/var/www/home/newlands/www_nc3d_com/temp/kml2mxs.php</b> on line <b>4<br></b><br><div class="gmail_quote">I did some googling and found some suggested modifications that fixed it:<br><br><?PHP<br>dl('php_mapscript.so');<br>
$projInObj = ms_newprojectionobj('proj=latlong');<br>$projOutObj = ms_newprojectionobj('init=epsg:2269');<br>$poPoint = ms_newpointobj();<br>$poPoint->setXY(-122.667591, 45.522973);<br>$poPoint->project($projInObj, $projOutObj);<br>
print_r($poPoint);<br>?><br><br>It looks like the projectionstring "EPSG:####" does not work (at least it does not work with the version in the latest Ubuntu package php5-mapscript_4.10.3-1_amd64.deb). I had to make the "epsg" lower case and prepend an "init=". But I now have a functioning projection routine and I'm now off to write an XML routine to process KML files. What fun!<br>
<br>Thanks!<br>-Ray<br><br>On Sat, Jun 28, 2008 at 2:40 AM, Nicol Hermann <<a href="mailto:mapserver@geoworld.de">mapserver@geoworld.de</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ray,<br>
<br>
dl('../bin/php_mapscript.so');<br>
$projInObj = ms_newprojectionobj('EPSG:4326');<br>
$projOutObj = ms_newprojectionobj('EPSG:31466');<br>
$poPoint = ms_newpointobj();<br>
$poPoint->setXY(8.43, 50.4);<br>
$poPoint->project($projInObj, $projOutObj);<br>
<br>
print_r($poPoint);<br>
<br>
<br>
HTH<br>
Nicol<br>
<br>
<br>
Am Donnerstag, den 26.06.2008, 08:03 -0700 schrieb Ray Collett:<br>
<div><div></div><div class="Wj3C7c">> Hello all,<br>
> I need to project UTM coordinates into stateplane, but I have no<br>
> need for drawing graphical maps. My output is to be a script that<br>
> will be imported into another application. I have found the<br>
> Geo::Proj4 for PERL, and I have a functioning skeleton program that is<br>
> properly translating coordinates, but I'm not that familar with PERL<br>
> and I'm spending 10x the time trying to do what I want as opposed to<br>
> PHP which I know very well. I'm looking for the same functionality in<br>
> PHP, but having a hard time finding it. I just discovered<br>
> PHP/MapScript, and I hope that it can do what I need, but so far I<br>
> have not found any samples that I can learn from. I have PHP/MapScript<br>
> installed and working, It's drawing maps and processing shp files.<br>
><br>
> Here's a sample of the PERL code that I am using:<br>
><br>
> ====================================<br>
> #!/usr/bin/perl<br>
> use Geo::Proj4;<br>
> my $proj = Geo::Proj4->new(init => "epsg:2269") or die;<br>
> my($lon, $lat) = (-122.667591, 45.522973);<br>
> my @newLatLon = $proj->forward($lat, $lon);<br>
> print "x:", $newLatLon[0]," y:", $newLatLon[1],"\n";<br>
> ====================================<br>
><br>
> When run, it returns: x:7646617.87276814 y:684215.14079164<br>
><br>
> Is there a way to do this in PHP? Is MapScript the way to go, or is<br>
> there another project that I have not yet found that could do it for<br>
> me? Any assistance is much appreciated!<br>
><br>
> -Ray<br>
</div></div>> _______________________________________________<br>
> mapserver-users mailing list<br>
> <a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>=======================================<br>--==-- Ray Collett --==--<br>Technical Director; Newlands & Co. Inc.<br>503.287.8000 x520 <a href="mailto:3dlover@gmail.com">3dlover@gmail.com</a><br>
<a href="http://www.nc3d.com">www.nc3d.com</a> <a href="http://www.norwesters.org">www.norwesters.org</a><br>=======================================