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

Debbie Pagurek pagurekd at agr.gc.ca
Wed Dec 17 06:10:25 PST 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.  Was also having problems due to the extents 
that I had set in my mapfile, but that's another story.</DIV>
<DIV> </DIV>
<DIV>Is this change in the projection function something that should be in the 
Migration Guide?</DIV>
<DIV> </DIV>
<DIV>Debbie</DIV>
<DIV><BR><BR>>>> Daniel Morissette <morissette at dmsolutions.ca> 
12/16/03 05:05PM >>><BR>Debbie Pagurek wrote:<BR>> *  *Hi 
all,<BR>> I am trying to get some code that worked with php_mapscript_36.so 
to <BR>> work with php_mapscript_40.so but am having problems.<BR>>  
<BR>> This worked before:<BR>>   
$newproj=ms_newprojectionObj("proj=robin,lon_0=0,x_0=0,y_0=0");<BR>>   
$latlon =  <BR>> 
ms_newprojectionObj("proj=longlat,ellps=GRS80,datum=NAD83,no_defs");<BR>> 
<BR>>   $oldext= ms_newRectObj();<BR>>   
$oldext->setextent($bounds[0],$bounds[1],$bounds[2],$bounds[3]);  
<BR>> //the extent in latlong<BR>> <BR>>   $newextproj = 
ms_newRectObj();<BR>>   $newextproj = 
$oldext->project($latlon,$newproj);  //the extent in <BR>> 
Robinson<BR>> <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><long_story><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></long_story><BR><BR>Daniel<BR>-- 
<BR>------------------------------------------------------------<BR>  
Daniel 
Morissette               
morissette at dmsolutions.ca<BR>  DM Solutions 
Group              
<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