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

Debbie Pagurek pagurekd at agr.gc.ca
Wed Dec 17 09:10:25 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.

--=_114FC3C5.67065FCC
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

OK - Thanks Daniel and Paul.
My code is working again.  Was also having problems due to the extents
that I had set in my mapfile, but that's another story.

Is this change in the projection function something that should be in
the Migration Guide?

Debbie


>>> Daniel Morissette <morissette at dmsolutions.ca> 12/16/03 05:05PM >>>
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
> 

The project() method has changed for all object types in version 4.0. 
It operates directly on the object and returns MS_SUCCESS/MS_FAILURE.

<long_story>
This had to be changed because of a bug in the old project() method: it 
used to modify the original object internally without updating the PHP 
wrappers, plus the returned object used to invalidate the original 
object so you could end up with crashes if the PHP variable referring to

the original object was deleted or modified.
</long_story>

Daniel
-- 
------------------------------------------------------------
  Daniel Morissette               morissette at dmsolutions.ca
  DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------

--=_114FC3C5.67065FCC
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>OK - Thanks Daniel and Paul.</DIV>
<DIV>My code is working again.&nbsp; Was also having problems due to the extents 
that I had set in my mapfile, but that's another story.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Is this change in the projection function something that should be in the 
Migration Guide?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Debbie</DIV>
<DIV><BR><BR>&gt;&gt;&gt; Daniel Morissette &lt;morissette at dmsolutions.ca&gt; 
12/16/03 05:05PM &gt;&gt;&gt;<BR>Debbie Pagurek wrote:<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><BR>The project() method has changed for all object types 
in version 4.0. <BR>It operates directly on the object and returns 
MS_SUCCESS/MS_FAILURE.<BR><BR>&lt;long_story&gt;<BR>This had to be changed 
because of a bug in the old project() method: it <BR>used to modify the original 
object internally without updating the PHP <BR>wrappers, plus the returned 
object used to invalidate the original <BR>object so you could end up with 
crashes if the PHP variable referring to <BR>the original object was deleted or 
modified.<BR>&lt;/long_story&gt;<BR><BR>Daniel<BR>-- 
<BR>------------------------------------------------------------<BR>&nbsp; 
Daniel 
Morissette&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
morissette at dmsolutions.ca<BR>&nbsp; DM Solutions 
Group&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>------------------------------------------------------------<BR><BR></DIV></BODY></HTML>

--=_114FC3C5.67065FCC--



More information about the mapserver-users mailing list