Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a postgis table with polygon geometries.

I would like to create an sld which first does an inside buffer, and then a difference between the buffer and the original geometry.

This is basically like cutting a hole out of the polygon....ie first buffer (say...50 meters) and then cut this buffered polygon out of the original polygon.

I can´t seem to get my head around the syntax of using the sld filter explained here

http://docs.geoserver.org/stable/en/user/filter/function_reference.html

<Intersects>
<PropertyName>GEOMETRY</PropertyName>
<Literal>
<gml:Point>
<gml:coordinates>1 1</gml:coordinates>
</gml:Point>
</Literal>
</Intersects>

This is an intersect function which only displays the points which intersect 1,1. I guess a DIFFERENCE function with a buffer would have to be somehow nested...but I don´t know if this is possible.

If anyone can help. i´d be really grateful,

yours, Rob

share|improve this question
    
You mean you would like to subtract the original polygon to create a donut effect of sorts? Or you want an island in the middle? –  CaptDragon Feb 28 '12 at 19:31
    
Could you please provide us with some illustrations? –  CaptDragon Feb 28 '12 at 19:39
    
So you want: difference( buffer(p), p) which returns the points that are in buffer(p) and not in p ??? –  EricSonaron Feb 28 '12 at 20:21
add comment

2 Answers

up vote 0 down vote accepted

Try this,

<PolygonSymbolizer>
          <Geometry>
        <ogc:Function name="difference">    
          <ogc:PropertyName>geom</ogc:PropertyName>
          <ogc:Function name="buffer">
            <ogc:PropertyName>geom</ogc:PropertyName>
            <ogc:Literal>-50</ogc:Literal>
          </ogc:Function>
          </ogc:Function>
          </Geometry>
          <Fill>
          <CssParameter name="fill">#894465</CssParameter>
          <CssParameter name="fill-opacity">0.5</CssParameter>  
        </Fill>
      </PolygonSymbolizer>

It works in geoserver 2.7-SNAPSHOT (rev 38562)

share|improve this answer
    
Works a treat.....and so simple too! thanks a lot for trying it out for me! –  Robert Buckley Mar 23 '12 at 19:22
add comment

Sorry for not supplying enough info.

A donut is exactly what I am after. I have to create a symbol for a polygon geometry. This sumbol is made up of a thin outline and a thick band which is inside the polygon (150m width). I have tried to create this using sld but without success. I really don´t want to have to create new geometries in order to symbolize one polygon theme which is why i´m asking if this is possible using just an sld file and one postgis table.

You can take a look at the screenshot here...

http://maps.zgb.de/rrop/sld_img/screenshot-band.png

This was achieved using a buffered polygon and not using an SLD filter function

cheers,

Rob

share|improve this answer
    
Robert - you should edit your question with this information not add it as an answer. –  iant Feb 29 '12 at 11:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.