<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
(Problem described on second parapraph.)<br><br>Alrighty...........it works! What's most exciting is that the problem that I eluded to in my last reply (the markers or points being off a few hundred yards in a circular pattern) has been fixed as a result of all your advice from earlier. I don't know if it was from me using a shapefile to describe the tile index or if it was from me adjusting lines 1 & 4 in the world file to correctly define the x and y map unit/pixel ratio. I'll play around with it and figure it out. I got it working last Friday right before I left work. Thanks a million!<br><br>Now - one minor issue. The markers that I'm placing all display and show up at the right spots, but they aren't displaying there transparent backgrounds. I'm using .png's, and always there's a black background being displayed. I've double checked in The GIMP and there's definitely no background. I noticed on the Mapscript API in the "Layers" class that there's a member called transparency and that it takes an int value. I know that a lot of the members that say int actually take a constant as defined in the constants section, but none of them work (MS_ON, MS_TRUE, MS_YES, MS_GD_ALPHA) and actual integers like -10 through 10 don't work either. I know the layer's type shouldn't be set to Raster. <br><br>Here's the code snippets and sections where I define my marker and the layer it is on:<br><br>//Location Marker Layer<br>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>
$markerLayer = ms_newLayerObj($map);<br>
$markerLayer->set(name, "Marker");<br>
$markerLayer->set(type, MS_LAYER_POINT);<br>
$markerLayer->set(status, MS_DEFAULT);<br>
//Location Marker layer class<br>
$markerclass = ms_newClassObj($markerLayer);<br>
//Location Marker layer class style<br>
$markerstyle = ms_newStyleObj($markerclass);<br>
//Sets the size of the marker. The bigger, the badder.......<br>
$markerstyle->set(size, 15);<br>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><br>and<br><br>$layer=$map->getLayerByName("Marker");<br>
$layer->status = MS_DEFAULT;<br>
//Loop creates marker points then populates them on the map<br>
for($i=0; $i<$markerCount; $i++){<br>
//Creates a point so the marker can be drawn<br>
$marker[$i] = ms_newPointObj();<br>
//Sets that marker according to respective x,y's<br>
$marker[$i]->setXY($mx[$i], $my[$i]);<br>
//Gives the location of the symbol to place as a marker<br>
$markerstyle->set(symbolname, "data/statesp020/$mi[$i]");<br>
//Draws the point using the map, layer Marker, and the image generated, and the only class it has (Index 0)<br>
$marker[$i]->draw($map, $layer, $image, 0, "");<br>
}<br><br>Here's the rest of my php (with the code above in it):<br><br><?php<br>//Takes the $_GET array's and keys and sets them to another array <br>$keys = array_keys($_GET);<br>//This loop will find all values that have a name lat, lon, and mi (marker icon) and set them to their own array<br>foreach($keys as $curvar){<br> if((substr($curvar, 0, 3))=="lat"){<br> $my[] = $_GET[$curvar];<br> }<br> if((substr($curvar, 0, 3))=="lon"){<br> $mx[] = $_GET[$curvar];<br> }<br> if((substr($curvar, 0, 2))=="mi"){<br> $mi[] = $_GET[$curvar];<br> }<br>}<br><br>//The count of how many points were entered in<br>$markerCount = count($mx);<br><br>//echo "<br>The marker count is: $markerCount<br>";<br><br>//Map pic width, height parameters<br>//////////////////////////////////////////////////////////////////////////<br>$mapwidth = $_GET['width'];<br>$mapheight = $_GET['height'];<br><br>//New point object for Zooming<br>$centerpoint = ms_newPointObj();<br>//Taking the center points of the image<br>$centerX = $mapwidth/2;<br>$centerY = $mapheight/2;<br>$centerpoint->setXY($centerX, $centerY);<br>//////////////////////////////////////////////////////////////////////////<br><br>//The zoompoint and zoomscale parameters<br>//////////////////////////////////////////////////////////////////////////<br>//$zoompoint = $_GET['zoompoint']; ZOOMPOINT ZOOMS IN ON A PIXEL<br>$zoomscale = $_GET['zoomscale'];<br>//////////////////////////////////////////////////////////////////////////<br><br>//Center Coordinates passed will be in decimal degrees<br>//////////////////////////////////////////////////////////////////////////<br>$x = $_GET['lon1'];<br>$y = $_GET['lat1'];<br><br>//Create a new recObj with dd extents<br>$extent = ms_newRectObj();<br><br>//Set those extents<br>$extent->setextent($x-.002, $y-.002, $x+.002, $y+.002);<br><br>//Set the newly adjusted extent variables<br>$x1 = $extent->minx;<br>$y1 = $extent->miny;<br>$x2 = $extent->maxx;<br>$y2 = $extent->maxy;<br><br>//Upper left and lower right coordinates<br>//$ULx = $x1;<br>//$ULy = $y2;<br>//$LRx = $x2;<br>//$LRy = $y1;<br>//////////////////////////////////////////////////////////////////////////<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><br>//The Map Itself<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>//The mapfile path and map file itself<br>$map_path = "/var/www/mapserver/campuscomber/";<br>$map_file = "indexAlt.map";<br>$map = ms_newMapObj($map_path.$map_file);<br><br>//The size of the window set by mapserver<br>$map->setSize($mapwidth, $mapheight);<br><br>//The name of the map<br>$map->set(name, "US Universities");<br><br>$app = $_GET['app'];<br>//The type of image produced depending if request comes from Wap, Kiwi, or Webcomber<br><br>if($app=="app"){<br> $map->selectOutputFormat("GIF");<br> //Sets the output format type<br> $map->outputformat->setOption(name, "gif");<br> $map->outputformat->setOption(driver, "GD/GIF");<br> $map->outputformat->setOption(mimetype, "image/gif");<br> $map->outputformat->setOption(imagemode, MS_IMAGEMODE_RGB);<br> $map->outputformat->setOption(extension, "gif");<br>}<br>if($app=="kiwi" || $app=="web"){<br> $map->selectOutputFormat("PNG");<br><br> //Sets the output format type<br> $map->outputformat->setOption(name, "png");<br> $map->outputformat->setOption(driver, "GD/PNG");<br> $map->outputformat->setOption(mimetype, "image/png");<br> $map->outputformat->setOption(imagemode, MS_IMAGEMODE_PC256);<br> $map->outputformat->setOption(extension, "png");<br>}<br><br>//The color of the background<br>$map->imagecolor->setRGB(140, 140, 140);<br><br>//Tells where the US Shapefile info and images are located<br>$map->set(shapepath, "/var/www/mapserver/campuscomber/data/statesp020/");<br>//Sets the map projection lat/lon<br>$map->setProjection("+proj=latlong +ellps=GRS80 +datum=NAD83");<br>//sets the EXTENT<br>$map->setExtent($x1, $y1, $x2, $y2);<br><br>$map->set(units, MS_DD);<br>$map->set(debug, MS_ON);<br><br>//Web Object which specifies the image path and the image url for the image Maperver generates<br>$map->web->set(imagepath, "/var/www/mapserver/campuscomber/images/");<br>$map->web->set(imageurl, "/mapserver/campuscomber/images/");<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><br>//United States layer<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>$us = ms_newLayerObj($map);<br>$us->set(name, "US state polygons");<br>$us->set(type, MS_LAYER_POLYGON);<br>$us->set(status, MS_DEFAULT);<br>$us->set(data, "statesp020");<br>//United States layer class<br>$usclass = ms_newClassObj($us);<br>//United States layer class style<br>$usstyle = ms_newStyleObj($usclass);<br>$usstyle->color->setRGB(240, 230, 140);<br>$usstyle->set(symbol, 0);<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><br>//US Boundaries Layer<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>$usbounds = ms_newLayerObj($map);<br>$usbounds->set(name, "US state boundaries");<br>$usbounds->set(type, MS_LAYER_LINE);<br>$usbounds->set(status, MS_DEFAULT);<br>$usbounds->set(data, "statesp020");<br>//US Boundaries layer class<br>$usboundsclass = ms_newClassObj($usbounds);<br>//US Boundaries layer class style<br>$usboundsstyle = ms_newStyleObj($usboundsclass);<br>$usboundsstyle->color->setRGB(50, 50, 50);<br>$usboundsstyle->set(size, 3);<br>$usboundsstyle->set(symbol, 0);$usboundsstyle->set(symbol, 0);<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><br>//University Map Layer (Actually, I don't think we even need this layer - but ehhh, who knows?)<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>$university = ms_newLayerObj($map);<br>$university->set(name, "University of Illinois");<br>$university->set(type, MS_LAYER_RASTER);<br>$university->set(status, MS_OFF);<br>$university->set(data, "UofICampusMapAlt.gif");<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><br>//Tiled University Map Layer<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>$universityTiles = ms_newLayerObj($map);<br>$universityTiles->set(name, "University of Illinois Tiles");<br>$universityTiles->set(type, MS_LAYER_RASTER);<br>$universityTiles->set(status, MS_DEFAULT);<br>$universityTiles->set(tileindex, "u_of_ill.shp");<br>$universityTiles->set(tileitem, "Location");<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><br>//Location Marker Layer<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>$markerLayer = ms_newLayerObj($map);<br>$markerLayer->set(name, "Marker");<br>$markerLayer->set(type, MS_LAYER_POINT);<br>$markerLayer->set(status, MS_DEFAULT);<br>//Location Marker layer class<br>$markerclass = ms_newClassObj($markerLayer);<br>//Location Marker layer class style<br>$markerstyle = ms_newStyleObj($markerclass);<br>//Sets the size of the marker. The bigger, the badder.......<br>$markerstyle->set(size, 15);<br>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br><br>//$map->zoompoint(1, $centerpoint, $mapwidth, $mapheight, $extent);<br>//Sets the zoom scale for zooming in and out<br>$map->zoomscale($zoomscale, $centerpoint, $mapwidth, $mapheight, $extent);<br>//Draws the image<br>$image=$map->draw();<br>//Gets the Marker Layer<br>$layer=$map->getLayerByName("Marker");<br>$layer->status = MS_DEFAULT;<br>//Loop creates marker points then populates them on the map<br>for($i=0; $i<$markerCount; $i++){<br> //Creates a point so the marker can be drawn<br> $marker[$i] = ms_newPointObj();<br> //Sets that marker according to respective x,y's<br> $marker[$i]->setXY($mx[$i], $my[$i]);<br> //Gives the location of the symbol to place as a marker<br> $markerstyle->set(symbolname, "data/statesp020/$mi[$i]");<br> //Draws the point using the map, layer Marker, and the image generated, and the only class it has (Index 0)<br> $marker[$i]->draw($map, $layer, $image, 0, "");<br>}<br>//Produces a url to reference the image by<br>$image_url=$image->saveWebImage();<br>echo $image_url."<br>";<br>?><br><html><br> <head><br> <title>Mapserver "University of Illinois"</title><br> </head><br> <body><br> <img src="<?php echo $image_url?>"><br> </body><br></html><br><br /><hr />Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! <a href='http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us' target='_new'>Try it!</a></body>
</html>