FieldStudiesCouncil / QGIS-Biological-Recording-Tools

QGIS plugin for biological recorders. Created with the FSC Tomorrow's Biodiversity project.
GNU General Public License v3.0
10 stars 4 forks source link

Create grid map layer from polygon layer #10

Closed mnhn-paul closed 7 years ago

mnhn-paul commented 7 years ago

Hello,

Still happy with the tool to create atlas maps. After initially using the tool by importing a csv files with only a small number of species and their occurrences (point data) I now moved on to adding our entire database (1.4 mio observations) to my QGIS project. It was added as PostGIS layer. To limit the data shown I'm using a simple quarry on the layer. My initial idea was: the Biological-Recording-Tools can read data from a layer (and not only by importing data from a csv file) and that I could simple use the connected layer as a source. However the layer that I have has point data and polygon data (see screenshot, green squares come from the original data, not created by Biological-Recording-Tools), the layer is thus a polygon layer and can not be read as source file by the Biological-Recording-Tools.

A workaround that I found is to:

I was now wondering if there is a possibility that the Biological-Recording-Tools could directly read a polygon layer? Or is there another approach I could take to this "problem". My workaround is working, however a hint to a "faster" method would allays be welcome.

Thanks in advance of any suggestion

my original data comprising polygon and point data

burkmarr commented 7 years ago

Hi Paul. You are right - the tool only works with point data - either from a layer with point topology or a CSV of grid-references or x/y. The problem with dealing with polygon layers is that you have to build in a whole new raft of logic to deal with situations where the input layer polygon is not wholly contained within a single square of the grid layer you are generating. (That logic is there for UK grid references which actually reference polygons - i.e. squares rather than points - but it simply deals with grid references which cannot be unambiguously assinged to a grid square in the output by excluding them and reporting this to the user.)

I haven't worked with PostGIS layers myself, so I cannot suggest a better workaround than that which you've already come up with. But I'd like to have a look at PostGIS layers at some point and, when I do, I will revisit this question.