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

Debbie Pagurek pagurekd at agr.gc.ca
Wed Dec 17 11:57:56 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.

--=_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.  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>    $poPoint = $poPoint->project($projInObj, 
$projOutObj); 	<BR><BR>This is incorrect  - it should be just </P>
<P>$poPoint->project($projInObj, $projOutObj); <BR><BR>Perhaps someone 
could update that part of the documentation.</P>
<P>Thanks again for your help,<BR>Debbie</P>
<P><BR>>>> pagameba at magma.ca 12/16/03 10:34PM >>><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.  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>                 
"proj=longlat,ellps=GRS80,datum=NAD83,no_defs" );<BR><BR>$oRect= 
ms_newRectObj();<BR>$oRect->setextent( $bounds[0], 
$bounds[1],<BR>                    
$bounds[2], $bounds[3] );<BR>$oRect->project( $latlon,$newproj);  //the 
extent in<BR>$map->setextent( $oRect->minx, 
$oRect->miny,<BR>                  
$oRect->maxx, $oRect->maxy );<BR><BR>Cheers,<BR><BR>Paul<BR><BR>Debbie 
Pagurek wrote:<BR><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>> 
$map->setextent($newextproj->minx,$newextproj->miny,$newextproj->maxx,$newextproj->maxy);<BR>> 
But now when I try to see the new map extents e.g.<BR>> echo "new ext minx = 
".$newextproj->minx;<BR>> I'm getting nothing.<BR>>  <BR>> Has 
something else changed with Mapserver4 / php_mapscript_40.so?<BR>> Can anyone 
give me any pointers?<BR>>  <BR>> Thanks in advance.<BR>> D. 
Pagurek<BR>>  <BR><BR>-- <BR>  
-----------------------------------------------------------------<BR>|Paul 
Spencer                           
spencer at dmsolutions.ca    
|<BR>|-----------------------------------------------------------------|<BR>|Applications 
& Software 
Development                              
|<BR>|DM Solutions Group 
Inc                 
<A href="http://www.dmsolutions.ca/|">http://www.dmsolutions.ca/|</A><BR>  
-----------------------------------------------------------------<BR><BR></P></DIV></BODY></HTML>

--=_5B058959.0362380F--



More information about the MapServer-users mailing list