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

Incorrect bounds computation in index_from_s3.py #4

Open
Kirill888 opened this issue Nov 12, 2018 · 0 comments
Open

Incorrect bounds computation in index_from_s3.py #4

Kirill888 opened this issue Nov 12, 2018 · 0 comments

Comments

@Kirill888
Copy link
Member

  1. MTL document lists extents as they apply to pixel centers, but datacube expects extents that cover whole raster edge to edge

def get_geo_ref_points(info):
return {
'ul': {'x': info['CORNER_UL_PROJECTION_X_PRODUCT'], 'y': info['CORNER_UL_PROJECTION_Y_PRODUCT']},
'ur': {'x': info['CORNER_UR_PROJECTION_X_PRODUCT'], 'y': info['CORNER_UR_PROJECTION_Y_PRODUCT']},
'll': {'x': info['CORNER_LL_PROJECTION_X_PRODUCT'], 'y': info['CORNER_LL_PROJECTION_Y_PRODUCT']},
'lr': {'x': info['CORNER_LR_PROJECTION_X_PRODUCT'], 'y': info['CORNER_LR_PROJECTION_Y_PRODUCT']},
}

So recorded span is 15 meters (half a pixel) smaller than actual span.

  1. The usual error of incorrectly computing bounding box in Lon/Lat domain that assumes that projecting bounding box to Lon/Lat is the same as computing bounding box after projecting the whole shape into Lon/Lat with extra points added and then computing the bounding box

def get_coords(geo_ref_points, spatial_ref):
t = osr.CoordinateTransformation(spatial_ref, spatial_ref.CloneGeogCS())
def transform(p):
lon, lat, z = t.TransformPoint(p['x'], p['y'])
return {'lon': lon, 'lat': lat}
return {key: transform(p) for key, p in geo_ref_points.items()}

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

No branches or pull requests

1 participant