Assigned
Status Update
Comments
ca...@google.com <ca...@google.com> #2
Thanks for your suggestion!
We'll be reviewing this for further consideration. Please star this issue to get updates and leave comments for additional information. Please note that starring the issue also provides our product team with valuable feedback on the importance of the issue to our customers.
ra...@gritstone.ai <ra...@gritstone.ai> #3
Building lat, long : 35.2376702 -106.6952455
Request api:https://solar.googleapis.com/v1/dataLayers:get?location.latitude=35.2376702&location.longitude=-106.6952455&radiusMeters=100&view=FULL_LAYERS&requiredQuality=MEDIUM&exactQualityRequired=false&pixelSizeMeters=0.1&key={solar_api_key}
image uploaded above is the rgb tiff file output from executing the api here.
The code utilized to get the latitude and longitude from each pixels of this image is given below:
def get_latlong_from_pixel(filepath, x, y):
"""
Convert pixel coordinates to latitude and longitude from a geospatial file.
Args:
filepath (str): raster data file location
x (int): The x-coordinate (pixel column) to be converted to longitude.
y (int): The y-coordinate (pixel row) to be converted to latitude.
Returns:
tuple: A tuple containing the latitude and longitude
"""
# Read raster file and check for incoming latitude and longitude values.
dataset = rasterio.open(filepath)
src_crs = src_crs = str(dataset.crs) #'EPSG:32610'
dst_crs = "EPSG:4326"
crs_coord1, crs_coord2 = dataset.xy(x, y)
([long], [lat]) = rasterio.warp.transform(
src_crs, dst_crs, xs=[crs_coord1], ys=[crs_coord2]
)
return lat, long
For the pixel location (0,0) the output latitude and longitude are : 35.238554214749094, -106.6963587662451
when it should have been somewhere close to 35.238571, -106.696374
There is a translation component in both x and y direction which isn't accounted for in the tiff metadata.
The transformation matrix from metadata for the above file :
| 0.10, 0.00, 345647.40|
| 0.00,-0.10, 3900817.00|
| 0.00, 0.00, 1.00|
Request api:
image uploaded above is the rgb tiff file output from executing the api here.
The code utilized to get the latitude and longitude from each pixels of this image is given below:
def get_latlong_from_pixel(filepath, x, y):
"""
Convert pixel coordinates to latitude and longitude from a geospatial file.
Args:
filepath (str): raster data file location
x (int): The x-coordinate (pixel column) to be converted to longitude.
y (int): The y-coordinate (pixel row) to be converted to latitude.
Returns:
tuple: A tuple containing the latitude and longitude
"""
# Read raster file and check for incoming latitude and longitude values.
dataset = rasterio.open(filepath)
src_crs = src_crs = str(dataset.crs) #'EPSG:32610'
dst_crs = "EPSG:4326"
crs_coord1, crs_coord2 = dataset.xy(x, y)
([long], [lat]) = rasterio.warp.transform(
src_crs, dst_crs, xs=[crs_coord1], ys=[crs_coord2]
)
return lat, long
For the pixel location (0,0) the output latitude and longitude are : 35.238554214749094, -106.6963587662451
when it should have been somewhere close to 35.238571, -106.696374
There is a translation component in both x and y direction which isn't accounted for in the tiff metadata.
The transformation matrix from metadata for the above file :
| 0.10, 0.00, 345647.40|
| 0.00,-0.10, 3900817.00|
| 0.00, 0.00, 1.00|
ra...@gritstone.ai <ra...@gritstone.ai> #4
I don't know how the priority gets assigned to the issues raised here. This issue is a high priority for me. Can anyone look into this and comment?
ca...@google.com <ca...@google.com> #5
Thank you for the information.
It seems that we could not open the attachment provided in expected correct results
and screenshots in a standard image format (e.g. PNG or JPEG) or screen recordings and steps to reproduce the issue.
Description
===========================================================================================
#REMINDER: Please do not disclose any possible Personally Identifiable Information (PII) such as: email address, IP, contact number, any part of name, project numbers and billing accounts as these information may violate security and privacy. Comments or attachments that include PII will be removed and restricted from public viewing.
Furthermore, please refrain from replying to a comment as this will make your email address visible. Instead, you may use the Issue Tracker’s comment feature for your replies.
It is OK to share your API Project ID, but _not_ API keys or client ID credentials.
To learn more about personal data, visit
===========================================================================================
# Describe your issue, please give as much detail as possible:
When converting pixel coordinates from a GeoTIFF file (EPSG:32613) to latitude and longitude (EPSG:4326) using Rasterio, the resulting geographic points do not align correctly when plotted on Google Maps. The discrepancy suggests an issue with the transformation process or interpretation of CRS parameters.
For example you may use the attached tiff file to pick up any pixel from it.