-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Read crs
information from metadata
#114
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so cool that we support multiple projections here! I hadn't looked at that code until now. I just had a couple questions around handling unsupported projection/crs inputs.
// Respect `projection` prop when provided, otherwise rely on `crs` value from metadata | ||
this.projectionIndex = projection | ||
? ['mercator', 'equirectangular'].indexOf(projection) | ||
: ['EPSG:3857', 'EPSG:4326'].indexOf(crs) | ||
this.projection = ['mercator', 'equirectangular'][ | ||
this.projectionIndex | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like we default to mercator in the shader in the case of a -1 index, but is there any other reason to handle an invalid index early here? Seems like updateCamera
and maybe the region picker stuff might be sad if this.projection
ends up undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call! Decided to add a check here to handle either an unexpected crs
and projection
value. Want to take another look.
if (!crs) { | ||
console.warn( | ||
'Missing `crs` value in `multiscales` metadata. Please check your pyramid generation code. Falling back to `crs=EPSG:3857` (Web Mercator)' | ||
) | ||
crs = 'EPSG:3857' | ||
} | ||
return { levels, maxZoom, tileSize, crs } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be worth adding a check to see if the provided crs is one of our two valid options and to report out those options if not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a consolidated check in tiles.js
This PR updates the library to read the
crs
attribute in multiscales metadata [0], when present, to determine theprojection
the data are stored in. The existingprojection
prop will still take precedence and can be used as an override or to specify a value whencrs
is missing.[0] https://ndpyramid.readthedocs.io/en/latest/schema.html
cc @andersy005 @maxrjones