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

Download grids by bounding box or region name #2028

Closed
snowman2 opened this issue Mar 7, 2020 · 5 comments · Fixed by #2162
Closed

Download grids by bounding box or region name #2028

snowman2 opened this issue Mar 7, 2020 · 5 comments · Fixed by #2162

Comments

@snowman2
Copy link
Contributor

snowman2 commented Mar 7, 2020

I remember seeing something about adding functionality to pre-fetch grids. Potentially by region name or bounding box. Currently I see this for manually downloading files:

PROJ/src/proj.h

Line 510 in 38ec5e6

int PROJ_DLL proj_download_file(PJ_CONTEXT *ctx, const char *url_or_filename,

Are there plans to add functionality to download grids by a bounding box or by region name?
Also, what about a download all grids method?

@rouault
Copy link
Member

rouault commented Mar 7, 2020

to download grids by a bounding box

Exists as a utility : https://proj.org/apps/projsync.html#cmdoption-projsync-bbox

by region name

By area of use name: https://proj.org/apps/projsync.html#cmdoption-projsync-area-of-use

No plan from me for now to provide that in the API.

@snowman2
Copy link
Contributor Author

snowman2 commented Mar 7, 2020

Thanks for the pointers! It looks like I have some reading to do.

No plan from me for now to provide that in the API.

I hope it will make it there eventually. pyproj does not include any of the PROJ command line executables in the wheels. So, this functionality would be entirely missing for users who install pyproj that way (I think that is the majority of the users).

@snowman2
Copy link
Contributor Author

Thoughts on surfacing these methods in proj.h?

// For use by projinfo
std::string PROJ_DLL pj_context_get_url_endpoint(PJ_CONTEXT* ctx);
// For use by projsync
std::string PROJ_DLL pj_context_get_user_writable_directory(PJ_CONTEXT *ctx, bool create);
void PROJ_DLL pj_context_set_user_writable_directory(PJ_CONTEXT* ctx, const std::string& path);
std::string PROJ_DLL pj_get_relative_share_proj(PJ_CONTEXT *ctx);

I think with those methods, the projsync functionality could be replicated in pyproj following the logic in projsync.cpp.

@rouault
Copy link
Member

rouault commented Mar 11, 2020

You'd probably only need pj_context_get_url_endpoint() and pj_context_get_user_writable_directory() if you restrict yourself to downloading to the default user-writable directory

pj_get_relative_share_proj() + pj_context_set_user_writable_directory() are only needed for downloading in system /share/proj.

@snowman2
Copy link
Contributor Author

I am currently planning on replicating all of projsync, but I may be able to get by without these methods. I was thinking keeping them the same would be easier on users. But, I will try it out and implementation and think on it later.

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