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

Should geospatial sources open with a default projection? #1106

Open
banesullivan opened this issue Apr 12, 2023 · 7 comments
Open

Should geospatial sources open with a default projection? #1106

banesullivan opened this issue Apr 12, 2023 · 7 comments

Comments

@banesullivan
Copy link
Contributor

The current default projection is None for geospatial sources -- this has a specific meaning (to use image coordinates).

I'm wondering if geospatial sources should be opened with EPSG:3857 by default, as this is intuitive and what most users probably do anyways.

Changing this default will likely have ramifications in downstream packages (I know it will affect RGD and django-large-image at least).

Similarly to #1105, this will improve useability of #1065 but is less critical

@manthey
Copy link
Member

manthey commented Apr 18, 2023

Although having a default project would make sense in some contexts, I think this would be surprising in others. From a tile serving endpoint, this makes sense. From an algorithm endpoint, this doesn't (at least, I think many algorithms want to work on a pixel-wise basis and not a projected space basis). Maybe the tile serving endpoints that don't specify a project could default to none for non-geospatial and EPSG:3857 for geospatial, but the pythonic interfaces would stay with none as the default.

@banesullivan
Copy link
Contributor Author

This makes sense. I need to look into if getTile() takes/supports projection as a keyword argument or could easily support it instead of using self.projection.

Perhaps for geospatial sources (at the class-level), getTile() would have a default projection='EPSG:3857' keyword argument while still opening with projection=None by default

@manthey
Copy link
Member

manthey commented Apr 18, 2023

I think we currently open different projections as different sources (unlike with styles), so there isn't a getTile parameter.

@banesullivan
Copy link
Contributor Author

Hm, then this might be too much effort to handle at this time

@manthey
Copy link
Member

manthey commented Jun 1, 2023

Based on some discussion, one approach would be to have a default projection of some keyword like __default__, for geospatial sources this would be EPSG:3857 and for other sources this would be None.

@banesullivan
Copy link
Contributor Author

I think this makes the most sense. After all, I think it is rare for the rasterio (and even GDAL) sources to be used without a projection.

@banesullivan
Copy link
Contributor Author

banesullivan commented Jun 1, 2023

For example, the difference in something as seeminly inconspicuous as getThumbnail() -- having a projection or not is significant:

import large_image
src = large_image.open(path)
src.getThumbnail()[0]

versus with a projection

import large_image
src = large_image.open(path, projection='EPSG:3857')
src.getThumbnail()[0]
No projection EPSG:3857
download download
download download

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

2 participants