[Qgis-user] sampling points from multipe rasters

Tyler Smith tyler at plantarum.ca
Tue May 5 07:12:56 PDT 2020


Thanks Matt!

That was easy. It only took about a minute to sample 10,000 points 
from 30 layers into a single shapefile, and from there save to 
csv. I'll investigate using gpkg directly from R in future.

Best,

Tyler

Matt Boyd writes:

> Hi Tyler,
> the point sampling tool plugin will allow you to select multiple 
> rasters to
> sample from and output to the same file. It also allows you to 
> save the
> results in a number of different formats (geopackage, csv and 
> shapefile).
> If you've got access to python in your version of R then 
> geopandas can read
> geopackage files directly, I find that a lot more useful than 
> csv.
>
> I use this workflow. The slowest part is the point sampling 
> depending on
> the number and size of rasters and points.
>
> Matt
>
>
>
> On Tue, May 5, 2020 at 6:49 AM Tyler Smith <tyler at plantarum.ca> 
> wrote:
>
>> Hi,
>>
>> I have 30 raster layers, and I need to sample 10,000 random 
>> points
>> from each layer (using the same set of points each time). I 
>> think
>> my options are:
>>
>> 1. Create a virtual raster, and sample. This has the downside 
>> that
>> the identify of the 30 layers will be replaced by generic 
>> 'band1',
>> 'band2' labels.
>>
>> 2. Sample the layers directly, using a batch process. This has 
>> the
>> downside that it appears to output to gpkg format, and creates 
>> 30
>> separate files. I will need to open each of these files, export
>> the points they contain to csv, and then combine the into a 
>> single
>> table in R for analysis.
>>
>> Is there a way to create a virtual raster that retains the 
>> layer
>> names in the stack? Alternatively, can I bulk sample multiple
>> rasters and have the output combined in a single table?
>>
>> Thanks,
>>
>> Tyler
>>
>> --
>> Tyler Smith
>> plantarum.ca
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


-- 
Tyler Smith
plantarum.ca


More information about the Qgis-user mailing list