Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

handle raster2dggs conversion when raster uses projected CRS#57

Open
fmigneault wants to merge 1 commit intoopengeoshub:mainopengeoshub/vgrid:mainfrom
crim-ca:handle-raster2dggs-proj-crscrim-ca/vgrid:handle-raster2dggs-proj-crsCopy head branch name to clipboard
Open

handle raster2dggs conversion when raster uses projected CRS#57
fmigneault wants to merge 1 commit intoopengeoshub:mainopengeoshub/vgrid:mainfrom
crim-ca:handle-raster2dggs-proj-crscrim-ca/vgrid:handle-raster2dggs-proj-crsCopy head branch name to clipboard

Conversation

@fmigneault
Copy link
Copy Markdown

The code currently assumes that Geographic CRS are employed. If the raster is using PROJ CRS, the result is an incoherent collection of cells spread around the world.

For example, using this image: https://rcm-ceos-ard.s3.ca-central-1.amazonaws.com/MLC/2025/08/20/RCM2_OK3556292_PK3758929_1_SC30MCPB_20250820_124729_CH_CV_MLC/RCM2_OK3556292_PK3758929_1_SC30MCPB_20250820_124729_RL.tif

The CRS is:

CRS.from_wkt("PROJCS["WGS 84 / UTM zone 14N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-99],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","32614"]]")

The current code results in many random grid cells around the world.
(for example, one of the entry below is in Australia)

# before
transform * (col, row) = {tuple: 2} (619040.0, 5635760.0)
h3.latlng_to_cell(lat, lon, resolution) = {str} '889d5984b3fffff'
shapely.to_geojson(h32geo(h3_id)) = {str} '{
  "type" : "Polygon",
  "coordinates" : [ [ [ 139.99919040896353, -20.003853866867086 ], [ 140.00039675898358, -19.999125501107127 ], [ 139.9966348223183, -19.996016507198426 ], [ 139.99166664673348, -19.99763554491453 ], [ 139.99045993238093, -20.002363646094285 ], [ 139.99422175790926, -20.005472974146524 ], [ 139.99919040896353, -20.003853866867086 ] ] ]
}'

Now, it creates the correct grid positions in Canada (above Winnipeg, as expected).

transformer(transform * (col, row)) = {tuple: 2} (-97.30852836227533, 50.86126263102006)
h3.latlng_to_cell(lat, lon, resolution) = "882702880dfffff"
shapely.to_geojson(h32geo(h3_id)) = {str} '{
  "type" : "Polygon",
  "coordinates" : [ [ [ -97.31287367561494, 50.86284727324145 ], [ -97.31954080882947, 50.860269413001724 ], [ -97.3191299720562, 50.855273393469446 ], [ -97.31205368608208, 50.85285504796565 ], [ -97.30538710932244, 50.85543229263682 ], [ -97.30579626200928, 50.86042849831584 ], [ -97.31287367561494, 50.86284727324145 ] ] ]
}'
{A196EE5C-6375-41FF-9E16-EDB983EF4E30}

There are many other locations in the code that does similar assumptions, but I have only edited the raster conversion that were identical to the code I am invoking.

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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.