-
Notifications
You must be signed in to change notification settings - Fork 944
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
Add configuration module to specify user preferences in a central location #2472
Comments
One thing to know is that turf publishes individual modules to npm for each of its functions. This lets you import just the pieces you need. In fact, that's how I usually use it. I think this was originally by design, to keep it from being a monolithic library, before things like tree shaking existed. I'm not sure how your suggestion would work with that in mind. |
Ah, thanks. You're right I think. The turf-config bundled with the distance package wouldn't appear as the same "instance" as the turf-config bundled with nearest-point-on-line. Changing one wouldn't change the other. Let me see if there is another clean way to do this. |
Not sure there is a nice way to do this. Will reopen if a suitable approach springs to mind. |
Hey @smallsaucepan, |
Turf currently uses great circle calculations in several places (e.g. distance) and it would be helpful to provide an ellipsoid option as well. Rather than pass that as an option to every call though we could add a global configuration object where the user can specify it once only. For example in the app setup:
This seems cleaner than passing
{ ellipsoid="WGS_84 }
through several layers of function calls e.g. lineSlice -> nearestPointOnLine -> distance.Could potentially use this for other preferences such as:
Thoughts? Comments?
The text was updated successfully, but these errors were encountered: