I'm no GIS expert and I hope I can explain my problem in English.

I have these polygons – and a border. Sometimes I need this exact definition of the polygons but if you want to have an overview map, it will look much better, if the polygons are expanded and there is no empty space between.

initial situation

My idea was to use a Voronoi diagram to fill the empty spaces. I cut to original the Voronoi diagram with polygons, then I cut every polygon that is outside the border. In this step, I had quite a lot problems but, after some tries I got a very good result by using the point on surface function to check if the polygon is outside the border.

merged new polygons

But I'm stuck in the next step – join the original polygons with the new created.

I try to use several PostGIS functions, sometimes combined. Base function that I used is st_union. I combined it with st_buffer and ST_SnapToGrid or st_simplyfiy and st_makevalid because I read that this gives good results.

But I have some of these errors in it (see picture) and as a result I need exact one polygon. Most of the results are multi-polygons.

I even try a PostGIStopology example, but I don’t get it working. I try to script something in PHP to merge/join the polygon.

Some of them even complex one are exactly what if want but a lot of them don’t find the correct next neighbor point and the direction of the line is wrong on some parts.

Then I try something else more drastic ^^ I use st_union to merge the polygons as good as possible. To get only one polygon filter all polygon by the area and only use the biggest one corresponding to the original polygons. That one often have some wired line on the surface. I export the polygon with st_astext and spilt then by the brackets inside and also use the biggest one. The result is okay in higher zoom level, but if you zoom in use the white not used space.

Do you have any other ideas? At the moment, I use QGIS to visualize the output and I see that QGIS has a lot of function that may be able to do what I want (but I don’t know if it’s scriptable even if it looks like it can do that).

Note: Sorry I have to delete some images, because I'm just allowed to link two images

  • Did you ever get this solved? It sounds like you needed to run a simple merge/ dissolve. – SeldomSeenSlim Jun 23 '17 at 19:02
  • no, not 100% - there were still some artefacts and empty spaces, but good enough for what i'm trying to do. – ich Jun 26 '17 at 20:16

First key question here is what you are trying to represent. You state that it would "look better" if there were no white space and the polygons are expanded, but in the context of the map you are making - why is this so?

The simplest way to fill that empty space in QGIS is to duplicate the border layer, symbolize with a solid fill and send below the polygon layer. If you want to expand your polygons, then maybe just using the buffer tool and clip to the border would be easier.

  • First goal was to use these expanded polygons to create an overview map with Mapnik based on a TileMill export – for that, the polygons are good enough expanded. So, goal achieved. But this feature would also nice to see in a web map. And there you can zoom in and then it looks not bad. A real problem: To be honest, no. The last and may be the most important point just for me is – I don’t understand why isn’t working, and how I merge that polygons. Because the idea should create a really good map and if I look at the data this should create a perfect result with no error – but it doesn’t. – ich Jan 3 '17 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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