You have a couple of options. Shapes (and points) have a draw method but I 
think it's kind
hard to use in the context of a full map draw. I think it's easier to add the 
shape as an
inline feature to an existing layer.

So, in your mapfile you'd define a layer used to present the buffered feature. 
It wouldn't
have a DATA value nor any inline features defined. Something like:

# Layer to draw a buffered feature using a big, red outline.
LAYER
  NAME 'buffered_feature'
  TYPE POLYGON
  STATUS OFF
  CLASS
    STYLE OUTLINECOLOR 255 0 0 WIDTH 5 END
  END
END

Then (off the top of my head) in your code (e.g. Perl) you'd have:

# Ok, you have a selected, buffered feature...

# Now, add the feature to an existing layer...
$layer = $map->getLayerByName('buffered_feature');
$layer->{status} = $mapscript::MS_ON;
$layer->addFeature($bShape);

# And finally draw the map
$img = $map->draw();

The nice thing about this approach is that the map draw is one step and the 
buffered feature
can be handled just like any layer.

Steve

-----Original Message-----
From: Bistrais, Bob [mailto:[email protected]] 
Sent: Monday, February 14, 2011 2:10 PM
To: Lime, Steve D (DNR); mapserver-users
Subject: RE: Buffer features?

OK, I can select the shape through query, put in the distance, not sure
what to do next (drawing the buffered shape)

-----Original Message-----
From: Lime, Steve D (DNR) [mailto:[email protected]] 
Sent: Monday, February 14, 2011 9:40 AM
To: Bistrais, Bob; mapserver-users
Subject: RE: Buffer features?

It should be as simple as:

# do the query and get the selected shape

$bDistance = 5; # in layer units
$bShape = $shape->buffer($bDistance);

# now draw the buffered shape

Does that help or is the before/after parts that is confusing.

Steve

________________________________________
From: Bistrais, Bob [[email protected]]
Sent: Monday, February 14, 2011 8:36 AM
To: Lime, Steve D (DNR); mapserver-users
Subject: RE: Buffer features?

I am working in MapScript.  I've got some ideas but haven't quite
figured it out.  Are there any code examples available?

-----Original Message-----
From: Lime, Steve D (DNR) [mailto:[email protected]]
Sent: Monday, February 14, 2011 9:32 AM
To: Bistrais, Bob; mapserver-users
Subject: RE: Buffer features?

Unless you're working in MapScript you'll have to wait for the 6.0
release (maybe). 6.0 contains some support for buffering (in pixels)
using the GEOMTRANSFORM style attribute although this is mainly a
cartographic tool. In MapScript you can do this now though.

Steve
________________________________________
From: [email protected]
[[email protected]] On Behalf Of Bistrais, Bob
[[email protected]]
Sent: Monday, February 14, 2011 8:30 AM
To: mapserver-users
Subject: [mapserver-users] Buffer features?

This question may have come up before, but I haven't found it in the
archives.  I would like to take a selected feature and buffer it to a
specified distance.  I know it's possible to do a queryByPoint with a
buffer distance, but I need to create an actual buffer shape to display
on the map.  Has anyone done something like this before?  Does MapServer
have this capability?





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

Reply via email to