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

Allow single point queries with Opendatacube #20

Closed
whisperingpixel opened this issue Mar 2, 2023 · 8 comments
Closed

Allow single point queries with Opendatacube #20

whisperingpixel opened this issue Mar 2, 2023 · 8 comments
Labels
feature 🎁 New feature or request help wanted 🆘 Extra attention is needed

Comments

@whisperingpixel
Copy link
Contributor

Description

Currently, the intersection of the feature geometries with the pixels are based on the centroids. This is okay and best for Polygons but points are not loaded at all and for lines the centroid points need to be hit like here:

image

  • Why is the feature needed?

Only polygons can be currently used.

There are three situations:

  1. Only Polygons

Use centroid intersection (all_touch = false)

  1. Only Lines and/or only Points

Use touch (all_touch = true)

  1. Polygons and (Lines or Points)
    This is a bit difficult. The perfect solution would be to use centroid intersection for polygons, otherwise touch (e.g. splitting the collection and merging the raster results). However, we need this feature rather soon (for points), therefore the acceptable solution would be to use centroid intersection in this case as well.

Additional context

@whisperingpixel whisperingpixel added the feature 🎁 New feature or request label Mar 2, 2023
@whisperingpixel
Copy link
Contributor Author

Related: #14

@whisperingpixel
Copy link
Contributor Author

Unfortunately, #21 changed the loading behaviour of the geometries but did not solve the problem with point-based queries.

@luukvdmeer
Copy link
Member

Hmm, could this be an issue with Opendatacube? When I do point queries using the semantique test datacube it works fine (also saving and reading the GeoTIFF).

Do you have the layout of the current EODC datacube such that I can test it there?

Screenshot 2023-03-09 at 17-01-48 Untitled - Jupyter Notebook

Screenshot 2023-03-09 at 17-02-21 Untitled - Jupyter Notebook

@luukvdmeer
Copy link
Member

Source of the problem found by @whisperingpixel, thanks! It turns out that deep in the OpenDataCube code there is the assumption of a regular grid and the cell spacing of the first two cells is used to calculate the resolution for the entire grid. Obviously, this is not possible for an AOI consisting of a single point (since the grid only has a single cell in that case).

There is the option to hand over a fallback_resolution. We need to set a reasonable default here, e.g. 1. Since this is only used in the case of a point it will be a single pixel anyways corresponding on the pixel size. However, setting this hard-coded could lead to unwanted effects later. We need further testing and understanding what the effect of different sizes is.

@whisperingpixel just to confirm, this is not an issue when the AOI consists of multiple points, right? In that case the grid should be regular (except when the points are so close to each other they all fall in the same cell).

@whisperingpixel
Copy link
Contributor Author

@luukvdmeer - Thanks! Yes, I confirm: If there are two or more points it works.

@luukvdmeer luukvdmeer changed the title Change intersection method for points and lines Allow single point queries with Opendatacube Jul 11, 2023
@luukvdmeer
Copy link
Member

@whisperingpixel This should work now, as the spatial resolution is now always stored in the arrays in the way ODC expects it. This means the "fallback resolution" is equal to the resolution the user defined when executing the query. Unfortunately I cannot test good if it works since I don't have a working ODC example. So we should confirm this after updating on the workstation.

@luukvdmeer luukvdmeer added the help wanted 🆘 Extra attention is needed label Jul 12, 2023
@luukvdmeer
Copy link
Member

@whisperingpixel Just as a reminder, we should confirm this on the workstation/server whenever the latest semantique version is installed (no urgency from my side of course ;)

@whisperingpixel
Copy link
Contributor Author

Of course! @augustinh22 is currently setting this up for testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎁 New feature or request help wanted 🆘 Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants