ccrook / QGIS-Contour-Plugin

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

Contour is not filling at larger scales #16

Closed skorasaurus closed 2 years ago

skorasaurus commented 8 years ago

Hi,

I'm running qgis 2.14.0 on ubuntu; python 2.7.6;

I'm using the contour plugin on a 26k point geojson file.

After running the contour plugin on the file, the contours all display properly at a small scales (1:70,000). However, when I zoom into a larger scale, many of the contours are not displayed.

I've attached a couple screenshots as an example. selection_043 selection_042

Let me know if you'd like any other information.

Here's the python log from qgis: https://gist.github.com/skorasaurus/e806d576c9141eb677ad

ccrook commented 8 years ago

Hi

Once the contours are created they are just standard memory layers. So the display of them is nothing to do with the plugin - that is just QGIS displaying a memory layer. Which makes it odd that they don't display at some scales.

It would be interesting to save them to another format, for example GML or shapefile, and then see whether the issue persists (right click on layer in layers dialog, then save as..)

Cheers Chris

skorasaurus commented 8 years ago

Hi Chris,

Thanks for the help. When I tried to save it as a layer as a SHP or GML, I receive this error:

Export to vector file failed. Error: Feature write errors: Invalid variant type for field walking_time_min[1]: received PyQt_PyObject with type Invalid variant type for field walking_time_min[1]: received PyQt_PyObject with type Invalid variant type for field walking_time_min[1]: received PyQt_PyObject with type Invalid variant type for field walking_time_min[1]: received PyQt_PyObject with type Invalid variant type for field walking_time_min[1]: received PyQt_PyObject with type Invalid variant type for field walking_time_min[1]: received PyQt_PyObject with type Only 0 of 6 features written.

ccrook commented 8 years ago

That is odd indeed! Are you able to create a test data set I could use to debug this? And the settings you are using in the contour plugin. That would be great - thanks

skorasaurus commented 8 years ago

Yes!

I reproduced this again with my test data set which is a bbox extraction of my original data set. Data is available here as a geojson gist gist My settings for contour creation: selection_046

and my settings for saving as a vector layer selection_047

Let me know if there's anything else that I can do to help.

ccrook commented 8 years ago

That's great - I've been able to reproduce the saving issue (even though I'm currently using QGIS 2.8). I'll get back to you on this shortly!

I'm not yet sure whether this relates to the original display issue. One thing I noticed was a warning in the python log about:

DuplicatePointWarning: Input data contains duplicate x,y points; some values are ignored.

It could be worth ticking the "Apply point thinning" option in the contour dialog to see if it makes any difference. I tried this and still get the issue with saving the layer. As yet I've not seen the display issue so I don't know if this is affected or not.

ccrook commented 8 years ago

Hi

I've uploaded a new version, 1.3.6, which should fix the saving issue. I don't think this will fix your original issue with displaying though. So.. would be great if you can set up a test data set for that too! (or if you have that issue with the current test data set, can you provide details as to how to view it, maybe a zipped up project and a saved bookmark for the offending view).

Thanks for providing the test data set for saving.

skorasaurus commented 8 years ago

Yes, the new version, 1.3.6, fixed the saving issue. In case you're still interested, the display issue is still occurring.

To reproduce:

ccrook commented 8 years ago

Yes interested - and have now been able to replicate. I've just installed QGIS 2.14 and it is very apparent from in that. However also showing in earlier versions of QGIS. Exported the contour layer to GML and .CSV, and failed in both. Also noticed that the objects that don't displayed in some views also not selectable, so clearly there is some error in the definition of their extents. Will look in detail at the geometry to see whether the geometry definition is invalid (contour plugin error) or QGIS is handling it incorrectly. Great to have this example. Thanks.

ccrook commented 8 years ago

Further ... have established that the geometry generated by matplotlib are not valid. Will give some consideration to how to convert to valid geometry. Using simple .buffer(0.0) did not work - resulting geometry was valid but did not include most of area supposed to be in contour.

skorasaurus commented 8 years ago

Yes, thank you for finding the geometry bug as well! I was going to make a separate issue about that last night when I updated this but feel asleep.

Regarding the geometry bug, I asked in a support channel over the weekend and was told that the winding order needs to be reversed in my geojson file. I haven't investigated this more so I don't know whether this means that the outer polygon is not drawn first http://geojson.org/geojson-spec.html#polygon (I have not examined this geojson file yet to see if that's true) but that's just my hunch.

mwiesbau commented 8 years ago

I have the same issue and I found a workaround by using the commands as outlined below. From GIS StackExchange

Vector > Geometry Tools > Multiparts to Singlepart...

ccrook commented 2 years ago

Closing stale issue