10

I’m facing this issue: I have a chloropleth map based on a set of polygons with some data. Using WFS-T (postgis, geoserver, openlayers) I am able to edit the geometry of the polygons. This works fine.

My polygons look like state borders. They have shared border vertices. When I edit the geometry of some polygon (e.g., move vertices using modifyFeature), I need to affect the geometry of any neighboring polygon. There shouldn’t be holes or overlaps.

Is it possible to do it?

Thanks

1
  • Probably ;) I don't believe OpenLayers supports anything like this out of the box, but it would be implementable. You could represent each border with a linestring, and modify the linestrings. Then, when the linestring gets updated, you update the two (or more) polygons which touch at the border, removing the old border and inserting the new one.
    – canisrufus
    Commented Aug 5, 2011 at 13:27

3 Answers 3

5

I know that this question is 3 years old, but I think it will help future people reading this subject.

You can find an OpenLayers implementation of topology here: http://dev.openlayers.org/sandbox/bjornharrtell/eventbasedtopology2/examples/topology.html

2

Only clues, don't think OpenLayers is able to do it. Most open source Desktop GIS are not able to do snapping on a line of differents vertex so doing this online seems for me a dream.

For simple geometry, the snapping can be enough http://openlayers.org/dev/examples/snapping.html Not enough mature, I hope https://github.com/bjornharrtell/jsts will be a way to do intersection (and indirecly solve your problem) on client side before sending back content. For the moment, I will think more about processing after drawing using PostGIS triggers for this and send back corrected draws. Topology implementation in PostGIS may help http://www.postgresql-sessions.org/2/sandro_santilli_-_topology_with_postgis_2.0 Always on server side, see possibilities of WPS maybe http://community.esdi-humboldt.eu/documents/show/4

0

With the @Sébastien BATEZAT answer above, I tried to solve my problem. But the answer was using an older version of openlayers (openlayers-2). So I found a method when I was searching through latest version of OpenLayers v6.5.0. There is a method for Draw and Modify Features. It can create LineStrings and Polygons. When we edit the geometry of some polygons, it affect the geometry of other neighboring polygons.

This one is for LineStrings

For LineStrings

This one is for Polygons

For Polygons

Hope this helps someone in the future! :)

2
  • 1
    Thanks, that's exactly what I wanted... unfortunately 10 years ago :)
    – volda
    Commented Jul 23, 2021 at 8:36
  • You are welcome @volda. Probably this will help someone in the future :) Commented Jul 24, 2021 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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