Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't read raster if geometry bounds don't overlap #108

Open
3 tasks
perrygeo opened this issue Dec 23, 2015 · 0 comments
Open
3 tasks

Don't read raster if geometry bounds don't overlap #108

perrygeo opened this issue Dec 23, 2015 · 0 comments

Comments

@perrygeo
Copy link
Owner

In #107, @demiurg suggested some sort of catch for misaligned projections.

We can't compare spatial reference systems, that functionality doesn't currently exist: See #26 (comment).

We could compare spatial extents at a geometry level - add some logic that says "don't even bother reading the raster if the geometry extent doesn't overlap with the raster extent". It won't fix every case but it should catch some of them.

Some considerations:

  • no Exception should be raised - it's expected that some geometries may be off the map in normal usage.
  • we need to calculate the number of non-overlapping pixels since rasterstats supports counting nodata cells. I don't know of a reliable way to do this without a boundless read. If we can't figure this out, it's a deal breaker.
  • a warning should be issued: "Geometry does not overlap with raster, this may indicate a spatial referencing mismatch"

Ultimately I'm not too psyched on including guard rails for such cases. If you ask rasterstats to compare this geometry against that raster, it should do it. But if we can put in a simple optimization that doesn't break current usage I'll include it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant