Breaking Changes in 3.0.0 and migration from 2.x.x
In version 3.0.0 I'm trying to get a little bit back to the roots. Geolib was once started because I needed a handful of methods to perform very specific geo related tasks like getting the distance or the direction between two points. Since it was one of the very first libraries on npm back then to do these kind of things in a very simple way it became very popular (with more than 300k downloads per month as of April 2019!) and as a consequence got a lot of contributions over the years. Many of which I just merged as long as they had accompanying tests, without looking at consistency, conventions, complexity, coding style or even the overall quality of the functions that I sometimes didn't even fully understand.
I have now cleaned up the codebase completely, rebuilt the entire library "from scratch", unified all the function arguments, removed a few functions where I wasn't sure if they should be in here (feel free to add them back of you're using them!) or if they were even used (did a few searches on GitHub for the function names, turned out there are zero results).
Elevation support was dropped, as well as a few functions that unnecessarily made the library really large in size (e.g. isPointInsideRobust alone was over 700[!] lines of code and was basically taken from a different library).
I removed Grunt from the build process, added "modern" tools like ESLint and Prettier. I switched from Travis CI to Circle CI and I am in the process of further automating the release process of new versions using semantic-release and conventional-commits. I also switched from pure JavaScript to TypeScript because I think it does have some benefits.
All functions are pure functions now. No input data is mutated anymore. You give the same input, you get the same output. No side effects or whatsoever.
I changed the default getDistance function from being the slow, accurate one to being the fast, slightly inaccurate one. The old getDistance function is now named getPreciseDistance while the old getDistanceSimple function is now the default getDistance function. You can, however, pass getPreciseDistance as argument to any function that uses distance calculation internally.
Artificial limitation to 8 decimal places in decimal coordinates was removed
getBoundsOfDistance() now returns the exact coordinates due to the removal of the artificial 8 decimal place limitation
getCompassDirection() does no longer return an object with an exact and a rough direction but only the exact direction as string
third argument to getCompassDirection() is no longer a string ("circle", "line") but a function to determine the bearing (you can pass getRhumbLineBearing or getGreatCircleBearing). The function receives the origin and the destination as first and second argument. If no 3rd argument was given, getRhumbLineBearing(origin, dest) is used by default.
There is now a new helper function roughCompassDirection(exact) if you really only need a very rough (and potentially inaccurate or inappropriate) direction. Better don't use it.
orderByDistance() does no longer modify its input so does not add a distance and key property to the returned coordinates.
The result of getSpeed() is now always returned as meters per second. It can be converted using the new convenience function convertSpeed(mps, targetUnit)
Relevant value (usually point or distance) is now consistently the first argument for each function (it wasn't before, how confusing is that?)
findNearest() does no longer take offset and limit arguments. It's only a convenience method to get the single one nearest point from a set of coordinates. If you need more than one, have a look at the implementation and implement your own logic using orderByDistance
Whereever distances are involved, they are returned as meters or meters per second. No more inconsistent defaults like kilometers or kilometers per hour.
The method how sexagesimal is formatted differs a little bit. It may now potentially return ugly float point units like 52° 46' 21.0004" in rare cases but it is also more accurate than it was before.
Dropped support for Meteor (feel free to add it back if you like)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Note: This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit.
You can always request more updates by clicking Bump now in your Dependabot dashboard.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Bumps geolib from 2.0.24 to 3.2.1.
Release notes
Sourced from geolib's releases.
Changelog
Sourced from geolib's changelog.
Commits
a82222f
Release 3.2.1 - 2019-12-30T19:22:25.600Z [skip ci]67c080e
chore: add install-deps-postmerge to update deps automatically0c80ea8
Merge branch 'master' of github.com:manuelbieh/geolib6383dd8
chore: dependency updates and some cleanup4ec44f8
Release 3.2.0 - 2019-12-11T14:07:48.829Z [skip ci]00a1935
Merge branch 'master' of github.com:manuelbieh/geolib256d3b3
feat: remove type:module from package.jsonaac0feb
Merge pull request #217 from manuelbieh/dependabot/npm_and_yarn/eslint-utils-...458d7c9
Release 3.1.0 - 2019-11-04T17:05:06.453Z [skip ci]d135386
feature: add wktToPolygonDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Note: This repo was added to Dependabot recently, so you'll receive a maximum of 5 PRs for your first few update runs. Once an update run creates fewer than 5 PRs we'll remove that limit.
You can always request more updates by clicking
Bump now
in your Dependabot dashboard.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired)