ccrook / QGIS-Contour-Plugin

Contour plugin for QGIS - uses python matplotlib to generate contours of data on vector point data.
43 stars 13 forks source link

Gaps in filled contours #38

Open CoachGD opened 4 years ago

CoachGD commented 4 years ago

Comment from plugin maintainer

This is a frequently encountered issue. I think it mainly (exclusively) applies when the contouring is using triangulation. If the data appears to fall on a regular grid the plugin will contour using a grid rather than triangulation, which appears to work reliably.

The problem appears to be that matplotlib library generating the filled contours can create invalid geometries, particularly when the edges of the triangulated area are straight.

As yet I haven't developed a fix or workaround for this


I had generated a contour plot based on shape file point values, using N-equal-intervals with 18 intervals, other options set to automatic. I then decided to add a dummy point at a lower interval to give the contours sensible interval boundaries (the "set" option was not working).

When I then add again, the process appears to complete, However, the following results:

image

In addition, the scratch layer appears to be in "edit" mode. I cannot close the edit mode as there are commit errors (when selecting save):

image

I have tried reinstalling QGIS (now in 3.12.2), removing and reinstalling the plugin, copying and reimporting my shapefile, all with no success.

I have tried reducing the number of intervals to 10, and I still end up with areas missing from the image:

image

Please assist if you can! Is there a cache somewhere that needs clearing? I apologise in advance for my lack of coding knowledge and the very basic reporting of my issue!

ccrook commented 4 years ago

Hi @CoachGD I don't have an immediate answer unfortunately. Has the contour plugin worked for you before? Is it working with other datasets but not this one? Was it working before you installed 3.12? I haven't used 3.12 yet (in fact with my current work tasks I'm not using QGIS much at the moment) so it is possible some changes in QGIS don't suit the plugin. Sorry - lots of questions but it is difficult to pin down what the issues might be otherwise!

CoachGD commented 4 years ago

No problem, thanks for your prompt response!

  1. Yes, I have used the plugin quite a few times before.
  2. Yes, I have it working with other datasets.
  3. I upgraded to 3.12 to see if that fixed the issue but it did not. I had the same issue in 3.10.

I the same data but in metres (was mm) and in csv (was in shp), and have similar issues.

I have honed in something that may help (?!)

The issue presents itself with my csv data set when I am attempting for 12 contours: image with results the same as presented above.

However, if I change the contours to 11 (or 13) it appears to work fine! image

I can work with this for now, but I was intending on making all values below 0.01m transparent, hence wanting to use 12 contours as an interval at 0.01m is presented.

Any further thoughts? I really appreciate any help resolving this issue. Your tool is really fantastic for visualising the trends in my dataset in any case!

ccrook commented 4 years ago

Hi @CoachGD The blank bits do ring a bell with me now. This happens when it is creating triangulations based on gridded data. The issue happens at the edges of the grids. It should be fixed using the "Use grid based contouring" option, but this is only available if the plugin is able to interpret the data set as a grid. It only works with full rectangular grids (ie same number of columns in every row). Your data looks like a projected gridded data set.

If you could send the CSV file I could investigate further, but may be a while before I can do anything about it. \