[Mapserver-users] ms_newprojectionObj - change from v3.6 to v4.0??

Debbie Pagurek pagurekd at agr.gc.ca
Wed Dec 17 14:57:56 EST 2003


This is a MIME message. If you are reading this text, you may want to 
consider changing to a mail reader or gateway that understands how to 
properly handle MIME multipart messages.

--=_5B058959.0362380F
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Paul, thanks for your help.  I now see the difference in the v3.6 code
and v4.0.
The documentation for the ProjectionObj Class on this page is incorrect
however.
http://mapserver.gis.umn.edu/doc40/phpmapscript-class-guide.html#proj
    $poPoint = $poPoint->project($projInObj, $projOutObj); 	

This is incorrect  - it should be just 
$poPoint->project($projInObj, $projOutObj); 

Perhaps someone could update that part of the documentation.
Thanks again for your help,
Debbie

>>> pagameba at magma.ca 12/16/03 10:34PM >>>
Debbie, from the php mapscript class reference, it looks like it returns

a result code instead of a new rectobj, and the projection is applied to

the actual rectobj rather than a copy.  So your code should read:

$newproj=ms_newprojectionObj( "proj=robin,lon_0=0,x_0=0,y_0=0" );
$latlon = ms_newprojectionObj (
                 "proj=longlat,ellps=GRS80,datum=NAD83,no_defs" );

$oRect= ms_newRectObj();
$oRect->setextent( $bounds[0], $bounds[1],
                    $bounds[2], $bounds[3] );
$oRect->project( $latlon,$newproj);  //the extent in
$map->setextent( $oRect->minx, $oRect->miny,
                  $oRect->maxx, $oRect->maxy );

Cheers,

Paul

Debbie Pagurek wrote:

> *  *Hi all,
> I am trying to get some code that worked with php_mapscript_36.so to 
> work with php_mapscript_40.so but am having problems.
>  
> This worked before:
>   $newproj=ms_newprojectionObj("proj=robin,lon_0=0,x_0=0,y_0=0");
>   $latlon =  
> ms_newprojectionObj("proj=longlat,ellps=GRS80,datum=NAD83,no_defs");
> 
>   $oldext= ms_newRectObj();
>   $oldext->setextent($bounds[0],$bounds[1],$bounds[2],$bounds[3]);  
> //the extent in latlong
> 
>   $newextproj = ms_newRectObj();
>   $newextproj = $oldext->project($latlon,$newproj);  //the extent in 
> Robinson
> 
>   
>
$map->setextent($newextproj->minx,$newextproj->miny,$newextproj->maxx,$newextproj->maxy);
> But now when I try to see the new map extents e.g.
> echo "new ext minx = ".$newextproj->minx;
> I'm getting nothing.
>  
> Has something else changed with Mapserver4 / php_mapscript_40.so?
> Can anyone give me any pointers?
>  
> Thanks in advance.
> D. Pagurek
>  

-- 
  -----------------------------------------------------------------
|Paul Spencer                           spencer at dmsolutions.ca    |
|-----------------------------------------------------------------|
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
  -----------------------------------------------------------------

--=_5B058959.0362380F
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Content-Description: HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY style="MARGIN-TOP: 2px; FONT: 10pt Arial; MARGIN-LEFT: 2px">
<DIV>Paul, thanks for your help.&nbsp; I now see the difference in the v3.6 code 
and v4.0.</DIV>
<DIV>The documentation for the ProjectionObj Class on this page is incorrect 
however.</DIV>
<DIV><A 
href="http://mapserver.gis.umn.edu/doc40/phpmapscript-class-guide.html#proj">http://mapserver.gis.umn.edu/doc40/phpmapscript-class-guide.html#proj</A></DIV>
<DIV>
<P>&nbsp;&nbsp;&nbsp; $poPoint = $poPoint-&gt;project($projInObj, 
$projOutObj);&nbsp;	<BR><BR>This is incorrect&nbsp; - it should be just </P>
<P>$poPoint-&gt;project($projInObj, $projOutObj);&nbsp;<BR><BR>Perhaps someone 
could update that part of the documentation.</P>
<P>Thanks again for your help,<BR>Debbie</P>
<P><BR>&gt;&gt;&gt; pagameba at magma.ca 12/16/03 10:34PM &gt;&gt;&gt;<BR>Debbie, 
from the php mapscript class reference, it looks like it returns <BR>a result 
code instead of a new rectobj, and the projection is applied to <BR>the actual 
rectobj rather than a copy.&nbsp; So your code should 
read:<BR><BR>$newproj=ms_newprojectionObj( "proj=robin,lon_0=0,x_0=0,y_0=0" 
);<BR>$latlon = ms_newprojectionObj 
(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"proj=longlat,ellps=GRS80,datum=NAD83,no_defs" );<BR><BR>$oRect= 
ms_newRectObj();<BR>$oRect-&gt;setextent( $bounds[0], 
$bounds[1],<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$bounds[2], $bounds[3] );<BR>$oRect-&gt;project( $latlon,$newproj);&nbsp; //the 
extent in<BR>$map-&gt;setextent( $oRect-&gt;minx, 
$oRect-&gt;miny,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$oRect-&gt;maxx, $oRect-&gt;maxy );<BR><BR>Cheers,<BR><BR>Paul<BR><BR>Debbie 
Pagurek wrote:<BR><BR>&gt; *&nbsp; *Hi all,<BR>&gt; I am trying to get some code 
that worked with php_mapscript_36.so to <BR>&gt; work with php_mapscript_40.so 
but am having problems.<BR>&gt;&nbsp; <BR>&gt; This worked 
before:<BR>&gt;&nbsp;&nbsp; 
$newproj=ms_newprojectionObj("proj=robin,lon_0=0,x_0=0,y_0=0");<BR>&gt;&nbsp;&nbsp; 
$latlon =&nbsp; <BR>&gt; 
ms_newprojectionObj("proj=longlat,ellps=GRS80,datum=NAD83,no_defs");<BR>&gt; 
<BR>&gt;&nbsp;&nbsp; $oldext= ms_newRectObj();<BR>&gt;&nbsp;&nbsp; 
$oldext-&gt;setextent($bounds[0],$bounds[1],$bounds[2],$bounds[3]);&nbsp; 
<BR>&gt; //the extent in latlong<BR>&gt; <BR>&gt;&nbsp;&nbsp; $newextproj = 
ms_newRectObj();<BR>&gt;&nbsp;&nbsp; $newextproj = 
$oldext-&gt;project($latlon,$newproj);&nbsp; //the extent in <BR>&gt; 
Robinson<BR>&gt; <BR>&gt;&nbsp;&nbsp; <BR>&gt; 
$map-&gt;setextent($newextproj-&gt;minx,$newextproj-&gt;miny,$newextproj-&gt;maxx,$newextproj-&gt;maxy);<BR>&gt; 
But now when I try to see the new map extents e.g.<BR>&gt; echo "new ext minx = 
".$newextproj-&gt;minx;<BR>&gt; I'm getting nothing.<BR>&gt;&nbsp; <BR>&gt; Has 
something else changed with Mapserver4 / php_mapscript_40.so?<BR>&gt; Can anyone 
give me any pointers?<BR>&gt;&nbsp; <BR>&gt; Thanks in advance.<BR>&gt; D. 
Pagurek<BR>&gt;&nbsp; <BR><BR>-- <BR>&nbsp; 
-----------------------------------------------------------------<BR>|Paul 
Spencer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
spencer at dmsolutions.ca&nbsp;&nbsp;&nbsp; 
|<BR>|-----------------------------------------------------------------|<BR>|Applications 
&amp; Software 
Development&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
|<BR>|DM Solutions Group 
Inc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<A href="http://www.dmsolutions.ca/|">http://www.dmsolutions.ca/|</A><BR>&nbsp; 
-----------------------------------------------------------------<BR><BR></P></DIV></BODY></HTML>

--=_5B058959.0362380F--



More information about the mapserver-users mailing list