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

feat: implement SetSearchPaths #21

Merged
merged 1 commit into from
Nov 2, 2024
Merged

Conversation

mfbonfigli
Copy link
Contributor

What change

This PR implements a SetSearchPaths function on the Context object to allow users of the library to instruct Proj to search for data files in the provided locations.

To perform this operation, this function calls the underlying C function proj_context_set_search_paths passing as input the required parameters:

  • The PJ Context
  • An int specifying the number of paths
  • A pointer to the list of paths, or nil if the number of paths is zero

Why this change

Without this change, any software depending on this library needs to make sure that the PROJ_DATA environment variable is set. This change enables software to programmatically set the data discovery paths per each individual context without relying on global environment variables.

Testing

I have tested this function in a program I am developing and checked it worked. I have also written a unit test, although it is of limited usefulness since the C function does not return any error.

Implements SetSearchPaths matching the C function
proj_context_set_search_paths, which allows to set the locations that
PROJ will use to search the PROJ data files.
@twpayne twpayne merged commit 6d25e8c into twpayne:master Nov 2, 2024
5 checks passed
@twpayne
Copy link
Owner

twpayne commented Nov 2, 2024

Thank you for a very nice PR!

Would you like a new version of go-proj tagged now that includes this, or do you have more PRs in the pipeline?

@mfbonfigli
Copy link
Contributor Author

This is the only PR I'm planning for now. If you want to create the tag please go ahead :)

@twpayne
Copy link
Owner

twpayne commented Nov 2, 2024

OK, I've tagged v10.4.0 that includes this PR.

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