[mapserver-users] Buffer features?

Lime, Steve D (DNR) Steve.Lime at state.mn.us
Tue Feb 15 15:59:25 EST 2011


MapServer queries, at least some of them, respect layer tolerances which effectively acts like a buffer. You can also take the result of your
buffering operation and use it in a queryByShape() operation. Make sure you set your layer tolerances appropriately (probably to 0) so that
you get features that intersect with the shape.

Steve

From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Bistrais, Bob
Sent: Tuesday, February 15, 2011 1:54 PM
To: Lime, Steve D (DNR)
Cc: mapserver-users
Subject: RE: [mapserver-users] Buffer features?

OK, that makes sense.  One more thing I'm not clear on- I can draw my buffer around the selected feature.  How can this buffer now be used to query another layer?  I guess it's similar to other queries, but how to select this buffer feature and use it as the input to the query?

________________________________
From: Lime, Steve D (DNR) [mailto:Steve.Lime at state.mn.us]
Sent: Tuesday, February 15, 2011 1:43 PM
To: Bistrais, Bob
Cc: mapserver-users
Subject: RE: [mapserver-users] Buffer features?

You'd need to use 3 different layers and change your code to create 3 different buffered shapes accordingly.

Steve

From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Bistrais, Bob
Sent: Tuesday, February 15, 2011 12:30 PM
To: Lime, Steve D (DNR)
Cc: mapserver-users
Subject: RE: [mapserver-users] Buffer features?

Not to make life more difficult, but is it possible to create a multi-ring buffer, basically 3 polygons at 3 different distances from a selected feature?

________________________________
From: Lime, Steve D (DNR) [mailto:Steve.Lime at state.mn.us]
Sent: Tuesday, February 15, 2011 12:22 PM
To: Tamas Szekeres
Cc: mapserver-users
Subject: RE: [mapserver-users] Buffer features?

Not quite, I'm thinking of a single layer setup:

LAYER
   DATA myfile.shp # or whatever connection information is necessary
  TYPE POLYGON
   STATUS DEFAULT
   NAME 'buffered_shapes'
   GEOMTRANSFORM (buffer([shape], 500))  # buffer each shape by 500 map units

   # classes and styles follow

   TEMPLATE 'void'
END

The GEOMTRANSFORM would be applied as shapes are pulled from a data source so you would draw or, potentially, query the transformed shapes. The difference between a layer-level GEOMTRANSFORM and a style-level one is the coordinates they operate on. Layer-level work would be done on a raw feature in map coordinates and style-level works on pixels. We do layer-level stuff already, conceptually, in the form of projections and clipping. The GEOMTRANSFORM just provides a way of extending that work...

Note this type of GEOMTRANSFORM expression is working for buffers in STYLEs in trunk (but using pixels for the moment).

Steve


From: Tamas Szekeres [mailto:szekerest at gmail.com]
Sent: Tuesday, February 15, 2011 11:12 AM
To: Lime, Steve D (DNR)
Cc: mapserver-users
Subject: Re: [mapserver-users] Buffer features?

Steve,

Did you mean to achieve something like?:

LAYER
     CONNECTIONTYPE TRANSFORM
     CONNECTION sourcelayer  # reference to another layer
     NAME transformlayer
     PROCESSING "TRANSFORM=(buffer([shape]))"
     TEMPLATE query.html
     ....
END
LAYER
     CONNECTIONTYPE SHAPE
     DATA myfile.shp
     NAME sourcelayer
     ....
END


Which is simple and easy to implement.

Best regards,

Tamas
2011/2/15 Lime, Steve D (DNR) <Steve.Lime at state.mn.us<mailto:Steve.Lime at state.mn.us>>
I'd approach RFC 22, especially the transform piece, differently now with the parser changes  implemented in 6.0. We now have (with GEOS enabled) an expression syntax available to support things like buffering, convex hull, differences, etc... or combinations thereof. I'd implement layer-level GEOMTRANSFORMs in that case using these expressions.

On the query result side of things I'd consider adding a layer template as a layer option. This would kinda work like the approach outlined for Bob. You'd define a presentation template layer (no DATA value) and run the query results through it instead of the regular layer (for certain querymap types, e.g. highlight).

Steve

From: mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org> [mailto:mapserver-users-bounces at lists.osgeo.org<mailto:mapserver-users-bounces at lists.osgeo.org>] On Behalf Of Tamas Szekeres
Sent: Tuesday, February 15, 2011 3:06 AM
To: Bistrais, Bob
Cc: mapserver-users
Subject: Re: [mapserver-users] Buffer features?

In accordance with the problem mentioned, I recall a resonable enhancement as described in RFC22a<http://www.mapserver.org/development/rfc/ms-rfc-22a.html> which would provide an option to configure all the stuff in the mapfile (not requiring MapScript) and would make it easier to customize the query maps as well.

With this enhancement 2 new layer data providers could be implemented, like:

1. CONNECTIONTYPE=QUERYRESULT would provide to represent the result sets of one layer in a new layer.
2. CONNECTIONTYPE=TRANSFORM would provide simple geometry transformations on a source layer and then provide the modified features as a new layer.

By chaining these layers together in a map configuration we could get such results<http://trac.osgeo.org/mapserver/attachment/ticket/2128/sample4.png> as included in the RFC document.

I consider this kind of enhancement could be implemented within the scope of 1-2 days of work (comparable with a fully elaborated MapScript solution providing the same)

Best regards,

Tamas
2011/2/14 Bistrais, Bob <Bob.Bistrais at maine.gov<mailto:Bob.Bistrais at maine.gov>>
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
mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/mapserver-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110215/0576c1dc/attachment-0001.html


More information about the mapserver-users mailing list