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

Output point locations from geemap.extract_values_to_points doesn’t match input #610

Closed
nedhorning opened this issue Aug 6, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@nedhorning
Copy link

I am using geemap.extract_values_to_points to extract pixel values under points from a Shapefile (EPSG: 4326) and outputting to a Shapefile. This is the raster image I’m using:
ee.Image("projects/soilgrids-isric/clay_mean")

When I checked the results in QGIS the points in the output Shapefile did not align with the input Shapefile. They were displaced ~200m and therefore extracts data from a neighboring pixel. To fix that I specified scale = 10, projection = 'EPSG:4326'. This moved the output points so they were nearly identical, however, the values for the points correspond to the raster value of the original point location. In other words, the location is (more or less) correct the but data value is from the neighboring pixel.

I attached the Shapefile I'm using.

I’m running this on Ubuntu 20.04 with version 0.8.18 of geemap
points_carbon_sequestration_gisel.zip

@nedhorning nedhorning added the bug Something isn't working label Aug 6, 2021
giswqs added a commit that referenced this issue Aug 6, 2021
@giswqs giswqs self-assigned this Aug 6, 2021
@giswqs
Copy link
Member

giswqs commented Aug 6, 2021

Thanks for reporting! This bug has been fixed. Please update the package using geemap.update_package() and try again.

@giswqs giswqs closed this as completed Aug 6, 2021
@nedhorning
Copy link
Author

Thank you for the quick fix. I updated and tried without specifying the scale and projection: geemap.extract_values_to_points(points, clay, outShapefile)
The point locations are perfect but it looks like it is still getting the value from the wrong pixel. I think this second part is a user problem since when I display the points in GEE they appear over different (neighbor) pixels compared to when I display them in QGIS.

@giswqs
Copy link
Member

giswqs commented Aug 6, 2021

What basemap are you using in QGIS? Try using the same Google basemap in both QGIS and GEE. If the points appear to be at the same locations, then it might be the problem with the basemap you used.

https://nextgis.com/blog/quickmapservices/

@bkavlak
Copy link

bkavlak commented Sep 13, 2021

Hey, I had the same problem and my solution was basically sampling points with the projection of the input image as here:
image

After doing that, I was able to see them aligned with the input imagery (Sentinel-2 in my case)
image

@agrifallsoc
Copy link

hi professor,
I have a problem, when I convert the pixels to points, as follows:
if I have some mistake in the code? thanks!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants