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

Create raster tables with geography and metadata #105

Merged
merged 38 commits into from
Feb 20, 2023

Conversation

jgoizueta
Copy link
Contributor

@jgoizueta jgoizueta commented Feb 8, 2023

Issue

sc-287177

Raster tables shouldn't require any post-processing to build block GEOGRAPHIEs, and metadata should be available as efficiently as possible.

Proposed Changes

  • Generate geog GEOGRAPHY column with block boundaries for generic rasters
  • Add a metadata row (with NULL 'geog')
  • Change attrs column type to JSON (not supported by the Python client at the moment)

Pull Request Checklist

  • I have tested the changes locally
  • I have added tests to cover my changes (if applicable)
  • I have updated the documentation (if applicable)

Additional Information

[Anything else you'd like to include.]

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #287177: Do not update the user's input table.

@jgoizueta jgoizueta added the WIP Work in progress label Feb 8, 2023
Copy link
Member

@Jesus89 Jesus89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

I have found a difference in the two attributes of the quadbin raster. I'll paste the example after running RASTER_GETMETADATA:

Production

  "raster_boundary": "POLYGON((-4.21875 50.7364551370107, -4.21875 49.8379824530848, -4.21875 48.9224992637582, -2.8125 48.9224992637582, -1.40625 48.9224992637582, -1.40625 49.8379824530848, -1.40625 50.7364551370107, -2.8125 50.7364551370107, -4.21875 50.7364551370107))",
  "avg_pixel_area": "155209.87843240262",

New changes

  "raster_boundary": "POLYGON((-4.21874999999998 48.9224992637582, -4.04296874999999 48.9224992637582, -3.86718749999999 48.9224992637582, -3.69140624999999 48.9224992637582, -3.51562499999999 48.9224992637582, -3.33984374999999 48.9224992637582, -3.16406249999999 48.9224992637582, -2.98828124999999 48.9224992637582, -2.81249999999999 48.9224992637582, -2.63671874999999 48.9224992637582, -2.46093749999999 48.9224992637582, -2.28515624999999 48.9224992637582, -2.10937499999999 48.9224992637582, -1.93359374999999 48.9224992637582, -1.75781249999999 48.9224992637582, -1.58203124999999 48.9224992637582, -1.40625 48.9224992637582, -1.40625 49.1492437479148, -1.40625 49.3759882320713, -1.40625 49.6027327162279, -1.40625 49.8294772003844, -1.40625 50.056221684541, -1.40625 50.2829661686975, -1.40625 50.5097106528541, -1.40625 50.7364551370106, -1.58203124999999 50.7364551370106, -1.75781249999999 50.7364551370106, -1.93359374999999 50.7364551370106, -2.10937499999999 50.7364551370106, -2.28515624999999 50.7364551370106, -2.46093749999999 50.7364551370106, -2.63671874999999 50.7364551370106, -2.81249999999999 50.7364551370106, -2.98828124999999 50.7364551370106, -3.16406249999999 50.7364551370106, -3.33984374999999 50.7364551370106, -3.51562499999999 50.7364551370106, -3.69140624999999 50.7364551370106, -3.86718749999999 50.7364551370106, -4.04296874999999 50.7364551370106, -4.21874999999999 50.7364551370106, -4.21874999999998 50.5097106528541, -4.21874999999998 50.2829661686975, -4.21874999999999 50.056221684541, -4.21874999999999 49.8294772003844, -4.21874999999998 49.6027327162279, -4.21874999999998 49.3759882320713, -4.21874999999999 49.1492437479148, -4.21874999999998 48.9224992637582))",
  "avg_pixel_area": "31572.769599917083",

So I think there is a bug in the pixel_area formula, and something more with the boundary (seems tesselated).

@jgoizueta jgoizueta removed the WIP Work in progress label Feb 10, 2023
@jgoizueta jgoizueta requested a review from Jesus89 February 13, 2023 08:48
@jgoizueta
Copy link
Contributor Author

jgoizueta commented Feb 13, 2023

Production

  "raster_boundary": "POLYGON((-4.21875 50.7364551370107, -4.21875 49.8379824530848, -4.21875 48.9224992637582, -2.8125 48.9224992637582, -1.40625 48.9224992637582, -1.40625 49.8379824530848, -1.40625 50.7364551370107, -2.8125 50.7364551370107, -4.21875 50.7364551370107))",
  "avg_pixel_area": "155209.87843240262",

New changes

  "raster_boundary": "POLYGON((-4.21874999999998 48.9224992637582, -4.04296874999999 48.9224992637582, -3.86718749999999 48.9224992637582, -3.69140624999999 48.9224992637582, -3.51562499999999 48.9224992637582, -3.33984374999999 48.9224992637582, -3.16406249999999 48.9224992637582, -2.98828124999999 48.9224992637582, -2.81249999999999 48.9224992637582, -2.63671874999999 48.9224992637582, -2.46093749999999 48.9224992637582, -2.28515624999999 48.9224992637582, -2.10937499999999 48.9224992637582, -1.93359374999999 48.9224992637582, -1.75781249999999 48.9224992637582, -1.58203124999999 48.9224992637582, -1.40625 48.9224992637582, -1.40625 49.1492437479148, -1.40625 49.3759882320713, -1.40625 49.6027327162279, -1.40625 49.8294772003844, -1.40625 50.056221684541, -1.40625 50.2829661686975, -1.40625 50.5097106528541, -1.40625 50.7364551370106, -1.58203124999999 50.7364551370106, -1.75781249999999 50.7364551370106, -1.93359374999999 50.7364551370106, -2.10937499999999 50.7364551370106, -2.28515624999999 50.7364551370106, -2.46093749999999 50.7364551370106, -2.63671874999999 50.7364551370106, -2.81249999999999 50.7364551370106, -2.98828124999999 50.7364551370106, -3.16406249999999 50.7364551370106, -3.33984374999999 50.7364551370106, -3.51562499999999 50.7364551370106, -3.69140624999999 50.7364551370106, -3.86718749999999 50.7364551370106, -4.04296874999999 50.7364551370106, -4.21874999999999 50.7364551370106, -4.21874999999998 50.5097106528541, -4.21874999999998 50.2829661686975, -4.21874999999999 50.056221684541, -4.21874999999999 49.8294772003844, -4.21874999999998 49.6027327162279, -4.21874999999998 49.3759882320713, -4.21874999999999 49.1492437479148, -4.21874999999998 48.9224992637582))",
  "avg_pixel_area": "31572.769599917083",

After the fix in 7bff268

  "avg_pixel_area": "155209.87729301196",

Copy link
Member

@Jesus89 Jesus89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

I have tested all the raster files and found no more regression after some iterations.

Also, the upload time is similar to v0.2 including all the pre-computation of the metadata.

@jgoizueta jgoizueta merged commit 59af70e into main Feb 20, 2023
@jgoizueta jgoizueta deleted the bug/sc-287177/do-not-update-the-user-s-input-table branch February 20, 2023 14:56
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

Successfully merging this pull request may close these issues.

2 participants