<!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> </DIV>
<DIV><FONT face=Arial size=2>We hope to liven up our backgrounds using
Mapserver output from either the perl interface or using shp2img. At
this time we are trying to figure out how to map a world coordinates
(lat/long) to pixel coordinates (from Perl). I can create a background
image with Perl Mapserver and save it to a png file then to be loaded back
in w/ GD::newFromPng(). What Information do I need in order to
translate from World (lat/long) to a pixel coordinate? Is this
something that can be done w/in the Perl Mapserver interface? Has anyone
gone through this and can provide some direction?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </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. I've seen some references to a Perl interface to Proj.4 but
could not retrieve the files. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any help of ideas would be greatly
appreciated!</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2> Ken</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>$map_path = <Path>/my.map";<BR>$amap = new
mapObj( "$map_path );</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2># ---------------------------- Set the image w/h
</FONT></DIV>
<DIV><FONT face=Arial size=2>$amap->{width} = 200;<BR>$amap->{height} =
100;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2># ------------------------------ Create my extent
(Arizona) </FONT></DIV>
<DIV><FONT face=Arial size=2>$myExtent = new rectObj();<BR>$myExtent->{maxx}
= -111.35;<BR>$myExtent->{minx} = -112.97;<BR>$myExtent->{maxy} =
33.62;<BR>$myExtent->{miny} = 33.19;<BR>$amap->{extent} =
$myExtent;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2># ----------------------------- Draw the
maps<BR>$image =
$amap->draw(); <BR>
<BR># ----------------------------- Save the bitmap <BR>$image_url =
$image->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->newFromPng(
"/tmp/test.png" );</DIV></FONT>
<DIV><FONT face=Arial size=2></FONT> </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> </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.
</FONT></DIV></BODY></HTML>