<!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.2600.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>We hope to liven up our&nbsp;backgrounds using 
Mapserver output from either the perl interface or using&nbsp;shp2img.&nbsp; At 
this time&nbsp;we&nbsp;are trying to figure out how to map a world coordinates 
(lat/long) to pixel coordinates (from Perl).&nbsp; I can create a background 
image with&nbsp;Perl Mapserver and save it to a png file then to be loaded back 
in w/ GD::newFromPng().&nbsp;&nbsp;What Information do I need in order to 
translate from&nbsp;World (lat/long) to a pixel coordinate?&nbsp; Is this 
something that can be done w/in the Perl Mapserver interface?&nbsp; Has anyone 
gone through this and can provide some direction?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>From searching through the Mapserver archives it 
seems that the "true" Extent needs to be found and that a projection needs to 
take place.&nbsp; I've seen some references to a Perl interface to Proj.4 but 
could not retrieve the files.&nbsp; </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Any help of ideas would be greatly 
appreciated!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; Ken</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>$map_path = &lt;Path&gt;/my.map";<BR>$amap = new 
mapObj( "$map_path );</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2># ---------------------------- Set the image w/h 
</FONT></DIV>
<DIV><FONT face=Arial size=2>$amap-&gt;{width} = 200;<BR>$amap-&gt;{height} = 
100;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2># ------------------------------ Create my extent 
(Arizona)&nbsp;</FONT></DIV>
<DIV><FONT face=Arial size=2>$myExtent = new rectObj();<BR>$myExtent-&gt;{maxx} 
= -111.35;<BR>$myExtent-&gt;{minx} = -112.97;<BR>$myExtent-&gt;{maxy} = 
33.62;<BR>$myExtent-&gt;{miny} = 33.19;<BR>$amap-&gt;{extent} = 
$myExtent;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2># ----------------------------- Draw the 
maps<BR>$image = 
$amap-&gt;draw();&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;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR># ----------------------------- Save the bitmap <BR>$image_url = 
$image-&gt;saveImage( "/tmp/test.png", $mapscript::MS_PNG, 1, 1, 95 
);<BR></FONT></DIV>
<DIV><FONT face=Arial size=2># ----------------------------- Get the image file 
to a GD image</FONT></DIV>
<DIV><FONT face=Arial size=2>my $backGroundImage = GD::Image-&gt;newFromPng( 
"/tmp/test.png" );</DIV></FONT>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2># ---------------------------- Want try draw some 
stuff on the image</FONT></DIV>
<DIV><FONT face=Arial size=2>my ( $vx, $vy ) = TranslateToViewport( ... 
)</FONT></DIV>
<DIV><FONT face=Arial size=2># Draw my stuff at/around pt ( $vx, $vy 
)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>If I'm understanding it correctly Mapserver is 
using a projection and the extent is altered as well.&nbsp; 
</FONT></DIV></BODY></HTML>