I figured it out. It was actually pretty easy. For reference to others who might need to do this also, I'll post my methodology. I also have one outstanding question at the end...

Mapscript snippet looks like this:

// Make a new point object
$cnty_layer = $map->getLayerByName('cnty');
$my_point = ms_newpointObj();
$my_point->setXY($lon,$lat);

// Run a point query on the county layer.
// layer must have a class with a LAYER TEMPLATE value
if ($cnty_layer->queryByPoint($my_point,MS_SINGLE,1)==MS_SUCCESS){
   $cnty_result = $cnty_layer->getResult(0);  // Get the result
   $cnty_layer->open();    // Open layer for use with getShape()

$cnty_shape=$cnty_layer->getShape($cnty_result->tileindex,$cnty_result->shapeindex);

   // Draw the shape onto the shaded county layer
   $cnty_shade = $map->getLayerByName('shade_red');
   $cnty_shape->draw($map, $cnty_shade, $image);
}


Mapfile snippet that goes along with the above looks like this:

LAYER
   NAME shade_red
   TYPE POLYGON
   STATUS ON
   TRANSPARENCY 50   # use OPACITY in mapserver v5
   CLASS
        NAME "Red County"
        COLOR 187 0 0
   END
END


Notice the transparency in the layer above. I'm still on mapserver 4.x. The problem is that the layer doesn't draw with any transparency, no matter what I put as the value. Any ideas?

Mark


Mark Brooks wrote:
I have a shapefile of type polygon of all counties in the United States. Given a latitude/longitude point, I want to shade/hatch the county that it's in. I'm not sure of the best way to do this. Any suggestions? I'm working with PHP Mapscript by the way.

Mark
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to