<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml@01C6B62E.37F1C460">
<title>Normal</title>
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:DoNotShowRevisions/>
<w:DoNotPrintRevisions/>
<w:DoNotShowMarkup/>
<w:EnvelopeVis/>
<w:PunctuationKerning/>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;
text-underline:single;}
span.EmailStyle17
{mso-style-type:personal;
mso-style-noshow:yes;
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;
font-family:Arial;
mso-ascii-font-family:Arial;
mso-hansi-font-family:Arial;
mso-bidi-font-family:Arial;
color:windowtext;}
span.EmailStyle18
{mso-style-type:personal-reply;
mso-style-noshow:yes;
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;
font-family:Arial;
mso-ascii-font-family:Arial;
mso-hansi-font-family:Arial;
mso-bidi-font-family:Arial;
color:navy;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:35.4pt;
mso-footer-margin:35.4pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple style='tab-interval:36.0pt'>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Hi!<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I am working on an application where I need to translate
screen pixel xy coordinates to latlon. The basic mapserver template variables seem
to give me the correct result, I can replicate that result with cs2cs but have
so far not been able to get that out of the mapscript php project function. Any
pointers would be greatly appreciated.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I have a very simple mapfile with following projection spec
and no projection in the layers:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'>PROJECTION<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"proj=tmerc"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"lat_0=49.000000000"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"lon_0=-2.000000000"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"k=0.999601"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"x_0=400000.000"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"y_0=-100000.000"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"ellps=airy"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span></span></font><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>"towgs84=375,-111,431,0,0,0,0"<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>END<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>When I use the mapserver application to find the latlon for:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'>x : </span></font><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'>533604.343541<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>y: 180566.045573<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>The mapserver template MAPLAT, MAPLON variables return:<o:p></o:p></span></font></p>
<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial;font-weight:bold;
mso-bidi-font-weight:normal'>Lat: -0.076218<o:p></o:p></span></font></b></p>
<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial;font-weight:bold;
mso-bidi-font-weight:normal'>Lon: 51.508185<o:p></o:p></span></font></b></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Which, when I look them up on MapQuest put me on the right
spot.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>When I use the command line proj4 applications I get
following results:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>invproj<span style='mso-spacerun:yes'> </span>-f
"%.6f" +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000
+y_0=-100000 +ellps=airy +towgs84=375,-111,431,0,0,0,0 <<EOF<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>> 533604.343541 180566.045573<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>> EOF<o:p></o:p></span></font></p>
<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial;font-weight:bold;
mso-bidi-font-weight:normal'>Lat: -0.074626<span
style='mso-spacerun:yes'> </span><o:p></o:p></span></font></b></p>
<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial;font-weight:bold;
mso-bidi-font-weight:normal'>Lon: 51.507727<o:p></o:p></span></font></b></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Which is not exactly the same point.<o:p></o:p></span></font></p>
<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial;font-weight:bold;
mso-bidi-font-weight:normal'><o:p> </o:p></span></font></b></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>When I use the cs2cs command I get following result:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>cs2cs<span style='mso-spacerun:yes'> </span>-f
"%.6f" +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000
+y_0=-100000 +ellps=airy +towgs84=375,-111,431,0,0,0,0 +to +proj=latlong
+ellps=WGS84 +datum=WGS84 <<EOF<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>> 533604.343541 180566.045573<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>> EOF<o:p></o:p></span></font></p>
<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial;font-weight:bold;
mso-bidi-font-weight:normal'>Lat: -0.076218<span
style='mso-spacerun:yes'> </span><o:p></o:p></span></font></b></p>
<p class=MsoNormal><b style='mso-bidi-font-weight:normal'><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial;font-weight:bold;
mso-bidi-font-weight:normal'>Lon: 51.508185</span></font></b><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'> 45.074824<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Which is what I would like to find<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>When I use Mapscript PHP:<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><span style='mso-spacerun:yes'>
</span>$projInObj = ms_newProjectionObj( "proj=tmerc,".<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><span style='mso-spacerun:yes'> </span></span></font><font
size=2 face=Arial><span lang=FR style='font-size:10.0pt;font-family:Arial;
mso-ansi-language:FR'>"lat_0=49,".<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"lon_0=-2,".<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"k=0.999601,".<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"x_0=400000,".<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"y_0=-100000,".<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"ellps=airy,".<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>"towgs84=375,-111,431,0,0,0,0");<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span>$projOutObj = ms_newProjectionObj("proj=latlong,<span
style='mso-spacerun:yes'> </span>ellps=WGS84, datum=WGS84");<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span lang=FR style='font-size:10.0pt;
font-family:Arial;mso-ansi-language:FR'><span style='mso-spacerun:yes'>
</span></span></font><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>$poPoint = ms_newPointObj();<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><span style='mso-spacerun:yes'>
</span>$poPoint->setXY($_REQUEST["lon"],$_REQUEST["lat"]);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><span style='mso-spacerun:yes'> </span><span
style='mso-spacerun:yes'> </span>$poPoint->project($projInObj,
$projOutObj);<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I get: <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Lat: <b style='mso-bidi-font-weight:normal'><span
style='font-weight:bold;mso-bidi-font-weight:normal'>-0.074619464992752</span></b>
<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Lon: <b style='mso-bidi-font-weight:normal'><span
style='font-weight:bold;mso-bidi-font-weight:normal'>51.505774438372</span></b><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Which is close but still about 1km out of where it should
land.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial;mso-no-proof:yes'>Sven Borgers.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html>