[gdal-dev] Recommended process for running a intersect test between a raster and a simple vector

Andrew C Aitchison andrew at aitchison.me.uk
Wed Jan 15 04:45:55 PST 2020


On Mon, 13 Jan 2020, Brian wrote:

> So I am not sure if this is the right place or not. Feel free to remove if
> it is not.
>
> The problem:  I am needing to see if an extent (vector polygon, 4 vertices)
> has any interaction with a raster stored in the cog format.
>
> I thought about using raster_polygonize and running a intersect but that is
> going to be way too slow and I don't need the detail at which the raster is
> stored in.
> So I was thinking of some alternatives.
> Is there anyway to output just the polygon of the raster at a certain
> overview level?
> Is there any way to run intersects on a raster without converting it?

If the data set has tiles or the driver otherwise knows where it has data
and nodata and supports it, the IGetDataCoverageStatus virtual method
    https://trac.osgeo.org/gdal/wiki/rfc63_sparse_datasets_improvements
may be useful. It takes as input a window of interest and returns whether
it is made of data, empty blocks or a mix of them.

> I know I can retrieve the extent of the raster and quickly determine if an
> extent has any interaction with that raster extent. I also know that I can
> send points(x,y) and retrieve the value of the raster at that point is
> there any way to manipulate /game this? Maybe sending the extent as
> individual points with added points in between the vertices and just
> running multiple value at location operations? For my need, some false
> positives would be acceptable. If it helps raster data is of rivers and
> inundations.

-- 
Andrew C. Aitchison					Kendal, UK
 			andrew at aitchison.me.uk


More information about the gdal-dev mailing list