[Mapserver-users] map drop shadow effect

Dan Barron dbarron at ddive.com
Wed Feb 26 14:15:14 EST 2003


>You could automate the process with mapscript if there are many polygons.

This would be wonderful.  I tried using the Image Object function 
pasteImage() to draw to the shadow image,then past the main image on top of 
that.  I could not get the two images to offset so one was just an overlay 
on top of the other.  Anyone know if this function can be used (or not) to 
create the drop shadow effect?

I did come up with a way to do it when producing two images - one for the 
main map image and another for the shadow effect image.  See the example 
files below.  But I would prefer to create a single image.  Any other ideas?

Thanks!

Dan


The following files will create a simple drop shadow effect.

 >>>PHP FILE<<<

<?php

$mapPath="c:/bin/jboss-tomcat/tomcat/webapps/mapserver/";
$mapFile="florida.map";

$map = ms_newMapObj($mapPath.$mapFile);
$image=$map->draw();

$mapFile="florida-shadow.map";

$mapS = ms_newMapObj($mapPath.$mapFile);
$imageS=$mapS->draw();

$image_url_PNG=$image->saveWebImage(MS_PNG,1,1,0);
$imageS_url_PNG=$imageS->saveWebImage(MS_PNG,1,1,0);

$image->free();

?>

<table summary="">
   <tr style="background-color: #99ccff;" >
     <td background="<?php echo $imageS_url_PNG?>">
       <img src="<?php echo $image_url_PNG?>" border="0" alt="">
     </td>
   </tr>
</table>

 >>>MAP FILE<<<

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# florida.map
# dbarron at ddive.com - dsllc - 2/26/03
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

name mapNavigator-Florida
size 720 360
status ON
extent -85.0 22.0 -80.0 33.0
units DD
shapepath "mapserver-data"
imagetype PNG
transparent on

PROJECTION
  "proj=latlong"
  "ellps=GRS80"
END

WEB
   imagepath "c:/bin/jboss-tomcat/tomcat/webapps/tmp/"
   imageurl "/tmp/"
END

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# LAYER: Florida
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LAYER
     name 'Florida'
     type POLYGON
                 status ON
                 data 'north_america/usa/fl/ponet_poly_poly'
           minscale 1000000
     CLASS
                   OUTLINECOLOR 150 150 150
       COLOR 255 255 204
     END
END

END #~~~MapObject

 >>>DROP SHADOW EFFECT MAP FILE<<<
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# florida-shadow.map
# dbarron at ddive.com - dsllc - 2/26/03
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

name mapNavigator-Florida
size 720 360
status ON
extent -85.14 22.13 -80.14 33.13
units DD
shapepath "mapserver-data"
imagetype PNG
transparent on

PROJECTION
  "proj=latlong"
  "ellps=GRS80"
END

WEB
   imagepath "c:/bin/jboss-tomcat/tomcat/webapps/tmp/"
   imageurl "/tmp/"
END

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# LAYER: Florida
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LAYER
     name 'Florida'
     type POLYGON
                 status ON
                 data 'north_america/usa/fl/ponet_poly_poly'
           minscale 1000000
     transparency 90
     CLASS
       COLOR 102 153 204
     END
END

END #~~~MapObject





More information about the mapserver-users mailing list