<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY 
style="WORD-WRAP: break-word; khtml-nbsp-mode: space; khtml-line-break: after-white-space">
<DIV dir=ltr align=left><SPAN class=357264007-24082006><FONT face=Arial 
color=#0000ff size=2>Hi Stefan,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=357264007-24082006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=357264007-24082006><FONT face=Arial 
color=#0000ff size=2>Yes, you do have to specify which projection each layer is 
in, otherwise when they are reprojected you will run into trouble (if it doesn't 
know where to reproject FROM,&nbsp;it won't be able to do i). It's not too hard, 
though. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=357264007-24082006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN><FONT face=Arial color=#0000ff 
size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=357264007-24082006><FONT face=Arial 
color=#0000ff size=2>You should not have to recalculate the extent; it should be 
automatic. Definitely don't try to change the numbers (coordinates)&nbsp;without 
changing the projection (that would be bad).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=357264007-24082006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=357264007-24082006><FONT face=Arial 
color=#0000ff size=2>Try this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=357264007-24082006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN 
class=357264007-24082006>$newproj="proj=robin,lon_0=0,x_0=0,y_0=0"; // 
projection string of your new projection</DIV>
<DIV dir=ltr align=left>
<DIV>$map-&gt;<SPAN 
class=357264007-24082006>setProjection($newproj,MS_TRUE);</SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=357264007-24082006>I 
think that ought to be all.&nbsp;&nbsp;The MS_TRUE makes it pick the best fit to 
the current extent in the new projection. Make sure your projection string is 
valid.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=357264007-24082006></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=357264007-24082006>regards,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=357264007-24082006></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=357264007-24082006>Jacob</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN 
class=357264007-24082006></SPAN></FONT></SPAN>&nbsp;</DIV></DIV>
<DIV dir=ltr align=left><SPAN class=357264007-24082006><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV><BR>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> UMN MapServer Users List 
  [mailto:MAPSERVER-USERS@LISTS.UMN.EDU] <B>On Behalf Of </B>Stefan 
  Schwarzer<BR><B>Sent:</B> 24 August 2006 15:35<BR><B>To:</B> 
  MAPSERVER-USERS@LISTS.UMN.EDU<BR><B>Subject:</B> Re: [UMN_MAPSERVER-USERS] 
  Mapscript Re-Projection on-the-fly<BR></FONT><BR></DIV>
  <DIV></DIV>Jacob &amp; Nicol,
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>thanks for your feedback.</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>But I am still struggling. Just to clarify: I wonna reproject not 
  individual layers, but my whole map.</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>Jacob, does "<SPAN class=010195305-24082006><FONT class=Apple-style-span 
  face=Arial color=#0000ff size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 10px">For this, it is required that your layer has a 
  projection object with the native projection of that layer.</SPAN></FONT>" 
  that mean that for each single layer I have to specify the original 
  projection? (Geographic in my case)</SPAN></DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>As Nicol stated I need to "recalculate" the extent, at least when using 
  different units (going from DD to Meters).&nbsp;</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>But then, I found that piece of code (slightly changed):</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV><SPAN class=Apple-tab-span 
  style="WHITE-SPACE: pre"></SPAN>$newproj=ms_newprojectionObj("proj=robin,lon_0=0,x_0=0,y_0=0");</DIV>
  <DIV><SPAN class=Apple-tab-span 
  style="WHITE-SPACE: pre"></SPAN>$latlon=ms_newprojectionObj("proj=longlat,ellps=WGS84,datum=WGS84,no_defs");</DIV>
  <DIV><SPAN class=Apple-tab-span 
  style="WHITE-SPACE: pre"></SPAN>$oldext=ms_newRectObj();</DIV>
  <DIV><SPAN class=Apple-tab-span 
  style="WHITE-SPACE: pre"></SPAN>$oldext-&gt;setextent(-180,-90,180,90);&nbsp; 
  //this is the extent of my map in geographic</DIV>
  <DIV><SPAN class=Apple-tab-span 
  style="WHITE-SPACE: pre"></SPAN>$oldext-&gt;project($latlon,$newproj);&nbsp; 
  //reproject to Robinson</DIV>
  <DIV><SPAN class=Apple-tab-span 
  style="WHITE-SPACE: pre"></SPAN>$map-&gt;setextent($oldext-&gt;minx,$oldext-&gt;miny,$oldext-&gt;maxx,$oldext-&gt;maxy);&nbsp; 
  //set the new map extent</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>And another one going like this:</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>$projInObj = 
  ms_newProjectionObj( "+proj=tmerc ".</DIV>
  <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>&nbsp; 
  "+lat_0=49 ".</DIV>
  <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>&nbsp; 
  "+lon_0=-2 ".</DIV>
  <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>&nbsp; 
  "+k=0.999601 ".</DIV>
  <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>&nbsp; 
  "+x_0=400000 ".</DIV>
  <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>&nbsp; 
  "+y_0=-100000 ".</DIV>
  <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>&nbsp; 
  "+ellps=airy ".</DIV>
  <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>&nbsp; 
  "+towgs84=375,-111,431,0,0,0,0");</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>with this info in the mapscript documentation...</DIV>
  <DIV style="MARGIN: 0px; BACKGROUND-COLOR: rgb(229,229,229)"><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px"><SPAN class=Apple-tab-span 
  style="WHITE-SPACE: pre"></SPAN>&nbsp;</SPAN></FONT><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">int setProjection(string proj_params, boolean 
  bSetUnitsAndExtents)</SPAN></FONT></DIV>
  <DIV style="MARGIN: 0px; BACKGROUND-COLOR: rgb(229,229,229)"><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">&nbsp; &nbsp; &nbsp; &nbsp; </SPAN></FONT><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">Set map projection and coordinate 
  system.</SPAN></FONT><FONT class=Apple-style-span face=Monaco size=2><SPAN 
  class=Apple-style-span style="FONT-SIZE: 9px">&nbsp; </SPAN></FONT><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">Parameters are given as</SPAN></FONT><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">&nbsp;</SPAN></FONT></DIV>
  <DIV style="MARGIN: 0px; BACKGROUND-COLOR: rgb(229,229,229)"><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">&nbsp; &nbsp; &nbsp; &nbsp; </SPAN></FONT><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">a single string of comma-delimited PROJ.4 
  parameters.</SPAN></FONT></DIV>
  <DIV style="MARGIN: 0px; BACKGROUND-COLOR: rgb(229,229,229)"><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">&nbsp; &nbsp; &nbsp; &nbsp; </SPAN></FONT><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">The argument : bSetUnitsAndExtents is used to 
  automatically update</SPAN></FONT></DIV>
  <DIV style="MARGIN: 0px; BACKGROUND-COLOR: rgb(229,229,229)"><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">&nbsp; &nbsp; &nbsp; &nbsp; </SPAN></FONT><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">the map units and extents based on the new projection. 
  Possible</SPAN></FONT><FONT class=Apple-style-span face=Monaco size=2><SPAN 
  class=Apple-style-span style="FONT-SIZE: 9px">&nbsp;</SPAN></FONT></DIV>
  <DIV style="MARGIN: 0px; BACKGROUND-COLOR: rgb(229,229,229)"><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">&nbsp; &nbsp; &nbsp; &nbsp; </SPAN></FONT><FONT 
  class=Apple-style-span face=Monaco size=2><SPAN class=Apple-style-span 
  style="FONT-SIZE: 9px">values are MS_TRUE and MS_FALSE. By defualt it is set 
  at MS_FALSE</SPAN></FONT></DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>So, what should I use? And where is coming the&nbsp;<SPAN 
  class=Apple-tab-span style="WHITE-SPACE: pre"> </SPAN></DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>$map -&gt; 
  setProjection</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>into play?</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>Thanks for any clarification.</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV>Stefan</DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV><BR class=khtml-block-placeholder></DIV>
  <DIV><BR>
  <DIV>
  <DIV>On Aug 24, 2006, at 7:59 AM, Delfos, Jacob wrote:</DIV><BR 
  class=Apple-interchange-newline>
  <BLOCKQUOTE type="cite">
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2>Stefan,</FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2>Your question is not entirely clear. You can not 
    re-project an individual&nbsp;layer on-the-fly, because php_mapscript does 
    not re-write the dataset (hence its projection will always be the same); you 
    CAN however change the projection of the map (using setProjection, as you 
    did), which means all layers in the map get re-projected (the dataset 
    remains unchanged, though). For this, it is required that your layer has a 
    projection object with the native projection of that layer. This will cause 
    the layer to be reprojected along with the map. Is this what you are trying 
    to do?&nbsp;</FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2>You *may* have to save your mapfile, or your session, 
    in order for it to take effect, depending on your setup.</FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2>regards,</FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2>Jacob</FONT></SPAN></DIV>
    <DIV dir=ltr align=left><SPAN class=010195305-24082006><FONT face=Arial 
    color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV><BR>
    <BLOCKQUOTE dir=ltr 
    style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
      <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
      <HR tabIndex=-1>
      <FONT face=Tahoma size=2><B>From:</B> UMN MapServer Users List [<A 
      href="mailto:MAPSERVER-USERS@LISTS.UMN.EDU">mailto:MAPSERVER-USERS@LISTS.UMN.EDU</A>] 
      <B>On Behalf Of </B>Stefan Schwarzer<BR><B>Sent:</B> 24 August 2006 
      13:45<BR><B>To:</B> <A 
      href="mailto:MAPSERVER-USERS@LISTS.UMN.EDU">MAPSERVER-USERS@LISTS.UMN.EDU</A><BR><B>Subject:</B> 
      Re: [UMN_MAPSERVER-USERS] Mapscript Re-Projection 
      on-the-fly<BR></FONT><BR></DIV>
      <DIV></DIV>Hey, 
      <DIV><BR class=khtml-block-placeholder></DIV>
      <DIV>I can't imagine that such a question stays unanswered in the 
      mapserver community...</DIV>
      <DIV><BR class=khtml-block-placeholder></DIV>
      <DIV>I meanwhile added a:</DIV>
      <DIV><BR class=khtml-block-placeholder></DIV>
      <DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>$map -&gt; 
      setProjection("init=epsg:26711");</DIV>
      <DIV><BR class=khtml-block-placeholder></DIV>
      <DIV>to my code, but nothing happens - meaning: no error message but no 
      reprojection either.</DIV>
      <DIV><BR class=khtml-block-placeholder></DIV>
      <DIV>Can anyone help me out?</DIV>
      <DIV><BR class=khtml-block-placeholder></DIV>
      <DIV>Thanks in advance.</DIV>
      <DIV><BR class=khtml-block-placeholder></DIV>
      <DIV>Stefan</DIV>
      <DIV><BR class=khtml-block-placeholder></DIV>
      <DIV><BR>
      <DIV>
      <DIV>On Aug 22, 2006, at 10:47 AM, Stefan Schwarzer wrote:</DIV><BR 
      class=Apple-interchange-newline>
      <BLOCKQUOTE type="cite"><FONT class=Apple-style-span 
        face=Arial>Gush,</FONT> 
        <DIV><FONT class=Apple-style-span face=Arial><BR 
        class=khtml-block-placeholder></FONT></DIV>
        <DIV><FONT class=Apple-style-span face=Arial>I couldn't find any precise 
        information about how to re-project layers on-the-fly via PHP Mapscript. 
        Here and there (via MailingList and Google) bits and pieces, but 
        altogether it didn't help me a lot. Though I would have said that this 
        is a basic question. But perhaps too basic, so everbody finds out by 
        himself?</FONT></DIV>
        <DIV><FONT class=Apple-style-span face=Arial><BR 
        class=khtml-block-placeholder></FONT></DIV>
        <DIV><FONT class=Apple-style-span face=Arial>So, can anyone let me know 
        - giving a coding example - how to re-project a mapfile on-the-fly from 
        for example Lat/Long (global view) to Lambert or 
        Robin?&nbsp;</FONT></DIV>
        <DIV><FONT class=Apple-style-span face=Arial><BR 
        class=khtml-block-placeholder></FONT></DIV>
        <DIV><FONT class=Apple-style-span face=Arial>Thanks a lot for your 
        help!</FONT></DIV>
        <DIV><FONT class=Apple-style-span face=Arial><BR 
        class=khtml-block-placeholder></FONT></DIV>
        <DIV><BR 
    class=khtml-block-placeholder></DIV></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE></BLOCKQUOTE></DIV><BR></DIV></BLOCKQUOTE></BODY></HTML>