mirror of
https://github.com/Turfjs/turf.git
synced 2025-12-08 20:26:16 +00:00
Merge branch 'master' into mf/nx-cleanup
This commit is contained in:
commit
a8e0272b6a
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
packages/turf/turf.js
|
||||
packages/turf/turf.min.js
|
||||
packages/turf/test.example.js
|
||||
62
.eslintrc.js
62
.eslintrc.js
@ -1,62 +0,0 @@
|
||||
const rules = {
|
||||
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
|
||||
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
"no-constant-condition": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-var": "off",
|
||||
"prefer-const": "off",
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
ignorePatterns: ["**/dist/**"],
|
||||
parser: "@typescript-eslint/parser",
|
||||
plugins: ["@typescript-eslint"],
|
||||
extends: [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:prettier/recommended",
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: "module",
|
||||
},
|
||||
env: { es6: true, node: true },
|
||||
rules,
|
||||
|
||||
overrides: [
|
||||
{
|
||||
files: ["packages/*/types.ts"],
|
||||
rules: {
|
||||
// these are meant to test the typescript typings, unused variables are expected
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
".eslintrc.js",
|
||||
"packages/*/bench.js",
|
||||
"packages/*/test.js",
|
||||
"packages/turf/rollup.config.js",
|
||||
"scripts/check-dependencies.js",
|
||||
],
|
||||
env: {
|
||||
node: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
// a few files use browser global variables
|
||||
"packages/turf-isobands/lib/marchingsquares-isobands.js",
|
||||
"packages/turf-isolines/lib/marchingsquares-isocontours.js",
|
||||
],
|
||||
env: {
|
||||
browser: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
9
.github/ISSUE_TEMPLATE.md
vendored
9
.github/ISSUE_TEMPLATE.md
vendored
@ -1,9 +1,10 @@
|
||||
Please provide the following when reporting an issue:
|
||||
|
||||
- [ ] The version of Turf you are using, and any other relevant versions.
|
||||
- [ ] GeoJSON data as a [gist file](https://gist.github.com/) or [geojson.io](http://geojson.io/) (filename extension must be `.geojson`).
|
||||
- [ ] Snippet of source code or for complex examples use [jsfiddle](https://jsfiddle.net/).
|
||||
- [ ] Verify this issue hasn't already been reported, or resolved in the latest alpha pre-release.
|
||||
- [ ] Description of the problem, and how it differs from what you expected.
|
||||
- [ ] Version of Turf you are using, and of any other relevant software.
|
||||
- [ ] GeoJSON data as a [gist file](https://gist.github.com/) or [geojson.io](https://geojson.io/) (filename extension must be `.geojson`). Simple reproducible examples are preferrable.
|
||||
- [ ] Snippet of source code for complex examples using [jsfiddle](https://jsfiddle.net/).
|
||||
- [ ] Confirmation this issue hasn't already been reported, or is resolved and just hasn't been released yet.
|
||||
|
||||
<!-- Love turf? Please consider supporting our collective:
|
||||
👉 https://opencollective.com/turf/donate -->
|
||||
|
||||
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,11 +1,8 @@
|
||||
Please fill in this template. Use a meaningful title for the pull request. Include the name of the package modified.
|
||||
Please provide the following when creating a PR:
|
||||
|
||||
- [ ] Is this a bug fix, new functionality, or a breaking change?
|
||||
- [ ] Have read and followed the steps for [preparing a pull request](https://github.com/Turfjs/turf/blob/master/CONTRIBUTING.md#preparing-a-pull-request).
|
||||
|
||||
Submitting a new TurfJS Module.
|
||||
|
||||
- [ ] Overview description of proposed module.
|
||||
- [ ] Include JSDocs with a basic example.
|
||||
- [ ] Execute `./scripts/generate-readmes` to create `README.md`.
|
||||
- [ ] Add yourself to **contributors** in `package.json` using "Full Name <@GitHub Username>".
|
||||
- [ ] Meaningful title, including the name of the package being modified.
|
||||
- [ ] Summary of the changes.
|
||||
- [ ] Heads up if this is a breaking change.
|
||||
- [ ] Any issues this [resolves](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests).
|
||||
- [ ] Inclusion of your details in the `contributors` field of `package.json` - you've earned it! 👏
|
||||
- [ ] Confirmation you've read the steps for [preparing a pull request](https://github.com/Turfjs/turf/blob/master/docs/CONTRIBUTING.md#preparing-a-pull-request).
|
||||
|
||||
9
.github/workflows/prerelease.yml
vendored
9
.github/workflows/prerelease.yml
vendored
@ -17,16 +17,17 @@ jobs:
|
||||
runs-on: ${{matrix.platform}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: pnpm/action-setup@v2.4.0
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # 4.1.0
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # 4.3.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
@ -21,16 +21,17 @@ jobs:
|
||||
runs-on: ${{matrix.platform}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: pnpm/action-setup@v2.4.0
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # 4.1.0
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # 4.3.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
@ -50,7 +51,7 @@ jobs:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Create Github Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # 2.2.1
|
||||
with:
|
||||
make_latest: true
|
||||
generate_release_notes: true
|
||||
|
||||
8
.github/workflows/turf.yml
vendored
8
.github/workflows/turf.yml
vendored
@ -19,19 +19,19 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x, 18.x, 20.x]
|
||||
node-version: [18.x, 20.x, 22.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # 4.1.0
|
||||
with:
|
||||
run_install: false
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # 4.3.0
|
||||
with:
|
||||
cache: "pnpm"
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
@ -221,8 +221,9 @@ export default {
|
||||
devDependencies: {
|
||||
benchmark: "^2.1.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
tape: "^5.7.2",
|
||||
tsx: "^4.6.2",
|
||||
tape: "^5.9.0",
|
||||
tsup: "^8.4.0",
|
||||
tsx: "^4.19.4",
|
||||
},
|
||||
},
|
||||
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
|
||||
@ -231,26 +232,17 @@ export default {
|
||||
requireDependency({
|
||||
options: {
|
||||
dependencies: {
|
||||
tslib: "^2.6.2",
|
||||
tslib: "^2.8.1",
|
||||
},
|
||||
devDependencies: {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
typescript: "^5.2.2",
|
||||
"@types/tape": "^5.8.1",
|
||||
typescript: "^5.8.3",
|
||||
},
|
||||
},
|
||||
includePackages: TS_PACKAGES,
|
||||
}),
|
||||
|
||||
requireDependency({
|
||||
options: {
|
||||
devDependencies: {
|
||||
rollup: "^2.79.1",
|
||||
},
|
||||
},
|
||||
includePackages: [MAIN_PACKAGE],
|
||||
}),
|
||||
|
||||
requireDependency({
|
||||
options: {
|
||||
dependencies: {
|
||||
|
||||
@ -1,75 +0,0 @@
|
||||
# Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to making participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||
nationality, personal appearance, race, religion, or sexual identity and
|
||||
orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces
|
||||
when an individual is representing the project or its community. Examples of
|
||||
representing a project or community include using an official project e-mail
|
||||
address, posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event. Representation of a project may be
|
||||
further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting an organization admin: @morganherlocker, @lyzidiamond, @tcql, or @tmcw. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
|
||||
328
CONTRIBUTING.md
328
CONTRIBUTING.md
@ -1,328 +0,0 @@
|
||||
## Getting Started
|
||||
|
||||
One of the most important things you can do is report bugs. Please reference [how to report a bug](http://polite.technology/reportabug.html) and when opening an [issue](https://github.com/Turfjs/turf/issues), follow the template.
|
||||
|
||||
To propose an enhancement for Turf, open an [issue](https://github.com/Turfjs/turf/issues), or start a [discussion](https://github.com/Turfjs/turf/discussions).
|
||||
|
||||
To make a code contribution, follow the steps for [how to contribute](#how-to-contribute).
|
||||
|
||||
## Architecture
|
||||
- GeoJSON is the lingua franca of Turf. It should be used as the data structure for anything that can be represented as geography.
|
||||
- Most work happens in sub modules. These are found in the `packages` directory prefixed with "turf-".
|
||||
- Turf modules are small, containing a single exported function. This function is exported from a top-level index file.
|
||||
- Many turf modules depend on other smaller Turf modules.
|
||||
|
||||
## How to contribute
|
||||
|
||||
If you don't have write access to the Turf repository (most will not), you will need to follow the [Github guidelines](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project) and fork the [Turf repo](https://github.com/Turfjs/turf) to your own account, create a feature branch, and open a Pull Request back to the main Turf repo.
|
||||
|
||||
If you do have write access to the Turf repo (core contributor), you can [clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) it locally. This is required for doing a [release](#release). You can also push feature branches directly to the Turf repo and open PR's against them. Consider prefixing your feature branch names with your initials (for example `tw/my-feature`).
|
||||
|
||||
If you'd like to become a core contributor, just start making contributions, and inquire.
|
||||
|
||||
### Local Setup
|
||||
|
||||
Once you've cloned a Turf repository, and have a terminal open and currenty in the top-level turf directory. Run the following:
|
||||
- `git checkout master` (if not already)
|
||||
- `corepack enable pnpm`
|
||||
- enable pnpm as a package manager. Requires Node 16+. Alternatively just `npm install -g pnpm`.
|
||||
- `pnpm install`
|
||||
- install dependencies and build modules
|
||||
- `pnpm test`
|
||||
- run all tests and linters
|
||||
|
||||
You're now ready to contribute.
|
||||
|
||||
<details>
|
||||
<summary>Structure of a Turf module</summary>
|
||||
<br>
|
||||
|
||||
Turf modules are under the `packages` directory. For example `packages/turf-area`. Here's how they are structured.
|
||||
|
||||
```
|
||||
turf-<MODULE NAME>
|
||||
│ index.js
|
||||
│ index.d.ts
|
||||
│ bench.js
|
||||
│ test.js
|
||||
│ types.ts
|
||||
│ package.json
|
||||
│ README.md
|
||||
│ LICENSE
|
||||
│
|
||||
└───test
|
||||
│
|
||||
├───in
|
||||
│ points.geojson
|
||||
│
|
||||
└───out
|
||||
points.geojson
|
||||
```
|
||||
To get started with a new module navigate to the root directory and run
|
||||
```sh
|
||||
$ node ./scripts/create-new-module <MODULE NAME>
|
||||
```
|
||||
it will create a new folder inside `packages` with a simple boilerplate for your module.
|
||||
|
||||
* `index.js` - This file contains, in order, the various modules you need to
|
||||
import, the [JSDocs](http://usejsdoc.org) documentation, and, finally, the
|
||||
single exported function that the module provides. For more on the types
|
||||
supported in the documentation, see…
|
||||
* `index.d.ts` - This is a [TypeScript](https://www.typescriptlang.org/) file
|
||||
that describes your function’s signature. For more on the types supported in
|
||||
TypeScript, see…
|
||||
* `index.ts` - If you prefer to write Typescript instead of Javascript, use this
|
||||
instead of index.js and index.d.ts.
|
||||
* `bench.js` - This file uses [Benchmark](https://benchmarkjs.com/) to time
|
||||
your function.
|
||||
* `test.js` - This file includes your [tape](https://github.com/substack/tape)
|
||||
tests. We prefer dynamic testing built from GeoJSON files placed in
|
||||
`./test/in` that are subsequently written to `./test/out` if your `REGEN`
|
||||
[environment variable is set](https://askubuntu.com/a/58828) to `true`. If
|
||||
`REGEN` is set to a different value, then running `pnpm t` will compare the
|
||||
output of the tests to the files already present in `./test/out`.
|
||||
* `types.ts` - A file that tests the custom TypeScript types declared in
|
||||
`index.d.ts`.
|
||||
* `package.json` - The [node](http://nodejs.org) metadata container file.
|
||||
Modules imported in `index.js` should be listed here under `dependencies`,
|
||||
and modules used in `test.js` and/or `bench.js` should be listed under
|
||||
`devDependencies`. `pnpm install` looks to this file to install dependencies
|
||||
in `./node_modules`.
|
||||
* `README.md` - This README is generated _automatically_ by running `pnpm run
|
||||
docs` from the project root level. **DO NOT edit this file**.
|
||||
* `LICENCE` - Like the README, this file should not be edited.
|
||||
* `test/` - This directory holds the GeoJSON files that provide data for
|
||||
dynamic tests (in `./test/in`) and the results of the tests (in
|
||||
`./test/out`). The files in `./test/out` should **not** be edited by hand.
|
||||
They should be generated dynamically by [setting the environment
|
||||
variable](https://askubuntu.com/a/58828) `REGEN` to `true`, and then the
|
||||
tests should be checked against these files by setting `REGEN` to some other
|
||||
value. The resulting out-files can be drag-dropped into
|
||||
[geojson.io](http://geojson.io) to see, visually, if the module is behaving
|
||||
appropriately.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Development tips</summary>
|
||||
<br>
|
||||
Work in a feature branch when possible
|
||||
- `git checkout -b my-feature`
|
||||
- Create it right away off of master.
|
||||
- This allows you to keep your local master branch clean and in sync with the official remote, for creating new branches at any time.
|
||||
|
||||
As you make code changes
|
||||
- Run `npm test` from any submodule to make sure tests keep passing as you go. (for example `cd packages/turf-area` and `npm test`)
|
||||
- Occasionally Run `npm test` at the top-level directory to run test for all modules.
|
||||
- This will ensure that you haven't introduced errors affecting other turf modules.
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Cleaning up</summary>
|
||||
<br/>
|
||||
To reset your current branch, throwing away any partial and uncommitted work
|
||||
- `git reset --hard`
|
||||
|
||||
Merging branches, deleting branches and other management tasks are left for you to work out on your own.
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Staying up to date</summary>
|
||||
<br/>
|
||||
To update your local master branch with the latest code for all branches from the Github remote `origin`.
|
||||
- `git fetch remote`
|
||||
</details>
|
||||
|
||||
## Preparing a pull request
|
||||
|
||||
A simple, complete pull request is more likely to get merged.
|
||||
|
||||
<details>
|
||||
<summary>But I don't know how</summary>
|
||||
<br>
|
||||
If you don't know how to make a solid PR, just submit a draft PR, and ask for feedback. Then improve it and re-ask for feedback until it's ready.
|
||||
</details>
|
||||
|
||||
### Pull Request Checklist
|
||||
- Briefly summarize the need and solution. Link to the issue it's resolving if exists.
|
||||
- Add tests. Even for bug fixes. Just a simple test case that reproduces the issue and demonstrates it's fixed.
|
||||
- Update JSDoc comments if the function signature changes or docs need improvement (See for example `packages/turf-area/index.ts`)
|
||||
- Run a full `npm test` at root level, confirming no cross-module issues. If you don't catch this now, the Github CI will.
|
||||
|
||||
### Guidelines
|
||||
- Feel free to [ask](#getting-started) if a feature/enhancement is needed/wanted before doing the work.
|
||||
- Keep pull requests small and focused.
|
||||
- Avoid large dependencies at all costs.
|
||||
- Make sure that your code can run in the browser (ie: don't make calls to external services, don't hit the filesystem, etc.).
|
||||
|
||||
### Doc generation
|
||||
|
||||
Know that module README.md files and https://turfjs.org API docs are auto-generated from JSDoc comments.
|
||||
- As a contributor, all you need to do is update the JSDoc comments.
|
||||
- For example if you change a top-level Turf functions signature (params, return type) or just want to improve the docs.
|
||||
- JSDoc comments are found in the top-level index file for each module (for example `turf/packages/turf-area/index.ts`). For example look for `@name`, `@params`, `@returns`, `@example`.
|
||||
|
||||
## Code Style
|
||||
|
||||
We have lots of tooling dedicated to ensuring consistent code. We use [Prettier](https://prettier.io/), [Typescript](https://www.typescriptlang.org/), and [ESLint](https://eslint.org/) to help us deliver quality code. These are checked by the build system and should be enforced at commit time by [Husky](https://typicode.github.io/husky/#/).
|
||||
|
||||
Some of the modules are written in Typescript, others are still plain Javascript. In the javascript modules and any dependencies we include, it is important to only write ES5 code. This ensures good browser compatability for Turf users, and is checked at build time.
|
||||
|
||||
Making sure that the monorepo packages can be managed at scale, we use [Monorepolint](https://github.com/monorepolint/monorepolint) which allows us to programatically manage the various files in each package.
|
||||
|
||||
- Linters are run at commit time, using a pre-commit hook in `.husky/pre-commit`. See the package.json `lint:staged` section.
|
||||
|
||||
## Publishing
|
||||
|
||||
### Prerelease
|
||||
|
||||
A [prerelease](https://github.com/Turfjs/turf/blob/master/.github/workflows/prerelease.yml) action is available that publishes a canary release for every commit or PR merged to the master branch. However, this action is only [enabled](https://github.com/Turfjs/turf/actions/workflows/prerelease.yml) when needed.
|
||||
|
||||
When used, it publishes an alpha release to NPM (e.g. `7.0.0-alpha.116` where 116 is the number of commits to master since the last release tag).
|
||||
- The version number is calculated by a combination of the output of `git describe` and the `publish:prerelease` script in the root package.json. It is typically setup to do a `minor` prerelease, but can be changed, such as prior to a `major` release.
|
||||
|
||||
### Release
|
||||
|
||||
A turf release is initiated from your local computer, and then built and published remotely via a github actions.
|
||||
|
||||
To make a release as a core contributor, you will need:
|
||||
- Turf repository write permission
|
||||
- Turf npm organization publish permission
|
||||
- A local copy of the Turf Github repository (not a fork!). Starting with a fresh clone will ensure it's clean.
|
||||
- `git clone git@github.com:Turfjs/turf.git turf-release`
|
||||
- `cd turf-release` - start at the top-level of the repo
|
||||
- `pnpm install`
|
||||
|
||||
- If you choose to clean up an existing copy instead, be very careful:
|
||||
- `git remote -v` - verify your remote origin points to `https://github.com/Turfjs/turf.git`
|
||||
- `git checkout master`
|
||||
- `git reset --hard` - reset your local working copy, will lose any uncommitted or unstashed work!
|
||||
- `git fetch origin` - fetch latest commits
|
||||
- `git rev-list master...origin/master` - verify local master in sync with remote, command output should be empty
|
||||
- `pnpm install`
|
||||
- `pnpm test` - make sure everything is passing
|
||||
|
||||
Before release:
|
||||
- If necessary, make and merge a PR with any last minute housekeeping items.
|
||||
- Turf's documentation (README.md files) should already be up to date as it is generated automatically on commit from JSDoc comments in source files.
|
||||
- Review PR's and decide the new version number to be published (for example 7.0.1 or 7.1.0).
|
||||
- If there are breaking changes, then it should be a major version bump, e.g. 7.x.x to 8.0.0. This project follows [semantic versioning](https://semver.org/).
|
||||
|
||||
Run the release commands, replace `7.0.0` with your version number
|
||||
- fetch the latest code from remote origin
|
||||
- `git fetch origin`
|
||||
|
||||
- create a release branch, replace mf with your initials to make it clear whose branch it is.
|
||||
- `git checkout origin/master -b mf/release-7.0.0`
|
||||
|
||||
- increment the version number of all packages, without pushing to origin. This will also create a release tag.
|
||||
- `pnpm lerna version --no-commit-hooks --no-push 7.0.0`
|
||||
|
||||
- stage any files changed by the version command.
|
||||
- `git add packages/*/package.json`
|
||||
- `git add lerna.json`
|
||||
`
|
||||
|
||||
- create new commit on the release branch
|
||||
- `git commit -m "Release v7.0.0"`
|
||||
|
||||
- Push the release branch and the release tag.
|
||||
- `git push origin mf/release-7.0.0 --follow-tags`
|
||||
- The tag will trigger the Github [release](https://github.com/Turfjs/turf/blob/master/.github/workflows/release.yml) action which you can view the status of at - https://github.com/Turfjs/turf/actions. If successful, a new [version](https://www.npmjs.com/package/@turf/turf?activeTab=versions) of all turf packages will have been published on NPM.
|
||||
|
||||
- If the release action was successful, now create a Pull Request for the release and then merge it.
|
||||
- A link to create the PR should be in the output of the push command
|
||||
- Use the version number for the PR title (e.g. v7.0.0).
|
||||
- If a link isn't provided, just create a PR that merges your release branch to master. Here is an example - https://github.com/Turfjs/turf/pull/2615.
|
||||
- Don't forget to merge your release PR!
|
||||
|
||||
#### Follow-on steps
|
||||
- As part of the release action, a draft Github release will have been created at https://github.com/Turfjs/turf/releases with an auto-generated changelog. Edit and add to the release notes for readability and completeness, specifically noting any breaking changes. Use past releases as a guide. Be sure to "Save draft" each time, then ask for a review from other contributors. Once ready, click `Publish release`. This will make the release notes publicly accessible and notify all watchers of the project.
|
||||
- Release a new version of the [API docs](https://github.com/Turfjs/turf-www/blob/master/CONTRIBUTING.md) for the https://turfjs.org website.
|
||||
|
||||
## Documentation
|
||||
|
||||
- API docs for each turf package are extracted from JSDoc comments in the source code into the top-level README.md files. README's are automatically updated on commit using via the pre-commit hook.
|
||||
|
||||
Should you want to generate new README files manually, use `pnpm run docs`:
|
||||
- **inside a module:** will generate the docs for that module.
|
||||
- **main folder:** will generate docs for all modules.
|
||||
|
||||
### Documentation - Examples
|
||||
|
||||
**Only build docs for `@turf/center`**
|
||||
|
||||
```bash
|
||||
$ cd ./turf/packages/turf-center
|
||||
$ pnpm run docs
|
||||
|
||||
> @turf/center@5.0.4 docs /Users/mac/Github/turf/packages/turf-center
|
||||
> node ../../scripts/generate-readmes
|
||||
|
||||
Building Docs: @turf/center
|
||||
```
|
||||
|
||||
**Builds docs for all modules**
|
||||
|
||||
```bash
|
||||
$ cd ./turf
|
||||
$ pnpm run docs
|
||||
> @ docs /Users/mac/Github/turf
|
||||
> tsx ./scripts/generate-readmes
|
||||
|
||||
Building Docs: @turf/along
|
||||
Building Docs: @turf/area
|
||||
Building Docs: @turf/bbox-clip
|
||||
Building Docs: @turf/bbox-polygon
|
||||
Building Docs: @turf/bbox
|
||||
Building Docs: @turf/bearing
|
||||
Building Docs: @turf/bezier-spline
|
||||
Building Docs: @turf/boolean-clockwise
|
||||
....
|
||||
```
|
||||
|
||||
### Public website
|
||||
|
||||
The [turfjs.org](http://turfjs.org/) website is managed in a [separate repo](https://github.com/Turfjs/turf-www) with its own [contributing guide](https://github.com/Turfjs/turf-www/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Other Dependencies
|
||||
- Turf uses [pnpm 8](https://pnpm.io/8.x) and [lerna](https://lernajs.io/) during the testing, packaging and publishing process.
|
||||
- Lerna will be automatically installed when you run `pnpm install` in the root directory.
|
||||
- Pnpm will need to be installed on your computer, installers are available via the pnpm website. When using [corepack](https://nodejs.org/api/corepack.html), this is automatically installed when running `pnpm`.
|
||||
|
||||
## Financial contributions
|
||||
|
||||
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/turf).
|
||||
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
|
||||
### Contributors
|
||||
|
||||
Thank you to all the people who have already contributed to turf!
|
||||
<a href="graphs/contributors"><img src="https://opencollective.com/turf/contributors.svg?width=890" /></a>
|
||||
|
||||
|
||||
### Backers
|
||||
|
||||
Thank you to all our backers! [[Become a backer](https://opencollective.com/turf#backer)]
|
||||
|
||||
<a href="https://opencollective.com/turf#backers" target="_blank"><img src="https://opencollective.com/turf/backers.svg?width=890"></a>
|
||||
|
||||
|
||||
### Sponsors
|
||||
|
||||
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/turf#sponsor))
|
||||
|
||||
<a href="https://opencollective.com/turf/sponsor/0/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/1/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/2/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/3/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/4/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/5/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/6/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/7/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/8/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/9/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/9/avatar.svg"></a>
|
||||
@ -1,27 +0,0 @@
|
||||
## About Turf.js
|
||||
|
||||
[TurfJS](http://turfjs.org/) is a modular geospatial analysis library for designed for use in the browser as well as Node.js.
|
||||
We provide almost 150 modules for people to use freely in their applications.
|
||||
Our most [popular module](https://www.npmjs.com/package/@turf/helpers) is downloaded 50,000 times a week via npm.
|
||||
|
||||
|
||||
## Why we're looking for support
|
||||
|
||||
TurfJS is a community-driven project maintained by a small group of core contributors who work on the project in their spare time.
|
||||
Time is spent supporting users, improving documentation, fixing bugs as well as creating new modules.
|
||||
Your funding will directly go to development costs, marketing campaigns, promotional events & any other financial costs to operate & maintain TurfJS.
|
||||
|
||||
In particular, we're looking for corporate sponsors who use TurfJS in revenue-generating ways,
|
||||
either by creating applications for clients, or through use in an app used by customers.
|
||||
Of course individuals are welcome to support us as well if TurfJS has helped you :)
|
||||
|
||||
## 2017 Achievements
|
||||
|
||||
- Refactoring the codebase to support ES6 modules
|
||||
- Adding approx 70 new modules/functions
|
||||
- All new documentation
|
||||
|
||||
## Development goals for Turf.js in the coming year
|
||||
|
||||
- Removing our largest dependency (JSTS) to significantly reduce the size of our compiled code
|
||||
- Add new modules to bring us closer to feature parity with other geospatial libraries
|
||||
89
README.md
89
README.md
@ -15,98 +15,33 @@
|
||||
|
||||
***A modular geospatial engine written in JavaScript***
|
||||
|
||||
[turfjs.org](https://turfjs.org/)
|
||||
[Turf](https://turfjs.org) is a [JavaScript library](https://en.wikipedia.org/wiki/JavaScript_library) for [spatial analysis](https://en.wikipedia.org/wiki/Spatial_analysis). It includes traditional spatial operations, helper functions for creating [GeoJSON](https://geojson.org) data, and data classification and statistics tools. Turf can be added to your website as a client-side module, or you can [run Turf server-side](https://www.npmjs.com/package/@turf/turf) with [Node.js](https://nodejs.org/) (see below).
|
||||
|
||||
- - -
|
||||
|
||||
[Turf](https://turfjs.org) is a [JavaScript library](https://en.wikipedia.org/wiki/JavaScript_library) for [spatial analysis](https://en.wikipedia.org/wiki/Spatial_analysis). It includes traditional spatial operations, helper functions for creating [GeoJSON](https://geojson.org) data, and data classification and statistics tools. Turf can be added to your website as a client-side plugin, or you can [run Turf server-side](https://www.npmjs.com/package/@turf/turf) with [Node.js](https://nodejs.org/) (see below).
|
||||
## Getting Started
|
||||
|
||||
## Installation
|
||||
Read our [getting started guide](https://turfjs.org/docs/getting-started) to begin working with Turf.
|
||||
|
||||
### In Node.js
|
||||
Or explore the Turf API and examples at [turfjs.org](https://turfjs.org/).
|
||||
|
||||
```bash
|
||||
# get all of turf
|
||||
npm install @turf/turf
|
||||
## Runtime support
|
||||
|
||||
# or get individual packages
|
||||
npm install @turf/helpers
|
||||
npm install @turf/buffer
|
||||
```
|
||||
Turf is currently published to work with any reasonably modern Javascript runtime.
|
||||
|
||||
### In browser
|
||||
Node is a first class citizen, and we recommend using an [Active or Maintenance LTS](https://nodejs.org/en/about/previous-releases) release.
|
||||
|
||||
Download the [minified file](https://npmcdn.com/@turf/turf/turf.min.js), and include it in a script tag. This will expose a global variable named `turf`.
|
||||
|
||||
```html
|
||||
<script src="turf.min.js" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
You can also include it directly from a CDN:
|
||||
|
||||
```html
|
||||
<script src="https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js"></script>
|
||||
```
|
||||
|
||||
### TypeScript
|
||||
|
||||
TypeScript definitions are packaged with each module. No DefinitelyTyped packages required.
|
||||
|
||||
### Other languages
|
||||
|
||||
Ports of Turf.js are available in:
|
||||
|
||||
- [Java](https://github.com/mapbox/mapbox-java/tree/master/services-turf/src/main/java/com/mapbox/turf) (Android, Java SE)
|
||||
- > [The current to-do list for porting to Java](https://github.com/mapbox/mapbox-java/blob/master/docs/turf-port.md)
|
||||
- [Swift](https://github.com/mapbox/turf-swift/) (iOS, macOS, tvOS, watchOS, Linux)
|
||||
- > Turf for Swift is **experimental** and its public API is subject to change. Please use with care.
|
||||
- [Dart/Flutter](https://github.com/dartclub/turf_dart) (Dart Web, Dart Native; Flutter for iOS, Android, macOS, Windows, Linux, Web)
|
||||
- > The Turf for Dart port is still in progress, the implementation status can be found in the [README](https://github.com/dartclub/turf_dart#components).
|
||||
- - -
|
||||
|
||||
## Data in Turf
|
||||
|
||||
Turf uses <a href='https://geojson.org/'>GeoJSON</a> for all geographic data. Turf expects the data to be standard <a href='https://en.wikipedia.org/wiki/World_Geodetic_System'>WGS84</a> longitude, latitude coordinates. Check out <a href='https://geojson.io/#id=gist:anonymous/844f013aae8354eb889c&map=12/38.8955/-77.0135'>geojson.io</a> for a tool to easily create this data.
|
||||
|
||||
> **NOTE:** Turf expects data in (longitude, latitude) order per the GeoJSON standard.
|
||||
|
||||
Most Turf functions work with GeoJSON features. These are pieces of data that represent a collection of properties (ie: population, elevation, zipcode, etc.) along with a geometry. GeoJSON has several geometry types such as:
|
||||
|
||||
* Point
|
||||
* LineString
|
||||
* Polygon
|
||||
|
||||
Turf provides a few geometry functions of its own. These are nothing more than simple (and optional) wrappers that output plain old GeoJSON. For example, these two methods of creating a point are functionally equivalent:
|
||||
|
||||
```js
|
||||
// Note order: longitude, latitude.
|
||||
var point1 = turf.point([-73.988214, 40.749128]);
|
||||
|
||||
var point2 = {
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
// Note order: longitude, latitude.
|
||||
coordinates: [-73.988214, 40.749128]
|
||||
},
|
||||
properties: {}
|
||||
};
|
||||
```
|
||||
Other runtimes, such as Deno or Bun, are not officially supported. We would be very interested to hear your experiences though.
|
||||
|
||||
## Browser support
|
||||
|
||||
Turf packages are compiled to target ES2017. However, the browser version of @turf/turf is transpiled to also include support for IE11. If you are using these packages and need to target IE11, please transpile the following packages as part of your build:
|
||||
Turf uses Babel to transpile to a JavaScript version usable by most
|
||||
modern browsers. Any browser that matches the following criteria as defined by [Browserslist](https://github.com/browserslist/browserslist):
|
||||
|
||||
```
|
||||
@turf/*
|
||||
robust-predicates
|
||||
rbush
|
||||
tinyqueue
|
||||
```
|
||||
[> 0.25%, last 2 versions, fully supports es5, not dead](https://browsersl.ist/#q=%3E+0.25%25%2C+last+2+versions%2C+fully+supports+es5%2C+not+dead)
|
||||
|
||||
## Contributors
|
||||
|
||||
This project exists thanks to all the people who contribute. If you are interested in helping, check out the [Contributing Guide](CONTRIBUTING.md).
|
||||
This project exists thanks to all the people who contribute. If you are interested in helping, check out the [Contributing Guide](docs/CONTRIBUTING.md).
|
||||
|
||||
<a href="https://github.com/Turfjs/turf/graphs/contributors"><img src="https://opencollective.com/turf/contributors.svg?width=890&button=false" /></a>
|
||||
|
||||
|
||||
30
SEE_ALSO.md
30
SEE_ALSO.md
@ -1,30 +0,0 @@
|
||||
Geospatial analysis software has a few prominent strains:
|
||||
|
||||
* Esri & other closed-source, proprietary libraries
|
||||
* Open source libraries in the lineage of JTS
|
||||
|
||||
# Python
|
||||
|
||||
* [Shapely](https://pypi.python.org/pypi/Shapely) is a friendly Python binding to GEOS
|
||||
* [geopandas](http://geopandas.org/) is a layer on top of Shapely and Fiona for PostGIS-like tasks
|
||||
|
||||
# C++
|
||||
|
||||
* [GEOS](http://trac.osgeo.org/geos/) is a port of JTS to C++
|
||||
|
||||
# JavaScript
|
||||
|
||||
* [jsts](https://github.com/bjornharrtell/jsts) is a port of JTS to JavaScript
|
||||
|
||||
# Java
|
||||
|
||||
* [JTS](http://tsusiatsoftware.net/jts/main.html)
|
||||
|
||||
# Go
|
||||
|
||||
* [gogeos](http://paulsmith.github.io/gogeos/) is a Go binding to GEOS
|
||||
* [go.geo](https://github.com/paulmach/go.geo) is a pure-Go implementation of some geometry operations and primitives
|
||||
|
||||
# Postgres
|
||||
|
||||
* [PostGIS](http://postgis.net/) provides geospatial operations within the Postgres database. Advanced operations rely on GEOS.
|
||||
133
docs/CODE_OF_CONDUCT.md
Normal file
133
docs/CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,133 @@
|
||||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official email address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
[@morganherlocker](https://github.com/morganherlocker) or [@tmcw](https://github.com/tmcw).
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
219
docs/CONTRIBUTING.md
Normal file
219
docs/CONTRIBUTING.md
Normal file
@ -0,0 +1,219 @@
|
||||
# Contributing to Turf
|
||||
|
||||
## Getting Started
|
||||
|
||||
One of the most important things you can do is report bugs. Please reference [how to report a bug](https://macwright.com/sites/polite.technology/reportabug) and when opening an [issue](https://github.com/Turfjs/turf/issues), follow the template.
|
||||
|
||||
To propose an enhancement for Turf, it's usually best to [start a discussion](https://github.com/Turfjs/turf/discussions) to work through the requirements. Unless you know exactly what you need! In which case [open an issue](https://github.com/Turfjs/turf/issues) to request it.
|
||||
|
||||
To make a code contribution, follow the steps for [how to contribute](#how-to-contribute).
|
||||
|
||||
## Architecture
|
||||
|
||||
- GeoJSON is the lingua franca of Turf. It should be used as the data structure for anything that can be represented as geography.
|
||||
- Turf is broken into many submodules, or packages. These are found in the `packages` directory prefixed with "turf-".
|
||||
- Turf packages are small, generally containing a single exported function.
|
||||
- Many Turf packages depend on other lower level Turf packages.
|
||||
|
||||
## How to contribute
|
||||
|
||||
The best way for a new contributor to help with Turf is to find an open issue, fix it, and then share that back to the project via a pull request (PR). A maintainer will review your PR and get it merged with the rest of the code.
|
||||
|
||||
Here is a great article on how to fork a repo, and start contributing to Turf.
|
||||
|
||||
If you'd like to become a core contributor, just start making contributions, and inquire.
|
||||
|
||||
### Local Setup
|
||||
|
||||
Once you've cloned a Turf repository, and have a terminal open and currenty in the top-level turf directory. Run the following:
|
||||
- `git checkout master` (if not already)
|
||||
- `corepack enable pnpm`
|
||||
- enable pnpm as a package manager. Requires Node 16+. Alternatively just `npm install -g pnpm`.
|
||||
- `pnpm install`
|
||||
- install dependencies and build packages
|
||||
- `pnpm test`
|
||||
- run all tests and linters
|
||||
|
||||
You're now ready to contribute.
|
||||
|
||||
<details>
|
||||
<summary>Structure of a Turf package</summary>
|
||||
<br>
|
||||
|
||||
Turf packages all live under the `packages` directory. For example `packages/turf-area`. Here's how they are structured.
|
||||
|
||||
```
|
||||
turf-<PACKAGE NAME>
|
||||
│ index.ts
|
||||
│ bench.ts
|
||||
│ test.ts
|
||||
│ package.json
|
||||
│ README.md
|
||||
│ LICENSE
|
||||
│
|
||||
└───test
|
||||
│
|
||||
├───in
|
||||
│ points.geojson
|
||||
│
|
||||
└───out
|
||||
points.geojson
|
||||
```
|
||||
|
||||
* `index.ts` - This file contains the definition of the function including [TypeScript](https://www.typescriptlang.org/) types, function implementation, the embedded [JSDocs](http://usejsdoc.org) documentation, and finally the single exported function that the package provides.
|
||||
* `bench.ts` - This file uses [Benchmark](https://benchmarkjs.com/) to establish benchmark performance tests for your function.
|
||||
* `test.ts` - This file includes your [tape](https://github.com/substack/tape)
|
||||
unit tests. Tests can either be traditional code based tests, or tests that pull in data files and compare inputs to outputs (see below).
|
||||
* `package.json` - The [node](http://nodejs.org) metadata container file.
|
||||
Packages imported in `index.ts` should be listed here under `dependencies`,
|
||||
and packages used in `test.ts` or `bench.ts` should be listed under
|
||||
`devDependencies`.
|
||||
* `README.md` - This README is generated _automatically_ by running `pnpm run
|
||||
docs`. **DO NOT edit this file**.
|
||||
* `LICENCE` - Like the README, this file should not be edited.
|
||||
* `test/` - This directory holds the GeoJSON files that provide data for
|
||||
dynamic tests. Input data in `./test/in`, and expected output data in `./test/out`.
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Development tips</summary>
|
||||
<br>
|
||||
Work in a feature branch when possible
|
||||
- `git checkout -b my-feature`
|
||||
- Create it right away off of master.
|
||||
- This allows you to keep your local master branch clean and in sync with the official remote. This will ease your ability to keep your local repo up to date with changes other people have made while you work on your feature.
|
||||
|
||||
As you make code changes
|
||||
- Regularly run `pnpm test` in whatever package you are working in to avoid unintended bugs.
|
||||
- Occasionally run `pnpm test` at the top-level directory to run test for all packages, to make sure you haven't introduced a problem that affects another package.
|
||||
</details>
|
||||
|
||||
## Preparing a pull request
|
||||
|
||||
A simple, complete pull request is more likely to get merged.
|
||||
|
||||
<details>
|
||||
<summary>But I don't know how</summary>
|
||||
<br>
|
||||
If you don't know how to make a solid PR, submit a draft PR and ask for feedback. Take on any feedback to improve the PR ready. There may be multiple rounds of feedback. While this seems tedious it greatly reduces the risk of someone else
|
||||
having to revisit the same code any time soon.
|
||||
</details>
|
||||
|
||||
### Pull Request Checklist
|
||||
- Briefly summarize the need and solution. Link to the issue it's resolving if exists.
|
||||
- Add tests. Even for bug fixes. A simple test case that reproduces the issue and demonstrates it's fixed.
|
||||
- Update JSDoc comments if the function signature changes or docs need improvement (See for example `packages/turf-area/index.ts`)
|
||||
- Run a full `npm test` at root level, confirming no cross-package issues. If you don't catch this now, the Github CI will.
|
||||
|
||||
### Guidelines
|
||||
|
||||
- Feel free to [ask](#getting-started) if a feature/enhancement is needed/wanted before doing the work.
|
||||
- Keep pull requests small and focused.
|
||||
- Avoid large dependencies at all costs.
|
||||
- Make sure that your code can run in the browser (ie: don't make calls to external services, don't hit the filesystem, etc.).
|
||||
|
||||
### Documentation
|
||||
|
||||
The package README.md files and https://turfjs.org API docs are auto-generated from JSDoc comments in each packages' source file.
|
||||
|
||||
As a contributor, all you need to do is keep the JSDoc comments up to date, and the rest is automated. For example if you change a top-level Turf functions signature (params, return type) or just want to improve the descriptiveness of the docs.
|
||||
|
||||
JSDoc comments are found in the top-level index file for each package (for example `packages/turf-area/index.ts`). Look for the `@name`, `@params`, `@returns`, `@example` tags.
|
||||
|
||||
## Code Style
|
||||
|
||||
We have lots of tooling dedicated to ensuring consistent code. We use [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/), and [ESLint](https://eslint.org/) to help us deliver quality code. These are checked by the build system and should be enforced at commit time by [Husky](https://typicode.github.io/husky/#/).
|
||||
|
||||
Most packages are written in TypeScript, while a few plain Javascript still linger. You can generally use modern Javascript when modifying Turf itself as all exported code is transpiled to (currently es2017).
|
||||
|
||||
Code for consumption by browsers is transpiled by Babel as described in the README.
|
||||
|
||||
Making sure that the monorepo packages can be managed at scale, we use [Monorepolint](https://github.com/monorepolint/monorepolint) to programmatically ensure the individual packages remain consistent.
|
||||
|
||||
## Documentation
|
||||
|
||||
- API docs for each turf package are extracted from JSDoc comments in the source code into the top-level README.md files. README's are automatically updated on commit via a pre-commit hook.
|
||||
|
||||
Should you want to generate new README files manually, use `pnpm run docs`:
|
||||
- **inside a package:** will generate the docs for that package.
|
||||
- **from root folder:** will generate docs for all package.
|
||||
|
||||
### Documentation - Examples
|
||||
|
||||
**Build docs for only `@turf/center`**
|
||||
|
||||
```bash
|
||||
$ cd ./turf/packages/turf-center
|
||||
$ pnpm run docs
|
||||
|
||||
> @turf/center@5.0.4 docs /Users/mac/Github/turf/packages/turf-center
|
||||
> node ../../scripts/generate-readmes
|
||||
|
||||
Building Docs: @turf/center
|
||||
```
|
||||
|
||||
**Builds docs for all packages**
|
||||
|
||||
```bash
|
||||
$ cd ./turf
|
||||
$ pnpm run docs
|
||||
> @ docs /Users/mac/Github/turf
|
||||
> tsx ./scripts/generate-readmes
|
||||
|
||||
Building Docs: @turf/along
|
||||
Building Docs: @turf/area
|
||||
Building Docs: @turf/bbox-clip
|
||||
Building Docs: @turf/bbox-polygon
|
||||
Building Docs: @turf/bbox
|
||||
Building Docs: @turf/bearing
|
||||
Building Docs: @turf/bezier-spline
|
||||
Building Docs: @turf/boolean-clockwise
|
||||
....
|
||||
```
|
||||
|
||||
### Public website
|
||||
|
||||
The [turfjs.org](https://turfjs.org/) website is managed in a [separate repo](https://github.com/Turfjs/turf-www) with its own [contributing guide](https://github.com/Turfjs/turf-www/blob/master/CONTRIBUTING.md).
|
||||
|
||||
## Other Dependencies
|
||||
|
||||
- Turf uses [pnpm](https://pnpm.io/) and [lerna](https://lernajs.io/) during the testing, packaging and publishing process.
|
||||
- Lerna will be automatically installed when you run `pnpm install` in the root directory.
|
||||
- Pnpm will need to be installed on your computer, installers are available via the pnpm website. When using [corepack](https://nodejs.org/api/corepack.html), this is automatically installed when running `pnpm`.
|
||||
|
||||
## Financial contributions
|
||||
|
||||
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/turf).
|
||||
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
|
||||
### Contributors
|
||||
|
||||
Thank you to all the people who have already contributed to turf!
|
||||
<a href="graphs/contributors"><img src="https://opencollective.com/turf/contributors.svg?width=890" /></a>
|
||||
|
||||
|
||||
### Backers
|
||||
|
||||
Thank you to all our backers! [[Become a backer](https://opencollective.com/turf#backer)]
|
||||
|
||||
<a href="https://opencollective.com/turf#backers" target="_blank"><img src="https://opencollective.com/turf/backers.svg?width=890"></a>
|
||||
|
||||
|
||||
### Sponsors
|
||||
|
||||
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/turf#sponsor))
|
||||
|
||||
<a href="https://opencollective.com/turf/sponsor/0/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/1/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/2/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/3/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/4/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/5/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/6/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/7/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/8/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/turf/sponsor/9/website" target="_blank"><img src="https://opencollective.com/turf/sponsor/9/avatar.svg"></a>
|
||||
30
docs/OPEN_COLLECTIVE.md
Normal file
30
docs/OPEN_COLLECTIVE.md
Normal file
@ -0,0 +1,30 @@
|
||||
## About Turf.js
|
||||
|
||||
[TurfJS](http://turfjs.org/) is a modular geospatial analysis library designed for use in the browser as well as Node.js.
|
||||
We provide almost 120 modules for people to use freely in their applications.
|
||||
Our most [popular module](https://www.npmjs.com/package/@turf/helpers) is downloaded 4,200,000 times a week via npm.
|
||||
|
||||
|
||||
## Why we're looking for support
|
||||
|
||||
TurfJS is a community-driven project maintained by a small group of core contributors who work on the project in their spare time.
|
||||
Time is spent investigating issues, supporting users, improving documentation, fixing bugs, and adding new functionality.
|
||||
Your funding will go directly to development costs, marketing campaigns, promotional events, and other expenses needed to maintain and promote TurfJS.
|
||||
|
||||
In particular, we're looking for corporate sponsors who use TurfJS in revenue-generating ways, either by creating applications for clients, or through use in an app used by customers.
|
||||
Of course individuals are welcome to support us as well if TurfJS has helped you :)
|
||||
|
||||
## 2024 Achievements
|
||||
|
||||
- First major release in a few years
|
||||
- Modernised build and publishing infrastructure
|
||||
- Merged many PRs that had been on hold
|
||||
- Resolved several long standing bugs
|
||||
- Overhauled the [documentation website](https://turfjs.org)
|
||||
|
||||
## Goals for 2025
|
||||
|
||||
- Continue to work through the bug backlog
|
||||
- Release more often
|
||||
- Encourage more contributors by engaging with PRs
|
||||
- Resolve disparities between planar and spherical modes
|
||||
76
docs/PUBLISHING.md
Normal file
76
docs/PUBLISHING.md
Normal file
@ -0,0 +1,76 @@
|
||||
## Publishing
|
||||
|
||||
### Prerelease
|
||||
|
||||
A [prerelease](https://github.com/Turfjs/turf/blob/master/.github/workflows/prerelease.yml) action is available that publishes a canary release for every commit or PR merged to the master branch. However, this action is only [enabled](https://github.com/Turfjs/turf/actions/workflows/prerelease.yml) when needed.
|
||||
|
||||
When used, it publishes an alpha release to NPM (e.g. `7.0.0-alpha.116` where 116 is the number of commits to master since the last release tag).
|
||||
- The version number is calculated by a combination of the output of `git describe` and the `publish:prerelease` script in the root package.json. It is typically setup to do a `minor` prerelease, but can be changed, such as prior to a `major` release.
|
||||
|
||||
### Release
|
||||
|
||||
A turf release is initiated from your local computer, and then built and published remotely via a github actions.
|
||||
|
||||
To make a release as a core contributor, you will need:
|
||||
- Turf repository write permission
|
||||
- Turf npm organization publish permission
|
||||
- A clean local copy of the Turf Github repository (not a fork!). Starting with a fresh clone will ensure it's clean.
|
||||
- Depending on your auth method
|
||||
- `git clone git@github.com:Turfjs/turf.git turf-release`
|
||||
- or `git clone https://github.com/Turfjs/turf.git turf-release`
|
||||
- `cd turf-release` - start at the top-level of the repo
|
||||
- `pnpm install`
|
||||
- `pnpm test` - make sure everything is passing
|
||||
|
||||
- If you choose to clean up an existing copy instead, be very careful:
|
||||
- `git remote -v` - verify your remote origin points to `https://github.com/Turfjs/turf.git`
|
||||
- `git checkout master`
|
||||
- `git reset --hard` - reset your local working copy, will lose any uncommitted or unstashed work!
|
||||
- `git fetch origin` - fetch latest commits
|
||||
- `git rev-list master...origin/master` - verify local master in sync with remote, command output should be empty
|
||||
- `pnpm install`
|
||||
- `pnpm test` - make sure everything is passing
|
||||
|
||||
Before release:
|
||||
- If necessary, make and merge a PR with any last minute housekeeping items.
|
||||
- Turf's documentation (README.md files) should already be up to date as it is generated automatically on commit from JSDoc comments in source files.
|
||||
- Review PR's and decide the new version number to be published. See [semantic versioning](https://semver.org/).
|
||||
|
||||
Run the following release commands, replacing `7.0.0` with your version number:
|
||||
|
||||
- create a release branch and switch to it. All building, tagging and publishing will be done on the release branch, and then merged back into master in a later step.
|
||||
- `git checkout origin/master -b release-7.0.0`
|
||||
|
||||
- increment the version number of all packages, and create a local commit, without pushing to origin. This will also create a release tag.
|
||||
- `pnpm lerna version --no-commit-hooks --no-push 7.0.0`
|
||||
|
||||
- Push the release branch and the release tag.
|
||||
- `git push origin release-7.0.0 --follow-tags`
|
||||
- Pushing the tag will trigger the Github [release](https://github.com/Turfjs/turf/blob/master/.github/workflows/release.yml) action which you can view the status of at - https://github.com/Turfjs/turf/actions. If successful, a new [version](https://www.npmjs.com/package/@turf/turf?activeTab=versions) of all turf packages will have been published on NPM.
|
||||
|
||||
- If the release action was not successful
|
||||
- commit any changes to master to fix it.
|
||||
- Make a [prerelease](#prerelease) if helpful to make sure the release action is successful.
|
||||
- Then reset by deleting your tag and branch locally and remotely.
|
||||
- `git push --delete origin v7.1.0`
|
||||
- `git tag --delete v7.1.0`
|
||||
- `git push -d origin release-7.0.0`
|
||||
- `git branch -d release-7.0.0`
|
||||
- Now redo the steps above starting with creating "A clean local copy of the Turf Github repository"
|
||||
|
||||
- If the release action was successful, now create a Pull Request for the release to merge back to master.
|
||||
- You may be given a link in the output of the branch/tag push command to create the PR.
|
||||
- If you don't get this message, just go to https://github.com/Turfjs/turf/pulls and you should be prompted at the top to create a PR for this new branch you just pushed.
|
||||
- If that prompt doesn't appear, then just create a new pull request from the PR page and make sure the title is the version number e.g. `v7.0.0` and that it is merging your release branch -> to master.
|
||||
- Here is an example PR - https://github.com/Turfjs/turf/pull/2615.
|
||||
- Get approval for the release PR, then "Squash and merge" it.
|
||||
- Do not delete this branch in Github after merging, the release tag points to it. If you do, click "Restore branch" at the bottom of the merged PR.
|
||||
|
||||
#### Follow-on steps
|
||||
- As part of the release action, a draft Github release will have been created at https://github.com/Turfjs/turf/releases with an auto-generated changelog.
|
||||
- Edit and add to the release notes for readability and completeness, specifically noting any breaking changes. Use past releases as a guide.
|
||||
- Be sure to "Save draft" each time, then ask for a review or edits from other contributors.
|
||||
- Try not to leave the notes unpublished more than a day, people rely on these notes for upgrading.
|
||||
- Once ready, click `Publish release`. This will make the release notes publicly accessible and notify all watchers of the project.
|
||||
- You can edit and republish your release notes after this, but that will likely notify followers, so best to get it right the first time.
|
||||
- Release a new version of the [API docs](https://github.com/Turfjs/turf-www/blob/master/CONTRIBUTING.md) for the https://turfjs.org website.
|
||||
13
docs/SECURITY.md
Normal file
13
docs/SECURITY.md
Normal file
@ -0,0 +1,13 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Security updates are applied only to the latest release.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you have discovered a security vulnerability in this project, please report it privately. **Do not disclose it as a public issue.** This gives us time to work with you to fix the issue before public exposure, reducing the chance that the exploit will be used before a patch is released.
|
||||
|
||||
Please disclose it at [security advisory](https://github.com/Turfjs/turf/security/advisories/new).
|
||||
|
||||
This project is maintained by a team of volunteers on a reasonable-effort basis. As such, please give us at least 90 days to work on a fix before public exposure.
|
||||
40
docs/SEE_ALSO.md
Normal file
40
docs/SEE_ALSO.md
Normal file
@ -0,0 +1,40 @@
|
||||
## Ports of Turf.js
|
||||
|
||||
Turf has been ported to several other languages, listed below.
|
||||
|
||||
- [Java](https://github.com/mapbox/mapbox-java/tree/master/services-turf/src/main/java/com/mapbox/turf) (Android, Java SE)
|
||||
- > [The current to-do list for porting to Java](https://github.com/mapbox/mapbox-java/blob/master/docs/turf-port.md)
|
||||
- [Swift](https://github.com/mapbox/turf-swift/) (iOS, macOS, tvOS, watchOS, Linux)
|
||||
- > Turf for Swift is **experimental** and its public API is subject to change. Please use with care.
|
||||
- [Dart/Flutter](https://github.com/dartclub/turf_dart) (Dart Web, Dart Native; Flutter for iOS, Android, macOS, Windows, Linux, Web)
|
||||
- > The Turf for Dart port is still in progress, the implementation status can be found in the [README](https://github.com/dartclub/turf_dart#components).
|
||||
|
||||
## Other Geospatial Analysis Software
|
||||
|
||||
Below are other geospatial options that aren't specifically ports of Turf.
|
||||
|
||||
### Python
|
||||
|
||||
* [Shapely](https://pypi.python.org/pypi/Shapely) is a friendly Python binding to GEOS
|
||||
* [geopandas](https://geopandas.org/) is a layer on top of Shapely and Fiona for PostGIS-like tasks
|
||||
|
||||
### C++
|
||||
|
||||
* [GEOS](https://libgeos.org/) is a port of JTS to C++
|
||||
|
||||
### JavaScript
|
||||
|
||||
* [jsts](https://github.com/bjornharrtell/jsts) is a port of JTS to JavaScript
|
||||
|
||||
### Java
|
||||
|
||||
* [JTS](https://www.tsusiatsoftware.net/jts/main.html)
|
||||
|
||||
### Go
|
||||
|
||||
* [gogeos](https://paulsmith.github.io/gogeos/) is a Go binding to GEOS
|
||||
* [go.geo](https://github.com/paulmach/go.geo) is a pure-Go implementation of some geometry operations and primitives
|
||||
|
||||
### Postgres
|
||||
|
||||
* [PostGIS](https://postgis.net/) provides geospatial operations within the Postgres database. Advanced operations rely on GEOS.
|
||||
@ -1,165 +1,167 @@
|
||||
toc:
|
||||
- name: Measurement
|
||||
- along
|
||||
- area
|
||||
- bbox
|
||||
- bboxPolygon
|
||||
- bearing
|
||||
- center
|
||||
- centerOfMass
|
||||
- centroid
|
||||
- destination
|
||||
- distance
|
||||
- envelope
|
||||
- length
|
||||
- midpoint
|
||||
- pointOnFeature
|
||||
- polygonTangents
|
||||
- pointToLineDistance
|
||||
- rhumbBearing
|
||||
- rhumbDestination
|
||||
- rhumbDistance
|
||||
- square
|
||||
- greatCircle
|
||||
- name: Coordinate Mutation
|
||||
- cleanCoords
|
||||
- flip
|
||||
- rewind
|
||||
- round
|
||||
- truncate
|
||||
- name: Transformation
|
||||
- bboxClip
|
||||
- bezierSpline
|
||||
- buffer
|
||||
- circle
|
||||
- clone
|
||||
- concave
|
||||
- convex
|
||||
- difference
|
||||
- dissolve
|
||||
- intersect
|
||||
- lineOffset
|
||||
- polygonSmooth
|
||||
- simplify
|
||||
- tesselate
|
||||
- transformRotate
|
||||
- transformTranslate
|
||||
- transformScale
|
||||
- union
|
||||
- voronoi
|
||||
- name: Feature Conversion
|
||||
- combine
|
||||
- explode
|
||||
- flatten
|
||||
- lineToPolygon
|
||||
- polygonize
|
||||
- polygonToLine
|
||||
- name: Misc
|
||||
- kinks
|
||||
- lineArc
|
||||
- lineChunk
|
||||
- lineIntersect
|
||||
- lineOverlap
|
||||
- lineSegment
|
||||
- lineSlice
|
||||
- lineSliceAlong
|
||||
- lineSplit
|
||||
- mask
|
||||
- nearestPointOnLine
|
||||
- sector
|
||||
- shortestPath
|
||||
- unkinkPolygon
|
||||
- name: Helper
|
||||
- featureCollection
|
||||
- feature
|
||||
- geometryCollection
|
||||
- lineString
|
||||
- multiLineString
|
||||
- multiPoint
|
||||
- multiPolygon
|
||||
- point
|
||||
- polygon
|
||||
- name: Random
|
||||
- randomPosition
|
||||
- randomPoint
|
||||
- randomLineString
|
||||
- randomPolygon
|
||||
- name: Data
|
||||
- sample
|
||||
- name: Interpolation
|
||||
- interpolate
|
||||
- isobands
|
||||
- isolines
|
||||
- planepoint
|
||||
- tin
|
||||
- name: Joins
|
||||
- pointsWithinPolygon
|
||||
- tag
|
||||
- name: Grids
|
||||
- hexGrid
|
||||
- pointGrid
|
||||
- squareGrid
|
||||
- triangleGrid
|
||||
- name: Classification
|
||||
- nearestPoint
|
||||
- name: Aggregation
|
||||
- collect
|
||||
- clustersDbscan
|
||||
- clustersKmeans
|
||||
- name: Meta
|
||||
- coordAll
|
||||
- coordEach
|
||||
- coordReduce
|
||||
- featureEach
|
||||
- featureReduce
|
||||
- flattenEach
|
||||
- flattenReduce
|
||||
- getCoord
|
||||
- getCoords
|
||||
- getGeom
|
||||
- getType
|
||||
- geomEach
|
||||
- geomReduce
|
||||
- propEach
|
||||
- propReduce
|
||||
- segmentEach
|
||||
- segmentReduce
|
||||
- getCluster
|
||||
- clusterEach
|
||||
- clusterReduce
|
||||
- name: Assertions
|
||||
- collectionOf
|
||||
- containsNumber
|
||||
- geojsonType
|
||||
- featureOf
|
||||
- name: Booleans
|
||||
- booleanClockwise
|
||||
- booleanConcave
|
||||
- booleanContains
|
||||
- booleanCrosses
|
||||
- booleanDisjoint
|
||||
- booleanEqual
|
||||
- booleanIntersects
|
||||
- booleanOverlap
|
||||
- booleanParallel
|
||||
- booleanPointInPolygon
|
||||
- booleanPointOnLine
|
||||
- booleanTouches
|
||||
- booleanWithin
|
||||
- name: Unit Conversion
|
||||
- bearingToAzimuth
|
||||
- azimuthToBearing
|
||||
- convertArea
|
||||
- convertLength
|
||||
- degreesToRadians
|
||||
- lengthToRadians
|
||||
- lengthToDegrees
|
||||
- radiansToLength
|
||||
- radiansToDegrees
|
||||
- toMercator
|
||||
- toWgs84
|
||||
Measurement:
|
||||
- along
|
||||
- area
|
||||
- bbox
|
||||
- bboxPolygon
|
||||
- bearing
|
||||
- center
|
||||
- centerOfMass
|
||||
- centroid
|
||||
- destination
|
||||
- distance
|
||||
- envelope
|
||||
- length
|
||||
- midpoint
|
||||
- pointOnFeature
|
||||
- polygonTangents
|
||||
- pointToLineDistance
|
||||
- pointToPolygonDistance
|
||||
- rhumbBearing
|
||||
- rhumbDestination
|
||||
- rhumbDistance
|
||||
- square
|
||||
- greatCircle
|
||||
Coordinate Mutation:
|
||||
- cleanCoords
|
||||
- flip
|
||||
- rewind
|
||||
- round
|
||||
- truncate
|
||||
Transformation:
|
||||
- bboxClip
|
||||
- bezierSpline
|
||||
- buffer
|
||||
- circle
|
||||
- clone
|
||||
- concave
|
||||
- convex
|
||||
- difference
|
||||
- dissolve
|
||||
- intersect
|
||||
- lineOffset
|
||||
- polygonSmooth
|
||||
- simplify
|
||||
- tesselate
|
||||
- transformRotate
|
||||
- transformTranslate
|
||||
- transformScale
|
||||
- union
|
||||
- voronoi
|
||||
Feature Conversion:
|
||||
- combine
|
||||
- explode
|
||||
- flatten
|
||||
- lineToPolygon
|
||||
- polygonize
|
||||
- polygonToLine
|
||||
Misc:
|
||||
- kinks
|
||||
- lineArc
|
||||
- lineChunk
|
||||
- lineIntersect
|
||||
- lineOverlap
|
||||
- lineSegment
|
||||
- lineSlice
|
||||
- lineSliceAlong
|
||||
- lineSplit
|
||||
- mask
|
||||
- nearestPointOnLine
|
||||
- sector
|
||||
- shortestPath
|
||||
- unkinkPolygon
|
||||
Helper:
|
||||
- featureCollection
|
||||
- feature
|
||||
- geometryCollection
|
||||
- lineString
|
||||
- multiLineString
|
||||
- multiPoint
|
||||
- multiPolygon
|
||||
- point
|
||||
- polygon
|
||||
Random:
|
||||
- randomPosition
|
||||
- randomPoint
|
||||
- randomLineString
|
||||
- randomPolygon
|
||||
Data:
|
||||
- sample
|
||||
Interpolation:
|
||||
- interpolate
|
||||
- isobands
|
||||
- isolines
|
||||
- planepoint
|
||||
- tin
|
||||
Joins:
|
||||
- pointsWithinPolygon
|
||||
- tag
|
||||
Grids:
|
||||
- hexGrid
|
||||
- pointGrid
|
||||
- squareGrid
|
||||
- triangleGrid
|
||||
Classification:
|
||||
- nearestPoint
|
||||
Aggregation:
|
||||
- collect
|
||||
- clustersDbscan
|
||||
- clustersKmeans
|
||||
Meta:
|
||||
- coordAll
|
||||
- coordEach
|
||||
- coordReduce
|
||||
- featureEach
|
||||
- featureReduce
|
||||
- flattenEach
|
||||
- flattenReduce
|
||||
- getCoord
|
||||
- getCoords
|
||||
- getGeom
|
||||
- getType
|
||||
- geomEach
|
||||
- geomReduce
|
||||
- propEach
|
||||
- propReduce
|
||||
- segmentEach
|
||||
- segmentReduce
|
||||
- getCluster
|
||||
- clusterEach
|
||||
- clusterReduce
|
||||
Assertions:
|
||||
- collectionOf
|
||||
- containsNumber
|
||||
- geojsonType
|
||||
- featureOf
|
||||
Booleans:
|
||||
- booleanClockwise
|
||||
- booleanConcave
|
||||
- booleanContains
|
||||
- booleanCrosses
|
||||
- booleanDisjoint
|
||||
- booleanEqual
|
||||
- booleanIntersects
|
||||
- booleanOverlap
|
||||
- booleanParallel
|
||||
- booleanPointInPolygon
|
||||
- booleanPointOnLine
|
||||
- booleanTouches
|
||||
- booleanWithin
|
||||
Unit Conversion:
|
||||
- bearingToAzimuth
|
||||
- azimuthToBearing
|
||||
- convertArea
|
||||
- convertLength
|
||||
- degreesToRadians
|
||||
- lengthToRadians
|
||||
- lengthToDegrees
|
||||
- radiansToLength
|
||||
- radiansToDegrees
|
||||
- toMercator
|
||||
- toWgs84
|
||||
paths:
|
||||
GeoJSON: "https://tools.ietf.org/html/rfc7946#section-3"
|
||||
GeoJsonProperties: "https://tools.ietf.org/html/rfc7946#section-3.2"
|
||||
GeometryCollection: "https://tools.ietf.org/html/rfc7946#section-3.1.8"
|
||||
Point: "https://tools.ietf.org/html/rfc7946#section-3.1.2"
|
||||
Points: "https://tools.ietf.org/html/rfc7946#section-3.1.2"
|
||||
|
||||
87
eslint.config.mjs
Normal file
87
eslint.config.mjs
Normal file
@ -0,0 +1,87 @@
|
||||
import globals from "globals";
|
||||
import js from "@eslint/js";
|
||||
import tsEslint from "typescript-eslint";
|
||||
import prettierRecommended from "eslint-plugin-prettier/recommended";
|
||||
|
||||
export default tsEslint.config(
|
||||
js.configs.recommended,
|
||||
tsEslint.configs.recommended,
|
||||
{
|
||||
ignores: [
|
||||
"**/dist/**/*",
|
||||
"**/node_modules",
|
||||
"packages/turf/turf.js",
|
||||
"packages/turf/turf.min.js",
|
||||
"packages/turf/test.example.js",
|
||||
],
|
||||
},
|
||||
{
|
||||
plugins: {
|
||||
"@typescript-eslint": tsEslint.plugin,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
},
|
||||
|
||||
parser: tsEslint.parser,
|
||||
ecmaVersion: 6,
|
||||
sourceType: "module",
|
||||
},
|
||||
|
||||
rules: {
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
argsIgnorePattern: "^_",
|
||||
},
|
||||
],
|
||||
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
"no-constant-condition": "off",
|
||||
"no-redeclare": "off",
|
||||
"no-var": "off",
|
||||
"prefer-const": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ["packages/*/types.ts", "packages/*/test.ts"],
|
||||
|
||||
rules: {
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-expressions": "off",
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
"**/.eslintrc.js",
|
||||
"packages/*/bench.js",
|
||||
"packages/*/test.js",
|
||||
"packages/turf/rollup.config.js",
|
||||
"scripts/check-dependencies.js",
|
||||
],
|
||||
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
files: [
|
||||
"packages/turf-isobands/lib/marchingsquares-isobands.js",
|
||||
"packages/turf-isolines/lib/marchingsquares-isocontours.js",
|
||||
],
|
||||
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
},
|
||||
},
|
||||
},
|
||||
prettierRecommended
|
||||
);
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||
"npmClient": "pnpm",
|
||||
"version": "7.0.0",
|
||||
"version": "7.2.0",
|
||||
"command": {
|
||||
"publish": {
|
||||
"registry": "https://registry.npmjs.org"
|
||||
|
||||
51
package.json
51
package.json
@ -27,40 +27,41 @@
|
||||
],
|
||||
"*": "prettier --write --ignore-unknown"
|
||||
},
|
||||
"packageManager": "pnpm@8.15.8+sha512.d1a029e1a447ad90bc96cd58b0fad486d2993d531856396f7babf2d83eb1823bb83c5a3d0fc18f675b2d10321d49eb161fece36fe8134aa5823ecd215feed392",
|
||||
"packageManager": "pnpm@10.10.0+sha256.fa0f513aa8191764d2b6b432420788c270f07b4f999099b65bb2010eec702a30",
|
||||
"devDependencies": {
|
||||
"@monorepolint/cli": "0.5.0-alpha.132",
|
||||
"@monorepolint/config": "0.5.0-alpha.132",
|
||||
"@monorepolint/core": "0.5.0-alpha.132",
|
||||
"@monorepolint/rules": "0.5.0-alpha.132",
|
||||
"@types/node": "18.11.9",
|
||||
"@typescript-eslint/eslint-plugin": "^6.10.0",
|
||||
"@typescript-eslint/parser": "^6.10.0",
|
||||
"acorn": "^7.4.1",
|
||||
"@eslint/eslintrc": "^3.3.1",
|
||||
"@eslint/js": "^9.25.1",
|
||||
"@monorepolint/cli": "0.5.0",
|
||||
"@monorepolint/config": "0.5.0",
|
||||
"@monorepolint/core": "0.5.0",
|
||||
"@monorepolint/rules": "0.5.0",
|
||||
"@types/node": "22.15.3",
|
||||
"acorn": "^8.14.1",
|
||||
"camelcase": "^8.0.0",
|
||||
"d3-queue": "*",
|
||||
"decamelize": "^6.0.0",
|
||||
"dependency-tree": "^11.0.0",
|
||||
"dependency-tree": "^11.1.1",
|
||||
"documentation": "^14.0.3",
|
||||
"es-check": "^7.1.1",
|
||||
"eslint": "^8.53.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-prettier": "^5.0.1",
|
||||
"es-check": "^9.0.0",
|
||||
"eslint": "^9.25.1",
|
||||
"eslint-config-prettier": "^10.1.2",
|
||||
"eslint-plugin-prettier": "^5.2.6",
|
||||
"esm": "^3.2.25",
|
||||
"fs-extra": "^11.1.1",
|
||||
"glob": "^10.3.10",
|
||||
"husky": "^9.0.0",
|
||||
"lerna": "^8.1.7",
|
||||
"lint-staged": "^15.2.8",
|
||||
"fs-extra": "^11.3.0",
|
||||
"glob": "^11.0.2",
|
||||
"globals": "^16.0.0",
|
||||
"husky": "^9.1.7",
|
||||
"lerna": "^8.2.2",
|
||||
"lint-staged": "^15.5.1",
|
||||
"load-json-file": "^7.0.1",
|
||||
"meow": "^12.1.1",
|
||||
"meow": "^13.2.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^3.3.3",
|
||||
"prettier": "^3.5.3",
|
||||
"progress": "^2.0.3",
|
||||
"ts-node": "^9.0.0",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"typescript-eslint": "^8.31.1",
|
||||
"yamljs": "^0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,11 +8,11 @@ Takes a [LineString][1] and returns a [Point][2] at a specified distance along t
|
||||
|
||||
### Parameters
|
||||
|
||||
* `line` **[Feature][3]<[LineString][1]>** input line
|
||||
* `line` **([Feature][3]<[LineString][1]> | [LineString][1])** input line
|
||||
* `distance` **[number][4]** distance along the line
|
||||
* `options` **[Object][5]?** Optional parameters
|
||||
* `options` **[Object][5]?** Optional parameters (optional, default `{}`)
|
||||
|
||||
* `options.units` **[string][6]** can be degrees, radians, miles, or kilometers (optional, default `"kilometers"`)
|
||||
* `options.units` **Units** Supports all valid Turf [Units][6]. (optional, default `"kilometers"`)
|
||||
|
||||
### Examples
|
||||
|
||||
@ -38,7 +38,7 @@ Returns **[Feature][3]<[Point][2]>** Point `distance` `units` along the line
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
[6]: https://turfjs.org/docs/api/types/Units
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
|
||||
|
||||
|
||||
@ -8,11 +8,11 @@ import { getGeom } from "@turf/invariant";
|
||||
/**
|
||||
* Takes a {@link LineString} and returns a {@link Point} at a specified distance along the line.
|
||||
*
|
||||
* @name along
|
||||
* @param {Feature<LineString>} line input line
|
||||
* @function
|
||||
* @param {Feature<LineString>|LineString} line input line
|
||||
* @param {number} distance distance along the line
|
||||
* @param {Object} [options] Optional parameters
|
||||
* @param {string} [options.units="kilometers"] can be degrees, radians, miles, or kilometers
|
||||
* @param {Units} [options.units="kilometers"] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}.
|
||||
* @returns {Feature<Point>} Point `distance` `units` along the line
|
||||
* @example
|
||||
* var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/along",
|
||||
"version": "7.0.0",
|
||||
"description": "turf along module",
|
||||
"version": "7.2.0",
|
||||
"description": "Calculates a point along a line at a specific distance",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -53,22 +53,22 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/bearing": "workspace:^",
|
||||
"@turf/destination": "workspace:^",
|
||||
"@turf/distance": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/bearing": "workspace:*",
|
||||
"@turf/destination": "workspace:*",
|
||||
"@turf/distance": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import { rhumbBearing } from "@turf/rhumb-bearing";
|
||||
* Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise)
|
||||
* angle with origin on the `startPoint-midPoint` segment, or its explementary angle if required.
|
||||
*
|
||||
* @name angle
|
||||
* @function
|
||||
* @param {Coord} startPoint Start Point Coordinates
|
||||
* @param {Coord} midPoint Mid Point Coordinates
|
||||
* @param {Coord} endPoint End Point Coordinates
|
||||
@ -49,19 +49,23 @@ function angle(
|
||||
const B = endPoint;
|
||||
|
||||
// Main
|
||||
const azimuthAO = bearingToAzimuth(
|
||||
options.mercator !== true ? bearing(A, O) : rhumbBearing(A, O)
|
||||
const azimuthOA = bearingToAzimuth(
|
||||
options.mercator !== true ? bearing(O, A) : rhumbBearing(O, A)
|
||||
);
|
||||
const azimuthBO = bearingToAzimuth(
|
||||
options.mercator !== true ? bearing(B, O) : rhumbBearing(B, O)
|
||||
let azimuthOB = bearingToAzimuth(
|
||||
options.mercator !== true ? bearing(O, B) : rhumbBearing(O, B)
|
||||
);
|
||||
const angleAO = Math.abs(azimuthAO - azimuthBO);
|
||||
// If OB "trails" OA advance OB one revolution so we get the clockwise angle.
|
||||
if (azimuthOB < azimuthOA) {
|
||||
azimuthOB = azimuthOB + 360;
|
||||
}
|
||||
const angleAOB = azimuthOB - azimuthOA;
|
||||
|
||||
// Explementary angle
|
||||
if (options.explementary === true) {
|
||||
return 360 - angleAO;
|
||||
return 360 - angleAOB;
|
||||
}
|
||||
return angleAO;
|
||||
return angleAOB;
|
||||
}
|
||||
|
||||
export { angle };
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/angle",
|
||||
"version": "7.0.0",
|
||||
"description": "turf angle module",
|
||||
"version": "7.2.0",
|
||||
"description": "Finds the angle formed by two adjacent segments.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Denis <@DenisCarriere>"
|
||||
@ -52,27 +52,27 @@
|
||||
"test:tape": "tsx test.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@turf/distance": "workspace:^",
|
||||
"@turf/sector": "workspace:^",
|
||||
"@turf/truncate": "workspace:^",
|
||||
"@turf/distance": "workspace:*",
|
||||
"@turf/sector": "workspace:*",
|
||||
"@turf/truncate": "workspace:*",
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/bearing": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/rhumb-bearing": "workspace:^",
|
||||
"@turf/bearing": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@turf/rhumb-bearing": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,101 +1,186 @@
|
||||
import test from "tape";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import { glob } from "glob";
|
||||
import { loadJsonFileSync } from "load-json-file";
|
||||
import { writeJsonFileSync } from "write-json-file";
|
||||
import { sector } from "@turf/sector";
|
||||
import { bearing } from "@turf/bearing";
|
||||
import { truncate } from "@turf/truncate";
|
||||
import { distance } from "@turf/distance";
|
||||
import { point, round, lineString, featureCollection } from "@turf/helpers";
|
||||
import { point, round } from "@turf/helpers";
|
||||
import { angle } from "./index.js";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
test("turf-angle -- across 0 bearing", (t) => {
|
||||
t.equal(round(angle([-1, 1], [0, 0], [1, 1])), 90, "90 degrees");
|
||||
|
||||
test("turf-angle", (t) => {
|
||||
glob
|
||||
.sync(path.join(__dirname, "test", "in", "*.json"))
|
||||
.forEach((filepath) => {
|
||||
// Input
|
||||
const { name } = path.parse(filepath);
|
||||
const geojson = loadJsonFileSync(filepath);
|
||||
const [start, mid, end] = geojson.features;
|
||||
t.end();
|
||||
});
|
||||
|
||||
// Results
|
||||
const angleProperties = {
|
||||
interiorAngle: round(angle(start, mid, end), 6),
|
||||
interiorMercatorAngle: round(
|
||||
angle(start, mid, end, { mercator: true }),
|
||||
6
|
||||
),
|
||||
explementary: false,
|
||||
fill: "#F00",
|
||||
stroke: "#F00",
|
||||
"fill-opacity": 0.3,
|
||||
};
|
||||
const angleExplementaryProperties = {
|
||||
explementaryAngle: round(
|
||||
angle(start, mid, end, { explementary: true }),
|
||||
6
|
||||
),
|
||||
explementaryMercatorAngle: round(
|
||||
angle(start, mid, end, { explementary: true, mercator: true }),
|
||||
6
|
||||
),
|
||||
test("turf-angle -- 90 degrees", (t) => {
|
||||
t.equal(
|
||||
round(angle([124, -17], [124, -22], [131, -22]), 6),
|
||||
91.312527,
|
||||
"91.312527 degrees"
|
||||
);
|
||||
t.equal(
|
||||
round(angle([124, -17], [124, -22], [131, -22], { explementary: true }), 6),
|
||||
268.687473,
|
||||
"268.687473 degrees explementary"
|
||||
);
|
||||
t.equal(
|
||||
round(angle([124, -17], [124, -22], [131, -22], { mercator: true }), 6),
|
||||
90,
|
||||
"90 degrees mercator"
|
||||
);
|
||||
t.equal(
|
||||
round(
|
||||
angle([124, -17], [124, -22], [131, -22], {
|
||||
explementary: true,
|
||||
fill: "#00F",
|
||||
stroke: "#00F",
|
||||
"fill-opacity": 0.3,
|
||||
};
|
||||
const results = featureCollection([
|
||||
truncate(
|
||||
sector(
|
||||
mid,
|
||||
distance(mid, start) / 3,
|
||||
bearing(mid, start),
|
||||
bearing(mid, end),
|
||||
{ properties: angleProperties }
|
||||
)
|
||||
),
|
||||
truncate(
|
||||
sector(
|
||||
mid,
|
||||
distance(mid, start) / 2,
|
||||
bearing(mid, end),
|
||||
bearing(mid, start),
|
||||
{ properties: angleExplementaryProperties }
|
||||
)
|
||||
),
|
||||
lineString(
|
||||
[
|
||||
start.geometry.coordinates,
|
||||
mid.geometry.coordinates,
|
||||
end.geometry.coordinates,
|
||||
],
|
||||
{ "stroke-width": 4, stroke: "#222" }
|
||||
),
|
||||
start,
|
||||
mid,
|
||||
end,
|
||||
]);
|
||||
mercator: true,
|
||||
}),
|
||||
6
|
||||
),
|
||||
270,
|
||||
"270 degrees explementary mercator"
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
// Save results
|
||||
const expected = filepath.replace(
|
||||
path.join("test", "in"),
|
||||
path.join("test", "out")
|
||||
);
|
||||
if (process.env.REGEN) writeJsonFileSync(expected, results);
|
||||
t.deepEqual(results, loadJsonFileSync(expected), name);
|
||||
});
|
||||
test("turf-angle -- 180 degrees", (t) => {
|
||||
t.equal(round(angle([3, -1], [2, 0], [1, 1]), 6), 180, "180 degrees");
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test("turf-angle -- obtuse", (t) => {
|
||||
t.equal(
|
||||
round(angle([48.5, 5.5], [51.5, 12], [59, 15.5]), 6),
|
||||
218.715175,
|
||||
"218.715175 degrees"
|
||||
);
|
||||
t.equal(
|
||||
round(
|
||||
angle([48.5, 5.5], [51.5, 12], [59, 15.5], { explementary: true }),
|
||||
6
|
||||
),
|
||||
141.284825,
|
||||
"141.284825 degrees explementary"
|
||||
);
|
||||
t.equal(
|
||||
round(angle([48.5, 5.5], [51.5, 12], [59, 15.5], { mercator: true }), 6),
|
||||
219.826106,
|
||||
"219.826106 degrees mercator"
|
||||
);
|
||||
t.equal(
|
||||
round(
|
||||
angle([48.5, 5.5], [51.5, 12], [59, 15.5], {
|
||||
explementary: true,
|
||||
mercator: true,
|
||||
}),
|
||||
6
|
||||
),
|
||||
140.173894,
|
||||
"140.173894 degrees explementary mercator"
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test("turf-angle -- obtuse bigger", (t) => {
|
||||
t.equal(
|
||||
round(angle([48.5, 5.5], [51.5, 12], [46.5, 19]), 6),
|
||||
121.330117,
|
||||
"121.330117 degrees"
|
||||
);
|
||||
t.equal(
|
||||
round(
|
||||
angle([48.5, 5.5], [51.5, 12], [46.5, 19], { explementary: true }),
|
||||
6
|
||||
),
|
||||
238.669883,
|
||||
"238.669883 degrees explementary"
|
||||
);
|
||||
t.equal(
|
||||
round(angle([48.5, 5.5], [51.5, 12], [46.5, 19], { mercator: true }), 6),
|
||||
120.970546,
|
||||
"120.970546"
|
||||
);
|
||||
t.equal(
|
||||
round(
|
||||
angle([48.5, 5.5], [51.5, 12], [46.5, 19], {
|
||||
explementary: true,
|
||||
mercator: true,
|
||||
}),
|
||||
6
|
||||
),
|
||||
239.029454,
|
||||
"239.029454 degrees explementary mercator"
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test("turf-angle -- acute", (t) => {
|
||||
t.equal(
|
||||
round(angle([48.5, 5.5], [51.5, 12], [44.5, 10.5]), 6),
|
||||
53.608314,
|
||||
"53.608314 degrees"
|
||||
);
|
||||
t.equal(
|
||||
round(
|
||||
angle([48.5, 5.5], [51.5, 12], [44.5, 10.5], { explementary: true }),
|
||||
6
|
||||
),
|
||||
306.391686,
|
||||
"306.391686 degrees explementary"
|
||||
);
|
||||
t.equal(
|
||||
round(angle([48.5, 5.5], [51.5, 12], [44.5, 10.5], { mercator: true }), 6),
|
||||
53.166357,
|
||||
"53.166357 degrees mercator"
|
||||
);
|
||||
t.equal(
|
||||
round(
|
||||
angle([48.5, 5.5], [51.5, 12], [44.5, 10.5], {
|
||||
explementary: true,
|
||||
mercator: true,
|
||||
}),
|
||||
6
|
||||
),
|
||||
306.833643,
|
||||
"306.833643 degrees explementary mercator"
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test("turf-angle -- acute inverse", (t) => {
|
||||
t.equal(
|
||||
round(angle([44.5, 10.5], [51.5, 12], [48.5, 5.5]), 6),
|
||||
306.391686,
|
||||
"306.391686 degrees"
|
||||
);
|
||||
t.equal(
|
||||
round(
|
||||
angle([44.5, 10.5], [51.5, 12], [48.5, 5.5], { explementary: true }),
|
||||
6
|
||||
),
|
||||
53.608314,
|
||||
"53.608314 degrees explementary"
|
||||
);
|
||||
t.equal(
|
||||
round(angle([44.5, 10.5], [51.5, 12], [48.5, 5.5], { mercator: true }), 6),
|
||||
306.833643,
|
||||
"306.833643 degrees mercator"
|
||||
);
|
||||
t.equal(
|
||||
round(
|
||||
angle([44.5, 10.5], [51.5, 12], [48.5, 5.5], {
|
||||
explementary: true,
|
||||
mercator: true,
|
||||
}),
|
||||
6
|
||||
),
|
||||
53.166357,
|
||||
"53.166357 degrees explementary mercator"
|
||||
);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test("turf-angle -- simple", (t) => {
|
||||
t.equal(round(angle([5, 5], [5, 6], [3, 4])), 45, "45 degrees");
|
||||
t.equal(round(angle([3, 4], [5, 6], [5, 5])), 45, "45 degrees -- inverse");
|
||||
t.equal(round(angle([3, 4], [5, 6], [5, 5])), 315, "315 degrees -- inverse");
|
||||
t.equal(
|
||||
round(angle([3, 4], [5, 6], [5, 5], { explementary: true })),
|
||||
round(angle([5, 5], [5, 6], [3, 4], { explementary: true })),
|
||||
360 - 45,
|
||||
"explementary angle"
|
||||
);
|
||||
@ -139,3 +224,19 @@ test("turf-angle -- throws", (t) => {
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test("turf-angle -- 2703", (t) => {
|
||||
const start = [0, 1];
|
||||
const mid = [0, 0];
|
||||
const end = [1, 0];
|
||||
const a = angle(start, mid, end);
|
||||
t.equal(a, 90, "90 clockwise");
|
||||
|
||||
const start2 = [0, 1];
|
||||
const mid2 = [0, 0];
|
||||
const end2 = [-1, 0];
|
||||
const a2 = angle(start2, mid2, end2);
|
||||
t.equal(a2, 270, "270 clockwise");
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [124, -17]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [124, -22]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [131, -22]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [48.5, 5.5]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.5, 12]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [44.5, 10.5]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [44.5, 10.5]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.5, 12]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [48.5, 5.5]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [48.5, 5.5]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.5, 12]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [46.5, 19]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [48.5, 5.5]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.5, 12]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [59, 15.5]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,223 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"interiorAngle": 88.687473,
|
||||
"interiorMercatorAngle": 90,
|
||||
"explementary": false,
|
||||
"fill": "#F00",
|
||||
"stroke": "#F00",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[124, -22],
|
||||
[124, -20.333333],
|
||||
[124.04425, -20.333844],
|
||||
[124.088474, -20.335376],
|
||||
[124.132644, -20.337929],
|
||||
[124.176735, -20.341501],
|
||||
[124.22072, -20.346089],
|
||||
[124.264573, -20.351692],
|
||||
[124.308266, -20.358305],
|
||||
[124.351775, -20.365925],
|
||||
[124.395073, -20.374547],
|
||||
[124.438134, -20.384166],
|
||||
[124.480932, -20.394777],
|
||||
[124.523441, -20.406372],
|
||||
[124.565636, -20.418945],
|
||||
[124.607491, -20.432488],
|
||||
[124.648981, -20.446993],
|
||||
[124.690081, -20.462452],
|
||||
[124.730767, -20.478855],
|
||||
[124.771013, -20.496192],
|
||||
[124.810795, -20.514453],
|
||||
[124.850089, -20.533627],
|
||||
[124.888872, -20.553702],
|
||||
[124.92712, -20.574667],
|
||||
[124.964809, -20.596508],
|
||||
[125.001917, -20.619212],
|
||||
[125.038421, -20.642766],
|
||||
[125.074299, -20.667156],
|
||||
[125.109529, -20.692366],
|
||||
[125.144089, -20.718382],
|
||||
[125.177958, -20.745187],
|
||||
[125.211115, -20.772767],
|
||||
[125.24354, -20.801103],
|
||||
[125.275212, -20.830179],
|
||||
[125.306113, -20.859977],
|
||||
[125.336223, -20.89048],
|
||||
[125.365524, -20.921668],
|
||||
[125.393996, -20.953523],
|
||||
[125.421623, -20.986025],
|
||||
[125.448387, -21.019156],
|
||||
[125.474271, -21.052893],
|
||||
[125.499259, -21.087218],
|
||||
[125.523336, -21.122109],
|
||||
[125.546485, -21.157546],
|
||||
[125.568692, -21.193505],
|
||||
[125.589943, -21.229966],
|
||||
[125.610224, -21.266907],
|
||||
[125.629523, -21.304304],
|
||||
[125.647826, -21.342135],
|
||||
[125.665122, -21.380377],
|
||||
[125.681399, -21.419006],
|
||||
[125.696646, -21.457999],
|
||||
[125.710855, -21.497332],
|
||||
[125.724014, -21.536981],
|
||||
[125.736115, -21.576922],
|
||||
[125.74715, -21.617129],
|
||||
[125.757111, -21.657579],
|
||||
[125.76599, -21.698246],
|
||||
[125.773783, -21.739105],
|
||||
[125.780482, -21.780132],
|
||||
[125.786084, -21.8213],
|
||||
[125.790582, -21.862586],
|
||||
[125.793975, -21.903962],
|
||||
[125.796258, -21.945403],
|
||||
[125.797429, -21.986885],
|
||||
[125.797488, -22.028381],
|
||||
[124, -22]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"explementaryAngle": 271.312527,
|
||||
"explementaryMercatorAngle": 270,
|
||||
"explementary": true,
|
||||
"fill": "#00F",
|
||||
"stroke": "#00F",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[124, -22],
|
||||
[126.696439, -22.035218],
|
||||
[126.688162, -22.218141],
|
||||
[126.665416, -22.400012],
|
||||
[126.628265, -22.579849],
|
||||
[126.576855, -22.75668],
|
||||
[126.511409, -22.929545],
|
||||
[126.43223, -23.097499],
|
||||
[126.339701, -23.259623],
|
||||
[126.234279, -23.415026],
|
||||
[126.116502, -23.56285],
|
||||
[125.986979, -23.702275],
|
||||
[125.846392, -23.832527],
|
||||
[125.695492, -23.952877],
|
||||
[125.535093, -24.062653],
|
||||
[125.366071, -24.161238],
|
||||
[125.189356, -24.248076],
|
||||
[125.005929, -24.322678],
|
||||
[124.816814, -24.384621],
|
||||
[124.623073, -24.433554],
|
||||
[124.4258, -24.4692],
|
||||
[124.22611, -24.491355],
|
||||
[124.025137, -24.499893],
|
||||
[123.82402, -24.494767],
|
||||
[123.623903, -24.476005],
|
||||
[123.425921, -24.443714],
|
||||
[123.231195, -24.398077],
|
||||
[123.040823, -24.339354],
|
||||
[122.855878, -24.267878],
|
||||
[122.677392, -24.184053],
|
||||
[122.506359, -24.088353],
|
||||
[122.343722, -23.981317],
|
||||
[122.19037, -23.863547],
|
||||
[122.047134, -23.735703],
|
||||
[121.91478, -23.598499],
|
||||
[121.794008, -23.452698],
|
||||
[121.685447, -23.29911],
|
||||
[121.589651, -23.138582],
|
||||
[121.507098, -22.971999],
|
||||
[121.43819, -22.800274],
|
||||
[121.383249, -22.624344],
|
||||
[121.34252, -22.445167],
|
||||
[121.316165, -22.263713],
|
||||
[121.304272, -22.080961],
|
||||
[121.306846, -21.897892],
|
||||
[121.323819, -21.715488],
|
||||
[121.355046, -21.53472],
|
||||
[121.400308, -21.356549],
|
||||
[121.459317, -21.181918],
|
||||
[121.531712, -21.011749],
|
||||
[121.617071, -20.846936],
|
||||
[121.714905, -20.688343],
|
||||
[121.824667, -20.5368],
|
||||
[121.94575, -20.393097],
|
||||
[122.077498, -20.25798],
|
||||
[122.2192, -20.132151],
|
||||
[122.370104, -20.016261],
|
||||
[122.529412, -19.910908],
|
||||
[122.696289, -19.816638],
|
||||
[122.869865, -19.733934],
|
||||
[123.049239, -19.663222],
|
||||
[123.233486, -19.604865],
|
||||
[123.421658, -19.559163],
|
||||
[123.612788, -19.526351],
|
||||
[123.805898, -19.506596],
|
||||
[124, -19.5],
|
||||
[124, -22]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"stroke-width": 4,
|
||||
"stroke": "#222"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[124, -17],
|
||||
[124, -22],
|
||||
[131, -22]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [124, -17]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [124, -22]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [131, -22]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,223 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"interiorAngle": 52.698136,
|
||||
"interiorMercatorAngle": 53.166357,
|
||||
"explementary": false,
|
||||
"fill": "#F00",
|
||||
"stroke": "#F00",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[51.5, 12],
|
||||
[50.487833, 9.836074],
|
||||
[50.455818, 9.850776],
|
||||
[50.424022, 9.865934],
|
||||
[50.392451, 9.881546],
|
||||
[50.361111, 9.897607],
|
||||
[50.33001, 9.914115],
|
||||
[50.299154, 9.931065],
|
||||
[50.268549, 9.948455],
|
||||
[50.238202, 9.966281],
|
||||
[50.20812, 9.984538],
|
||||
[50.178308, 10.003224],
|
||||
[50.148772, 10.022334],
|
||||
[50.11952, 10.041864],
|
||||
[50.090557, 10.06181],
|
||||
[50.06189, 10.082168],
|
||||
[50.033523, 10.102934],
|
||||
[50.005465, 10.124103],
|
||||
[49.977719, 10.145671],
|
||||
[49.950293, 10.167633],
|
||||
[49.923192, 10.189986],
|
||||
[49.896422, 10.212723],
|
||||
[49.869988, 10.23584],
|
||||
[49.843896, 10.259333],
|
||||
[49.818152, 10.283196],
|
||||
[49.792761, 10.307425],
|
||||
[49.767728, 10.332014],
|
||||
[49.743059, 10.356958],
|
||||
[49.718759, 10.382253],
|
||||
[49.694834, 10.407892],
|
||||
[49.671288, 10.43387],
|
||||
[49.648126, 10.460182],
|
||||
[49.625353, 10.486822],
|
||||
[49.602975, 10.513785],
|
||||
[49.580996, 10.541065],
|
||||
[49.559421, 10.568656],
|
||||
[49.538254, 10.596553],
|
||||
[49.5175, 10.624749],
|
||||
[49.497163, 10.653239],
|
||||
[49.477248, 10.682016],
|
||||
[49.45776, 10.711075],
|
||||
[49.438701, 10.740409],
|
||||
[49.420077, 10.770013],
|
||||
[49.401892, 10.79988],
|
||||
[49.384149, 10.830003],
|
||||
[49.366852, 10.860377],
|
||||
[49.350005, 10.890995],
|
||||
[49.333613, 10.92185],
|
||||
[49.317677, 10.952936],
|
||||
[49.302203, 10.984247],
|
||||
[49.287192, 11.015775],
|
||||
[49.27265, 11.047515],
|
||||
[49.258578, 11.079459],
|
||||
[49.24498, 11.1116],
|
||||
[49.231858, 11.143933],
|
||||
[49.219217, 11.17645],
|
||||
[49.207059, 11.209144],
|
||||
[49.195385, 11.242008],
|
||||
[49.1842, 11.275035],
|
||||
[49.173506, 11.308219],
|
||||
[49.163304, 11.341552],
|
||||
[49.153598, 11.375027],
|
||||
[49.144389, 11.408638],
|
||||
[49.13568, 11.442376],
|
||||
[49.127473, 11.476235],
|
||||
[49.119769, 11.510208],
|
||||
[51.5, 12]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"explementaryAngle": 307.301864,
|
||||
"explementaryMercatorAngle": 306.833643,
|
||||
"explementary": true,
|
||||
"fill": "#00F",
|
||||
"stroke": "#00F",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[51.5, 12],
|
||||
[47.932822, 11.25803],
|
||||
[47.880206, 11.551701],
|
||||
[47.852657, 11.848643],
|
||||
[47.850444, 12.1468],
|
||||
[47.873667, 12.4441],
|
||||
[47.922251, 12.738471],
|
||||
[47.995945, 13.027852],
|
||||
[48.094321, 13.310212],
|
||||
[48.216776, 13.583558],
|
||||
[48.362528, 13.845956],
|
||||
[48.530626, 14.095541],
|
||||
[48.719947, 14.330532],
|
||||
[48.929209, 14.549244],
|
||||
[49.156971, 14.750105],
|
||||
[49.401646, 14.931665],
|
||||
[49.661512, 15.092608],
|
||||
[49.934722, 15.231766],
|
||||
[50.21932, 15.348124],
|
||||
[50.513252, 15.440832],
|
||||
[50.814387, 15.509212],
|
||||
[51.120533, 15.552762],
|
||||
[51.429455, 15.571163],
|
||||
[51.738892, 15.564279],
|
||||
[52.046582, 15.532161],
|
||||
[52.350276, 15.475046],
|
||||
[52.647759, 15.393351],
|
||||
[52.93687, 15.287676],
|
||||
[53.215519, 15.158792],
|
||||
[53.481702, 15.007641],
|
||||
[53.733522, 14.835322],
|
||||
[53.969197, 14.643085],
|
||||
[54.187077, 14.43232],
|
||||
[54.385654, 14.204546],
|
||||
[54.563573, 13.961397],
|
||||
[54.719638, 13.704611],
|
||||
[54.852817, 13.436018],
|
||||
[54.962251, 13.157522],
|
||||
[55.047257, 12.871091],
|
||||
[55.107326, 12.57874],
|
||||
[55.142126, 12.282518],
|
||||
[55.151503, 11.984494],
|
||||
[55.135477, 11.686742],
|
||||
[55.094241, 11.391327],
|
||||
[55.028156, 11.100292],
|
||||
[54.93775, 10.815644],
|
||||
[54.823708, 10.539341],
|
||||
[54.68687, 10.27328],
|
||||
[54.528225, 10.019281],
|
||||
[54.3489, 9.779083],
|
||||
[54.150154, 9.554324],
|
||||
[53.933373, 9.346538],
|
||||
[53.700055, 9.157138],
|
||||
[53.451804, 8.987415],
|
||||
[53.190318, 8.838522],
|
||||
[52.917382, 8.71147],
|
||||
[52.634852, 8.607124],
|
||||
[52.344643, 8.526191],
|
||||
[52.048723, 8.46922],
|
||||
[51.749093, 8.4366],
|
||||
[51.447779, 8.42855],
|
||||
[51.146818, 8.445126],
|
||||
[50.848244, 8.486215],
|
||||
[50.554078, 8.551539],
|
||||
[50.266308, 8.640653],
|
||||
[49.986887, 8.752953],
|
||||
[51.5, 12]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"stroke-width": 4,
|
||||
"stroke": "#222"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[48.5, 5.5],
|
||||
[51.5, 12],
|
||||
[44.5, 10.5]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [48.5, 5.5]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.5, 12]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [44.5, 10.5]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,223 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"interiorAngle": 52.698136,
|
||||
"interiorMercatorAngle": 53.166357,
|
||||
"explementary": false,
|
||||
"fill": "#F00",
|
||||
"stroke": "#F00",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[51.5, 12],
|
||||
[49.15854, 11.518357],
|
||||
[49.124843, 11.711158],
|
||||
[49.107647, 11.906037],
|
||||
[49.107107, 12.101642],
|
||||
[49.123262, 12.296609],
|
||||
[49.156037, 12.489577],
|
||||
[49.205239, 12.679197],
|
||||
[49.27056, 12.864137],
|
||||
[49.351579, 13.043099],
|
||||
[49.447757, 13.214821],
|
||||
[49.55845, 13.37809],
|
||||
[49.682904, 13.531749],
|
||||
[49.820264, 13.674709],
|
||||
[49.969578, 13.805952],
|
||||
[50.129802, 13.924543],
|
||||
[50.299812, 14.029634],
|
||||
[50.478406, 14.120476],
|
||||
[50.664316, 14.196415],
|
||||
[50.856218, 14.256907],
|
||||
[51.052739, 14.301518],
|
||||
[51.252473, 14.329928],
|
||||
[51.453985, 14.34193],
|
||||
[51.655827, 14.33744],
|
||||
[51.85655, 14.31649],
|
||||
[52.054711, 14.279229],
|
||||
[52.248891, 14.225927],
|
||||
[52.437699, 14.156966],
|
||||
[52.619788, 14.072842],
|
||||
[52.793863, 13.974157],
|
||||
[52.958691, 13.861619],
|
||||
[53.113112, 13.736031],
|
||||
[53.256043, 13.598289],
|
||||
[53.38649, 13.449375],
|
||||
[53.503554, 13.290346],
|
||||
[53.606434, 13.122329],
|
||||
[53.694435, 12.946513],
|
||||
[53.766969, 12.764138],
|
||||
[53.823562, 12.576487],
|
||||
[53.863854, 12.384879],
|
||||
[53.887599, 12.190654],
|
||||
[53.894669, 11.995171],
|
||||
[53.885052, 11.799792],
|
||||
[53.858849, 11.605877],
|
||||
[53.816276, 11.414772],
|
||||
[53.757661, 11.227801],
|
||||
[53.683439, 11.046258],
|
||||
[53.594149, 10.871395],
|
||||
[53.490431, 10.704419],
|
||||
[53.373021, 10.54648],
|
||||
[53.242743, 10.398663],
|
||||
[53.100509, 10.261983],
|
||||
[52.947306, 10.137378],
|
||||
[52.784194, 10.025703],
|
||||
[52.612299, 9.927722],
|
||||
[52.4328, 9.844107],
|
||||
[52.246931, 9.775428],
|
||||
[52.055961, 9.722157],
|
||||
[51.861198, 9.684656],
|
||||
[51.66397, 9.663183],
|
||||
[51.465624, 9.657885],
|
||||
[51.267512, 9.668796],
|
||||
[51.070987, 9.695843],
|
||||
[50.877388, 9.738842],
|
||||
[50.688039, 9.797497],
|
||||
[50.504234, 9.871408],
|
||||
[51.5, 12]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"explementaryAngle": 307.301864,
|
||||
"explementaryMercatorAngle": 306.833643,
|
||||
"explementary": true,
|
||||
"fill": "#00F",
|
||||
"stroke": "#00F",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[51.5, 12],
|
||||
[50.011338, 8.805989],
|
||||
[49.964224, 8.827611],
|
||||
[49.917429, 8.849905],
|
||||
[49.870962, 8.872865],
|
||||
[49.824834, 8.896487],
|
||||
[49.779053, 8.920766],
|
||||
[49.733629, 8.945697],
|
||||
[49.688572, 8.971274],
|
||||
[49.643892, 8.997493],
|
||||
[49.599597, 9.024348],
|
||||
[49.555696, 9.051832],
|
||||
[49.5122, 9.079942],
|
||||
[49.469117, 9.10867],
|
||||
[49.426456, 9.138011],
|
||||
[49.384226, 9.167958],
|
||||
[49.342435, 9.198506],
|
||||
[49.301094, 9.229647],
|
||||
[49.26021, 9.261376],
|
||||
[49.219792, 9.293686],
|
||||
[49.179848, 9.32657],
|
||||
[49.140388, 9.360022],
|
||||
[49.101419, 9.394034],
|
||||
[49.062949, 9.428599],
|
||||
[49.024986, 9.46371],
|
||||
[48.98754, 9.499359],
|
||||
[48.950617, 9.53554],
|
||||
[48.914225, 9.572245],
|
||||
[48.878372, 9.609465],
|
||||
[48.843067, 9.647194],
|
||||
[48.808315, 9.685423],
|
||||
[48.774125, 9.724145],
|
||||
[48.740504, 9.763351],
|
||||
[48.707459, 9.803033],
|
||||
[48.674998, 9.843183],
|
||||
[48.643126, 9.883792],
|
||||
[48.611852, 9.924852],
|
||||
[48.581181, 9.966355],
|
||||
[48.551121, 10.008291],
|
||||
[48.521677, 10.050652],
|
||||
[48.492857, 10.093429],
|
||||
[48.464666, 10.136613],
|
||||
[48.437111, 10.180196],
|
||||
[48.410197, 10.224167],
|
||||
[48.38393, 10.268518],
|
||||
[48.358317, 10.313239],
|
||||
[48.333362, 10.358321],
|
||||
[48.309072, 10.403755],
|
||||
[48.285451, 10.449531],
|
||||
[48.262506, 10.495639],
|
||||
[48.24024, 10.54207],
|
||||
[48.218658, 10.588814],
|
||||
[48.197767, 10.635862],
|
||||
[48.17757, 10.683202],
|
||||
[48.158072, 10.730826],
|
||||
[48.139277, 10.778723],
|
||||
[48.121189, 10.826884],
|
||||
[48.103814, 10.875298],
|
||||
[48.087154, 10.923954],
|
||||
[48.071213, 10.972843],
|
||||
[48.055996, 11.021955],
|
||||
[48.041505, 11.071279],
|
||||
[48.027744, 11.120804],
|
||||
[48.014717, 11.17052],
|
||||
[48.002426, 11.220418],
|
||||
[47.990875, 11.270485],
|
||||
[51.5, 12]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"stroke-width": 4,
|
||||
"stroke": "#222"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[44.5, 10.5],
|
||||
[51.5, 12],
|
||||
[48.5, 5.5]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [44.5, 10.5]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.5, 12]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [48.5, 5.5]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,223 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"interiorAngle": 120.447846,
|
||||
"interiorMercatorAngle": 120.970546,
|
||||
"explementary": false,
|
||||
"fill": "#F00",
|
||||
"stroke": "#F00",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[51.5, 12],
|
||||
[50.487833, 9.836074],
|
||||
[50.415688, 9.870001],
|
||||
[50.344705, 9.906244],
|
||||
[50.274961, 9.944764],
|
||||
[50.20653, 9.985519],
|
||||
[50.139487, 10.028467],
|
||||
[50.073904, 10.07356],
|
||||
[50.009852, 10.120751],
|
||||
[49.9474, 10.169988],
|
||||
[49.886617, 10.221219],
|
||||
[49.827567, 10.274389],
|
||||
[49.770315, 10.32944],
|
||||
[49.714924, 10.386313],
|
||||
[49.661454, 10.444947],
|
||||
[49.609964, 10.505278],
|
||||
[49.56051, 10.567243],
|
||||
[49.513147, 10.630774],
|
||||
[49.467926, 10.695802],
|
||||
[49.424898, 10.762257],
|
||||
[49.384111, 10.830068],
|
||||
[49.34561, 10.899161],
|
||||
[49.309438, 10.969462],
|
||||
[49.275636, 11.040894],
|
||||
[49.244242, 11.113381],
|
||||
[49.215292, 11.186844],
|
||||
[49.188819, 11.261202],
|
||||
[49.164853, 11.336377],
|
||||
[49.143422, 11.412286],
|
||||
[49.124552, 11.488846],
|
||||
[49.108264, 11.565975],
|
||||
[49.09458, 11.643588],
|
||||
[49.083515, 11.721602],
|
||||
[49.075084, 11.79993],
|
||||
[49.069299, 11.878489],
|
||||
[49.066168, 11.957192],
|
||||
[49.065696, 12.035953],
|
||||
[49.067887, 12.114687],
|
||||
[49.072741, 12.193306],
|
||||
[49.080254, 12.271725],
|
||||
[49.090421, 12.349859],
|
||||
[49.103233, 12.427621],
|
||||
[49.118679, 12.504926],
|
||||
[49.136743, 12.58169],
|
||||
[49.157408, 12.657827],
|
||||
[49.180655, 12.733254],
|
||||
[49.206459, 12.807888],
|
||||
[49.234795, 12.881646],
|
||||
[49.265633, 12.954447],
|
||||
[49.298942, 13.026211],
|
||||
[49.334688, 13.096859],
|
||||
[49.372832, 13.166311],
|
||||
[49.413335, 13.234492],
|
||||
[49.456154, 13.301325],
|
||||
[49.501244, 13.366736],
|
||||
[49.548555, 13.430652],
|
||||
[49.598038, 13.493003],
|
||||
[49.64964, 13.553719],
|
||||
[49.703304, 13.612733],
|
||||
[49.758972, 13.669977],
|
||||
[49.816583, 13.72539],
|
||||
[49.876076, 13.778908],
|
||||
[49.937384, 13.830471],
|
||||
[50.000441, 13.880023],
|
||||
[50.065177, 13.927507],
|
||||
[50.131521, 13.972871],
|
||||
[51.5, 12]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"explementaryAngle": 239.552154,
|
||||
"explementaryMercatorAngle": 239.029454,
|
||||
"explementary": true,
|
||||
"fill": "#00F",
|
||||
"stroke": "#00F",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[51.5, 12],
|
||||
[49.438664, 14.956465],
|
||||
[49.641509, 15.081264],
|
||||
[49.85254, 15.192891],
|
||||
[50.07084, 15.290851],
|
||||
[50.295457, 15.374712],
|
||||
[50.525406, 15.4441],
|
||||
[50.759673, 15.498708],
|
||||
[50.997223, 15.538293],
|
||||
[51.237005, 15.562678],
|
||||
[51.477954, 15.571755],
|
||||
[51.719002, 15.565483],
|
||||
[51.959077, 15.543891],
|
||||
[52.197114, 15.507073],
|
||||
[52.432059, 15.455195],
|
||||
[52.662874, 15.388488],
|
||||
[52.88854, 15.307247],
|
||||
[53.108067, 15.211834],
|
||||
[53.320497, 15.10267],
|
||||
[53.524905, 14.98024],
|
||||
[53.720408, 14.845083],
|
||||
[53.906169, 14.697794],
|
||||
[54.081395, 14.539021],
|
||||
[54.245349, 14.369457],
|
||||
[54.397344, 14.189844],
|
||||
[54.536752, 14.000964],
|
||||
[54.663004, 13.803636],
|
||||
[54.775592, 13.598714],
|
||||
[54.874069, 13.387083],
|
||||
[54.958053, 13.169651],
|
||||
[55.027225, 12.947351],
|
||||
[55.081334, 12.721134],
|
||||
[55.12019, 12.491961],
|
||||
[55.143671, 12.260809],
|
||||
[55.15172, 12.028654],
|
||||
[55.144342, 11.796478],
|
||||
[55.121608, 11.565259],
|
||||
[55.083651, 11.33597],
|
||||
[55.030665, 11.10957],
|
||||
[54.962907, 10.887009],
|
||||
[54.880689, 10.669215],
|
||||
[54.784382, 10.457096],
|
||||
[54.674414, 10.251534],
|
||||
[54.551265, 10.053385],
|
||||
[54.415465, 9.86347],
|
||||
[54.267596, 9.682576],
|
||||
[54.108285, 9.511453],
|
||||
[53.938204, 9.350808],
|
||||
[53.758066, 9.201305],
|
||||
[53.568623, 9.063562],
|
||||
[53.370664, 8.938146],
|
||||
[53.165008, 8.825577],
|
||||
[52.952508, 8.726317],
|
||||
[52.73404, 8.640776],
|
||||
[52.510503, 8.569307],
|
||||
[52.282818, 8.512204],
|
||||
[52.051921, 8.469703],
|
||||
[51.818759, 8.441978],
|
||||
[51.584289, 8.429144],
|
||||
[51.349473, 8.431253],
|
||||
[51.115275, 8.448297],
|
||||
[50.882655, 8.480206],
|
||||
[50.652569, 8.526848],
|
||||
[50.42596, 8.588031],
|
||||
[50.203762, 8.663503],
|
||||
[49.986887, 8.752953],
|
||||
[51.5, 12]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"stroke-width": 4,
|
||||
"stroke": "#222"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[48.5, 5.5],
|
||||
[51.5, 12],
|
||||
[46.5, 19]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [48.5, 5.5]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.5, 12]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [46.5, 19]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,223 +0,0 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"features": [
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"interiorAngle": 220.958265,
|
||||
"interiorMercatorAngle": 219.826106,
|
||||
"explementary": false,
|
||||
"fill": "#F00",
|
||||
"stroke": "#F00",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[51.5, 12],
|
||||
[50.487833, 9.836074],
|
||||
[50.358618, 9.898909],
|
||||
[50.233379, 9.969168],
|
||||
[50.112553, 10.046605],
|
||||
[49.996566, 10.130951],
|
||||
[49.885824, 10.22191],
|
||||
[49.780719, 10.319164],
|
||||
[49.681622, 10.422375],
|
||||
[49.588884, 10.53118],
|
||||
[49.502838, 10.6452],
|
||||
[49.42379, 10.764034],
|
||||
[49.352026, 10.887265],
|
||||
[49.287806, 11.014462],
|
||||
[49.231365, 11.145177],
|
||||
[49.18291, 11.278951],
|
||||
[49.142624, 11.415312],
|
||||
[49.11066, 11.553779],
|
||||
[49.087142, 11.693864],
|
||||
[49.072167, 11.835071],
|
||||
[49.0658, 11.976901],
|
||||
[49.068078, 12.11885],
|
||||
[49.079005, 12.260414],
|
||||
[49.098557, 12.401089],
|
||||
[49.126679, 12.540375],
|
||||
[49.163284, 12.677773],
|
||||
[49.208255, 12.812793],
|
||||
[49.261445, 12.944952],
|
||||
[49.322676, 13.073774],
|
||||
[49.391742, 13.198797],
|
||||
[49.468406, 13.31957],
|
||||
[49.552404, 13.435659],
|
||||
[49.643443, 13.546643],
|
||||
[49.741204, 13.65212],
|
||||
[49.845343, 13.751709],
|
||||
[49.95549, 13.845048],
|
||||
[50.071254, 13.931797],
|
||||
[50.192218, 14.011641],
|
||||
[50.317949, 14.084288],
|
||||
[50.447992, 14.149474],
|
||||
[50.581878, 14.206959],
|
||||
[50.719119, 14.256534],
|
||||
[50.859217, 14.298017],
|
||||
[51.001659, 14.331256],
|
||||
[51.145927, 14.356129],
|
||||
[51.291492, 14.372545],
|
||||
[51.43782, 14.380443],
|
||||
[51.584377, 14.379796],
|
||||
[51.730624, 14.370604],
|
||||
[51.876026, 14.352902],
|
||||
[52.020051, 14.326755],
|
||||
[52.162172, 14.292258],
|
||||
[52.301869, 14.249539],
|
||||
[52.438634, 14.198753],
|
||||
[52.571968, 14.140087],
|
||||
[52.701388, 14.073756],
|
||||
[52.826426, 14],
|
||||
[52.94663, 13.919091],
|
||||
[53.061568, 13.831323],
|
||||
[53.17083, 13.737014],
|
||||
[53.274026, 13.636509],
|
||||
[53.37079, 13.530172],
|
||||
[53.460782, 13.418389],
|
||||
[53.543687, 13.301563],
|
||||
[53.619216, 13.180118],
|
||||
[53.68711, 13.05449],
|
||||
[51.5, 12]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"explementaryAngle": 139.041735,
|
||||
"explementaryMercatorAngle": 140.173894,
|
||||
"explementary": true,
|
||||
"fill": "#00F",
|
||||
"stroke": "#00F",
|
||||
"fill-opacity": 0.3
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Polygon",
|
||||
"coordinates": [
|
||||
[
|
||||
[51.5, 12],
|
||||
[54.787546, 13.574894],
|
||||
[54.846609, 13.449936],
|
||||
[54.900628, 13.32285],
|
||||
[54.949533, 13.193828],
|
||||
[54.993256, 13.063064],
|
||||
[55.031743, 12.930753],
|
||||
[55.064944, 12.797093],
|
||||
[55.092818, 12.662285],
|
||||
[55.115333, 12.526529],
|
||||
[55.132464, 12.390028],
|
||||
[55.144195, 12.252984],
|
||||
[55.150515, 12.1156],
|
||||
[55.151426, 11.97808],
|
||||
[55.146932, 11.840628],
|
||||
[55.13705, 11.703446],
|
||||
[55.121802, 11.566736],
|
||||
[55.101218, 11.430701],
|
||||
[55.075335, 11.29554],
|
||||
[55.044199, 11.161451],
|
||||
[55.007863, 11.028631],
|
||||
[54.966386, 10.897275],
|
||||
[54.919835, 10.767575],
|
||||
[54.868285, 10.639721],
|
||||
[54.811817, 10.513899],
|
||||
[54.750517, 10.390292],
|
||||
[54.684482, 10.269082],
|
||||
[54.61381, 10.150444],
|
||||
[54.538611, 10.034551],
|
||||
[54.458997, 9.921571],
|
||||
[54.375087, 9.81167],
|
||||
[54.287007, 9.705005],
|
||||
[54.194889, 9.601733],
|
||||
[54.098867, 9.502002],
|
||||
[53.999084, 9.405957],
|
||||
[53.895687, 9.313739],
|
||||
[53.788828, 9.225479],
|
||||
[53.678662, 9.141306],
|
||||
[53.565351, 9.061341],
|
||||
[53.449059, 8.985701],
|
||||
[53.329956, 8.914495],
|
||||
[53.208215, 8.847825],
|
||||
[53.084012, 8.785788],
|
||||
[52.957528, 8.728474],
|
||||
[52.828944, 8.675965],
|
||||
[52.698447, 8.628338],
|
||||
[52.566224, 8.585661],
|
||||
[52.432468, 8.547995],
|
||||
[52.29737, 8.515396],
|
||||
[52.161125, 8.48791],
|
||||
[52.023929, 8.465577],
|
||||
[51.88598, 8.448429],
|
||||
[51.747475, 8.436491],
|
||||
[51.608615, 8.42978],
|
||||
[51.469598, 8.428306],
|
||||
[51.330626, 8.432071],
|
||||
[51.191897, 8.441069],
|
||||
[51.05361, 8.455288],
|
||||
[50.915966, 8.474707],
|
||||
[50.779162, 8.499299],
|
||||
[50.643394, 8.529026],
|
||||
[50.508859, 8.563847],
|
||||
[50.37575, 8.603712],
|
||||
[50.244259, 8.648562],
|
||||
[50.114576, 8.698333],
|
||||
[49.986887, 8.752953],
|
||||
[51.5, 12]
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"stroke-width": 4,
|
||||
"stroke": "#222"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "LineString",
|
||||
"coordinates": [
|
||||
[48.5, 5.5],
|
||||
[51.5, 12],
|
||||
[59, 15.5]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#008000",
|
||||
"name": "start"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [48.5, 5.5]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#00F",
|
||||
"name": "middle"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [51.5, 12]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"marker-color": "#F00",
|
||||
"name": "end"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [59, 15.5]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -4,11 +4,11 @@
|
||||
|
||||
## area
|
||||
|
||||
Takes one or more features and returns their area in square meters.
|
||||
Calculates the geodesic area in square meters of one or more polygons.
|
||||
|
||||
### Parameters
|
||||
|
||||
* `geojson` **[GeoJSON][1]** input GeoJSON feature(s)
|
||||
* `geojson` **[GeoJSON][1]** input polygon(s) as [Geometry][2], [Feature][3], or [FeatureCollection][4]
|
||||
|
||||
### Examples
|
||||
|
||||
@ -22,11 +22,17 @@ var addToMap = [polygon]
|
||||
polygon.properties.area = area
|
||||
```
|
||||
|
||||
Returns **[number][2]** area in square meters
|
||||
Returns **[number][5]** area in square meters
|
||||
|
||||
[1]: https://tools.ietf.org/html/rfc7946#section-3
|
||||
|
||||
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
[2]: https://tools.ietf.org/html/rfc7946#section-3.1
|
||||
|
||||
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
|
||||
|
||||
[4]: https://tools.ietf.org/html/rfc7946#section-3.3
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@ import { earthRadius } from "@turf/helpers";
|
||||
import { geomReduce } from "@turf/meta";
|
||||
|
||||
/**
|
||||
* Takes one or more features and returns their area in square meters.
|
||||
* Calculates the geodesic area in square meters of one or more polygons.
|
||||
*
|
||||
* @name area
|
||||
* @param {GeoJSON} geojson input GeoJSON feature(s)
|
||||
* @function
|
||||
* @param {GeoJSON} geojson input polygon(s) as {@link Geometry}, {@link Feature}, or {@link FeatureCollection}
|
||||
* @returns {number} area in square meters
|
||||
* @example
|
||||
* var polygon = turf.polygon([[[125, -15], [113, -22], [154, -27], [144, -15], [125, -15]]]);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/area",
|
||||
"version": "7.0.0",
|
||||
"description": "turf area module",
|
||||
"version": "7.2.0",
|
||||
"description": "Calculates the geodesic area in square meters of one or more polygons.",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -52,20 +52,20 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ import { lineclip, polygonclip } from "./lib/lineclip.js";
|
||||
* [lineclip](https://github.com/mapbox/lineclip).
|
||||
* May result in degenerate edges when clipping Polygons.
|
||||
*
|
||||
* @name bboxClip
|
||||
* @function
|
||||
* @param {Feature<LineString|MultiLineString|Polygon|MultiPolygon>} feature feature to clip to the bbox
|
||||
* @param {BBox} bbox extent in [minX, minY, maxX, maxY] order
|
||||
* @returns {Feature<LineString|MultiLineString|Polygon|MultiPolygon>} clipped Feature
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/bbox-clip",
|
||||
"version": "7.0.0",
|
||||
"description": "turf bbox-clip module",
|
||||
"version": "7.2.0",
|
||||
"description": "Takes a Feature and a bbox and clips the feature to the bbox using lineclip.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Tim Channell <@tcql>",
|
||||
@ -57,22 +57,22 @@
|
||||
"test:tape": "tsx test.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@turf/bbox": "workspace:^",
|
||||
"@turf/bbox": "workspace:*",
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,8 +11,8 @@ Takes a bbox and returns an equivalent [polygon][1].
|
||||
* `bbox` **[BBox][2]** extent in \[minX, minY, maxX, maxY] order
|
||||
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
|
||||
|
||||
* `options.properties` **Properties** Translate properties to Polygon (optional, default `{}`)
|
||||
* `options.id` **([string][4] | [number][5])** Translate Id to Polygon (optional, default `{}`)
|
||||
* `options.properties` **[GeoJsonProperties][4]** Translate properties to Polygon (optional, default `{}`)
|
||||
* `options.id` **([string][5] | [number][6])** Translate Id to Polygon (optional, default `{}`)
|
||||
|
||||
### Examples
|
||||
|
||||
@ -25,7 +25,7 @@ var poly = turf.bboxPolygon(bbox);
|
||||
var addToMap = [poly]
|
||||
```
|
||||
|
||||
Returns **[Feature][6]<[Polygon][1]>** a Polygon representation of the bounding box
|
||||
Returns **[Feature][4]<[Polygon][1]>** a Polygon representation of the bounding box
|
||||
|
||||
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
||||
|
||||
@ -33,11 +33,11 @@ Returns **[Feature][6]<[Polygon][1]>** a Polygon representation of the bounding
|
||||
|
||||
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
[4]: https://tools.ietf.org/html/rfc7946#section-3.2
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
|
||||
[6]: https://tools.ietf.org/html/rfc7946#section-3.2
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
|
||||
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
|
||||
|
||||
|
||||
@ -4,10 +4,10 @@ import { polygon, Id } from "@turf/helpers";
|
||||
/**
|
||||
* Takes a bbox and returns an equivalent {@link Polygon|polygon}.
|
||||
*
|
||||
* @name bboxPolygon
|
||||
* @function
|
||||
* @param {BBox} bbox extent in [minX, minY, maxX, maxY] order
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
* @param {Properties} [options.properties={}] Translate properties to Polygon
|
||||
* @param {GeoJsonProperties} [options.properties={}] Translate properties to Polygon
|
||||
* @param {string|number} [options.id={}] Translate Id to Polygon
|
||||
* @returns {Feature<Polygon>} a Polygon representation of the bounding box
|
||||
* @example
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/bbox-polygon",
|
||||
"version": "7.0.0",
|
||||
"description": "turf bbox-polygon module",
|
||||
"version": "7.2.0",
|
||||
"description": "Converts a bounding box to a GeoJSON polygon.",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -53,17 +53,17 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import { coordEach } from "@turf/meta";
|
||||
* Calculates the bounding box for any GeoJSON object, including FeatureCollection.
|
||||
* Uses geojson.bbox if available and options.recompute is not set.
|
||||
*
|
||||
* @name bbox
|
||||
* @function
|
||||
* @param {GeoJSON} geojson any GeoJSON object
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
* @param {boolean} [options.recompute] Whether to ignore an existing bbox property on geojson
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/bbox",
|
||||
"version": "7.0.0",
|
||||
"description": "turf bbox module",
|
||||
"version": "7.2.0",
|
||||
"description": "Generates a bounding box around a GeoJSON feature.",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -54,18 +54,18 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,13 +2,13 @@ import { Coord, degreesToRadians, radiansToDegrees } from "@turf/helpers";
|
||||
import { getCoord } from "@turf/invariant";
|
||||
|
||||
// http://en.wikipedia.org/wiki/Haversine_formula
|
||||
// http://www.movable-type.co.uk/scripts/latlong.html
|
||||
// http://www.movable-type.co.uk/scripts/latlong.html#bearing
|
||||
|
||||
/**
|
||||
* Takes two {@link Point|points} and finds the geographic bearing between them,
|
||||
* i.e. the angle measured in degrees from the north line (0 degrees)
|
||||
*
|
||||
* @name bearing
|
||||
* @function
|
||||
* @param {Coord} start starting Point
|
||||
* @param {Coord} end ending Point
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/bearing",
|
||||
"version": "7.0.0",
|
||||
"description": "turf bearing module",
|
||||
"version": "7.2.0",
|
||||
"description": "Takes two points and finds the geographic bearing between them.",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -49,21 +49,21 @@
|
||||
"test:tape": "tsx test.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@turf/destination": "workspace:^",
|
||||
"@turf/destination": "workspace:*",
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ import { Spline } from "./lib/spline.js";
|
||||
*
|
||||
* The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/).
|
||||
*
|
||||
* @name bezierSpline
|
||||
* @function
|
||||
* @param {Feature<LineString>} line input LineString
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
* @param {Object} [options.properties={}] Translate properties to output
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/bezier-spline",
|
||||
"version": "7.0.0",
|
||||
"description": "turf bezier-spline module",
|
||||
"version": "7.2.0",
|
||||
"description": "Smooths a line into a curve using Bézier splines, great for visualizing routes.",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -53,20 +53,20 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import { getCoords } from "@turf/invariant";
|
||||
/**
|
||||
* Takes a ring and return true or false whether or not the ring is clockwise or counter-clockwise.
|
||||
*
|
||||
* @name booleanClockwise
|
||||
* @function
|
||||
* @param {Feature<LineString>|LineString|Array<Array<number>>} line to be evaluated
|
||||
* @returns {boolean} true/false
|
||||
* @example
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-clockwise",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-clockwise module",
|
||||
"version": "7.2.0",
|
||||
"description": "Takes a ring and return true or false whether or not the ring is clockwise or counter-clockwise.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Morgan Herlocker <@morganherlocker>",
|
||||
@ -57,20 +57,20 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import { getGeom } from "@turf/invariant";
|
||||
/**
|
||||
* Takes a polygon and return true or false as to whether it is concave or not.
|
||||
*
|
||||
* @name booleanConcave
|
||||
* @function
|
||||
* @param {Feature<Polygon>} polygon to be evaluated
|
||||
* @returns {boolean} true/false
|
||||
* @example
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-concave",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-concave module",
|
||||
"version": "7.2.0",
|
||||
"description": "Takes a polygon and return true or false as to whether it is concave or not.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Rowan Winsemius <@rowanwins>"
|
||||
@ -56,20 +56,20 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ import { getGeom } from "@turf/invariant";
|
||||
* must not intersect the exterior of the primary (geometry a).
|
||||
* Boolean-contains returns the exact opposite result of the `@turf/boolean-within`.
|
||||
*
|
||||
* @name booleanContains
|
||||
* @function
|
||||
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
||||
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
||||
* @returns {boolean} true/false
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-contains",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-contains module",
|
||||
"version": "7.2.0",
|
||||
"description": "Determines whether the second geometry is completely within the first geometry.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Rowan Winsemius <@rowanwins>",
|
||||
@ -56,25 +56,25 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"boolean-jsts": "*",
|
||||
"boolean-shapely": "*",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/bbox": "workspace:^",
|
||||
"@turf/boolean-point-in-polygon": "workspace:^",
|
||||
"@turf/boolean-point-on-line": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/bbox": "workspace:*",
|
||||
"@turf/boolean-point-in-polygon": "workspace:*",
|
||||
"@turf/boolean-point-on-line": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import { point } from "@turf/helpers";
|
||||
* Boolean-Crosses returns t (TRUE) for only multipoint/polygon, multipoint/linestring, linestring/linestring, linestring/polygon, and linestring/multipolygon comparisons.
|
||||
* Other comparisons are not supported as they are outside the OpenGIS Simple Features spec and may give unexpected results.
|
||||
*
|
||||
* @name booleanCrosses
|
||||
* @function
|
||||
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
||||
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
||||
* @returns {boolean} true/false
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-crosses",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-crosses module",
|
||||
"version": "7.2.0",
|
||||
"description": "Checks if two geometries cross each other.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Rowan Winsemius <@rowanwins>",
|
||||
@ -56,24 +56,24 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"boolean-shapely": "*",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/boolean-point-in-polygon": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/line-intersect": "workspace:^",
|
||||
"@turf/polygon-to-line": "workspace:^",
|
||||
"@turf/boolean-point-in-polygon": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@turf/line-intersect": "workspace:*",
|
||||
"@turf/polygon-to-line": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an
|
||||
* `feature2` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
|
||||
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
|
||||
|
||||
* `options.ignoreSelfIntersections` **[boolean][4]** ignores self-intersections on input features (optional, default `false`)
|
||||
* `options.ignoreSelfIntersections` **[boolean][4]** ignore self-intersections on input features (optional, default `true`)
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -14,11 +14,11 @@ import { polygonToLine } from "@turf/polygon-to-line";
|
||||
/**
|
||||
* Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set.
|
||||
*
|
||||
* @name booleanDisjoint
|
||||
* @function
|
||||
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
||||
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
* @param {boolean} [options.ignoreSelfIntersections=false] ignores self-intersections on input features
|
||||
* @param {boolean} [options.ignoreSelfIntersections=true] ignore self-intersections on input features
|
||||
* @returns {boolean} true if the intersection is an empty set, false otherwise
|
||||
* @example
|
||||
* var point = turf.point([2, 2]);
|
||||
@ -30,13 +30,12 @@ import { polygonToLine } from "@turf/polygon-to-line";
|
||||
function booleanDisjoint(
|
||||
feature1: Feature<any> | Geometry,
|
||||
feature2: Feature<any> | Geometry,
|
||||
options: {
|
||||
{
|
||||
ignoreSelfIntersections = true,
|
||||
}: {
|
||||
ignoreSelfIntersections?: boolean;
|
||||
} = {}
|
||||
} = { ignoreSelfIntersections: true }
|
||||
): boolean {
|
||||
const ignoreSelfIntersections: boolean =
|
||||
options.ignoreSelfIntersections ?? false;
|
||||
|
||||
let bool = true;
|
||||
flattenEach(feature1, (flatten1) => {
|
||||
flattenEach(feature2, (flatten2) => {
|
||||
@ -65,7 +64,6 @@ function booleanDisjoint(
|
||||
function disjoint(geom1: any, geom2: any, ignoreSelfIntersections: boolean) {
|
||||
switch (geom1.type) {
|
||||
case "Point":
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
switch (geom2.type) {
|
||||
case "Point":
|
||||
return !compareCoords(geom1.coordinates, geom2.coordinates);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-disjoint",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-disjoint module",
|
||||
"version": "7.2.0",
|
||||
"description": "Checks if two geometries have no overlapping areas.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Rowan Winsemius <@rowanwins>",
|
||||
@ -56,23 +56,23 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"boolean-shapely": "*",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/boolean-point-in-polygon": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/line-intersect": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/polygon-to-line": "workspace:^",
|
||||
"@turf/boolean-point-in-polygon": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/line-intersect": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@turf/polygon-to-line": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ test("turf-boolean-disjoint", (t) => {
|
||||
.sync(path.join(__dirname, "test", "true", "**", "*.geojson"))
|
||||
.forEach((filepath) => {
|
||||
const name = path.parse(filepath).name;
|
||||
const geojson = loadJsonFileSync(filepath);
|
||||
const geojson: GeoJSON.FeatureCollection = loadJsonFileSync(filepath);
|
||||
const feature1 = geojson.features[0];
|
||||
const feature2 = geojson.features[1];
|
||||
const result = disjoint(feature1, feature2);
|
||||
@ -30,7 +30,7 @@ test("turf-boolean-disjoint", (t) => {
|
||||
.sync(path.join(__dirname, "test", "false", "**", "*.geojson"))
|
||||
.forEach((filepath) => {
|
||||
const name = path.parse(filepath).name;
|
||||
const geojson = loadJsonFileSync(filepath);
|
||||
const geojson: GeoJSON.FeatureCollection = loadJsonFileSync(filepath);
|
||||
const feature1 = geojson.features[0];
|
||||
const feature2 = geojson.features[1];
|
||||
const result = disjoint(feature1, feature2);
|
||||
@ -117,64 +117,95 @@ test("turf-boolean-disjoin with ignoreSelfIntersections option", (t) => {
|
||||
},
|
||||
};
|
||||
|
||||
// Test without ignoringSelfIntersections option (default behavior)
|
||||
const selfIntersectingPolygon: GeoJSON.Feature<GeoJSON.Polygon> = {
|
||||
type: "Feature",
|
||||
properties: {},
|
||||
geometry: {
|
||||
type: "Polygon",
|
||||
coordinates: [
|
||||
[
|
||||
[1.5, 1],
|
||||
[2, 1.5],
|
||||
|
||||
[3, 0.5],
|
||||
[-1, 3],
|
||||
[1.5, 1],
|
||||
],
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
// Test with ignoringSelfIntersections = true (default behavior)
|
||||
let result = disjoint(selfIntersectingLineString, nonIntersectingLineString);
|
||||
t.false(
|
||||
t.true(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=false)"
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = disjoint(selfIntersectingLineString, intersectingLineString);
|
||||
t.false(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=false)"
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = disjoint(selfIntersectingLineString, intersectingPolygon);
|
||||
t.false(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=false)"
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = disjoint(selfIntersectingLineString, nonIntersectingPolygon);
|
||||
t.true(
|
||||
result,
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = disjoint(selfIntersectingPolygon, nonIntersectingPolygon);
|
||||
t.true(
|
||||
result,
|
||||
"[true] " + "selfIntersectingPolygon-Polygon (ignoreSelfIntersections=true)"
|
||||
);
|
||||
|
||||
// Test with ignoringSelfIntersections option set to false
|
||||
result = disjoint(selfIntersectingLineString, nonIntersectingLineString, {
|
||||
ignoreSelfIntersections: false,
|
||||
});
|
||||
t.false(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=false)"
|
||||
);
|
||||
result = disjoint(selfIntersectingLineString, intersectingLineString, {
|
||||
ignoreSelfIntersections: false,
|
||||
});
|
||||
t.false(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=false)"
|
||||
);
|
||||
result = disjoint(selfIntersectingLineString, intersectingPolygon, {
|
||||
ignoreSelfIntersections: false,
|
||||
});
|
||||
t.false(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=false)"
|
||||
);
|
||||
|
||||
// Test with ignoringSelfIntersections option
|
||||
result = disjoint(selfIntersectingLineString, nonIntersectingLineString, {
|
||||
ignoreSelfIntersections: true,
|
||||
});
|
||||
t.true(
|
||||
result,
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = disjoint(selfIntersectingLineString, intersectingLineString, {
|
||||
ignoreSelfIntersections: true,
|
||||
});
|
||||
t.false(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = disjoint(selfIntersectingLineString, intersectingPolygon, {
|
||||
ignoreSelfIntersections: true,
|
||||
});
|
||||
t.false(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = disjoint(selfIntersectingLineString, nonIntersectingPolygon, {
|
||||
ignoreSelfIntersections: true,
|
||||
ignoreSelfIntersections: false,
|
||||
});
|
||||
t.true(
|
||||
t.false(
|
||||
result,
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=true)"
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=false)"
|
||||
);
|
||||
result = disjoint(selfIntersectingPolygon, nonIntersectingPolygon, {
|
||||
ignoreSelfIntersections: false,
|
||||
});
|
||||
t.false(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingPolygon-Polygon (ignoreSelfIntersections=false)"
|
||||
);
|
||||
|
||||
t.end();
|
||||
|
||||
@ -7,7 +7,7 @@ import { getGeom } from "@turf/invariant";
|
||||
* Determine whether two geometries of the same type have identical X,Y coordinate values.
|
||||
* See http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm
|
||||
*
|
||||
* @name booleanEqual
|
||||
* @function
|
||||
* @param {Geometry|Feature} feature1 GeoJSON input
|
||||
* @param {Geometry|Feature} feature2 GeoJSON input
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-equal",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-equal module",
|
||||
"version": "7.2.0",
|
||||
"description": "Determine whether two geometries of the same type have identical X,Y coordinate values",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Tom MacWright <@tmcw>",
|
||||
@ -59,23 +59,23 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"boolean-shapely": "*",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/clean-coords": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/clean-coords": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"geojson-equality-ts": "^1.0.2",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ Boolean-intersects returns (TRUE) if the intersection of the two geometries is N
|
||||
* `feature2` **([Geometry][1] | [Feature][2]\<any>)** GeoJSON Feature or Geometry
|
||||
* `options` **[Object][3]** Optional parameters (optional, default `{}`)
|
||||
|
||||
* `options.ignoreSelfIntersections` **[boolean][4]** ignores self-intersections on input features (optional, default `false`)
|
||||
* `options.ignoreSelfIntersections` **[boolean][4]** ignore self-intersections on input features (optional, default `true`)
|
||||
|
||||
### Examples
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ import { flattenEach } from "@turf/meta";
|
||||
/**
|
||||
* Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.
|
||||
*
|
||||
* @name booleanIntersects
|
||||
* @function
|
||||
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
||||
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
* @param {boolean} [options.ignoreSelfIntersections=false] ignores self-intersections on input features
|
||||
* @param {boolean} [options.ignoreSelfIntersections=true] ignore self-intersections on input features
|
||||
* @returns {boolean} true if geometries intersect, false otherwise
|
||||
* @example
|
||||
* var point1 = turf.point([2, 2]);
|
||||
@ -30,13 +30,12 @@ import { flattenEach } from "@turf/meta";
|
||||
function booleanIntersects(
|
||||
feature1: Feature<any> | Geometry,
|
||||
feature2: Feature<any> | Geometry,
|
||||
options: {
|
||||
{
|
||||
ignoreSelfIntersections = true,
|
||||
}: {
|
||||
ignoreSelfIntersections?: boolean;
|
||||
} = {}
|
||||
) {
|
||||
const ignoreSelfIntersections: boolean =
|
||||
options.ignoreSelfIntersections ?? false;
|
||||
|
||||
let bool = false;
|
||||
flattenEach(feature1, (flatten1) => {
|
||||
flattenEach(feature2, (flatten2) => {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-intersects",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-intersects module",
|
||||
"version": "7.2.0",
|
||||
"description": "Checks if two geometries overlap in any way.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Rowan Winsemius <@rowanwins>",
|
||||
@ -57,21 +57,21 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"boolean-shapely": "*",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/boolean-disjoint": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/boolean-disjoint": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,62 +122,62 @@ test("turf-boolean-intersects with ignoreSelfIntersections option", (t) => {
|
||||
selfIntersectingLineString,
|
||||
nonIntersectingLineString
|
||||
);
|
||||
t.true(
|
||||
t.false(
|
||||
result,
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=false)"
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = intersects(selfIntersectingLineString, intersectingLineString);
|
||||
t.true(
|
||||
result,
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=false)"
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = intersects(selfIntersectingLineString, intersectingPolygon);
|
||||
t.true(
|
||||
result,
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=false)"
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=true)"
|
||||
);
|
||||
result = intersects(selfIntersectingLineString, nonIntersectingPolygon);
|
||||
t.true(
|
||||
t.false(
|
||||
result,
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=false)"
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=true)"
|
||||
);
|
||||
|
||||
// Test with ignoringSelfIntersections option
|
||||
result = intersects(selfIntersectingLineString, nonIntersectingLineString, {
|
||||
ignoreSelfIntersections: true,
|
||||
ignoreSelfIntersections: false,
|
||||
});
|
||||
t.false(
|
||||
t.true(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=true)"
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=false)"
|
||||
);
|
||||
result = intersects(selfIntersectingLineString, intersectingLineString, {
|
||||
ignoreSelfIntersections: true,
|
||||
ignoreSelfIntersections: false,
|
||||
});
|
||||
t.true(
|
||||
result,
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=true)"
|
||||
"selfIntersectingLineString-LineString (ignoreSelfIntersections=false)"
|
||||
);
|
||||
result = intersects(selfIntersectingLineString, intersectingPolygon, {
|
||||
ignoreSelfIntersections: true,
|
||||
ignoreSelfIntersections: false,
|
||||
});
|
||||
t.true(
|
||||
result,
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=true)"
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=false)"
|
||||
);
|
||||
result = intersects(selfIntersectingLineString, nonIntersectingPolygon, {
|
||||
ignoreSelfIntersections: true,
|
||||
ignoreSelfIntersections: false,
|
||||
});
|
||||
t.false(
|
||||
t.true(
|
||||
result,
|
||||
"[false] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=true)"
|
||||
"[true] " +
|
||||
"selfIntersectingLineString-Polygon (ignoreSelfIntersections=false)"
|
||||
);
|
||||
|
||||
t.end();
|
||||
|
||||
@ -12,7 +12,7 @@ import { geojsonEquality } from "geojson-equality-ts";
|
||||
*
|
||||
* In other words, it returns true if the two geometries overlap, provided that neither completely contains the other.
|
||||
*
|
||||
* @name booleanOverlap
|
||||
* @function
|
||||
* @param {Geometry|Feature<LineString|MultiLineString|Polygon|MultiPolygon>} feature1 input
|
||||
* @param {Geometry|Feature<LineString|MultiLineString|Polygon|MultiPolygon>} feature2 input
|
||||
* @returns {boolean} true/false
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-overlap",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-overlap module",
|
||||
"version": "7.2.0",
|
||||
"description": "Checks if two geometries have an area of overlap without one being completely contained inside the other.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Tim Channell <@tcql>",
|
||||
@ -58,25 +58,25 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"boolean-shapely": "*",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/line-intersect": "workspace:^",
|
||||
"@turf/line-overlap": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@turf/line-intersect": "workspace:*",
|
||||
"@turf/line-overlap": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"geojson-equality-ts": "^1.0.2",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import { bearingToAzimuth } from "@turf/helpers";
|
||||
/**
|
||||
* Boolean-Parallel returns True if each segment of `line1` is parallel to the correspondent segment of `line2`
|
||||
*
|
||||
* @name booleanParallel
|
||||
* @function
|
||||
* @param {Geometry|Feature<LineString>} line1 GeoJSON Feature or Geometry
|
||||
* @param {Geometry|Feature<LineString>} line2 GeoJSON Feature or Geometry
|
||||
* @returns {boolean} true/false if the lines are parallel
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-parallel",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-parallel module",
|
||||
"version": "7.2.0",
|
||||
"description": "Determine whether each segment of a line is parallel to the correspondent segment of another line.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Stefano Borghi <@stebogit>"
|
||||
@ -55,22 +55,22 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/clean-coords": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/line-segment": "workspace:^",
|
||||
"@turf/rhumb-bearing": "workspace:^",
|
||||
"@turf/clean-coords": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/line-segment": "workspace:*",
|
||||
"@turf/rhumb-bearing": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ import { getCoord, getGeom } from "@turf/invariant";
|
||||
* Takes a {@link Point} and a {@link Polygon} or {@link MultiPolygon} and determines if the point
|
||||
* resides inside the polygon. The polygon can be convex or concave. The function accounts for holes.
|
||||
*
|
||||
* @name booleanPointInPolygon
|
||||
* @function
|
||||
* @param {Coord} point input point
|
||||
* @param {Feature<Polygon|MultiPolygon>} polygon input polygon or multipolygon
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-point-in-polygon",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-point-in-polygon module",
|
||||
"version": "7.2.0",
|
||||
"description": "Checks if a point is inside an area, like a city boundary.",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -54,19 +54,19 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"point-in-polygon-hao": "^1.1.0",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import { getCoord, getCoords } from "@turf/invariant";
|
||||
* Returns true if a point is on a line. Accepts a optional parameter to ignore the
|
||||
* start and end vertices of the linestring.
|
||||
*
|
||||
* @name booleanPointOnLine
|
||||
* @function
|
||||
* @param {Coord} pt GeoJSON Point
|
||||
* @param {Feature<LineString>} line GeoJSON LineString
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
@ -97,6 +97,25 @@ function isPointOnLineSegment(
|
||||
} else if (cross !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Special cases for zero length lines
|
||||
// https://github.com/Turfjs/turf/issues/2750
|
||||
if (Math.abs(dxl) === Math.abs(dyl) && Math.abs(dxl) === 0) {
|
||||
// Zero length line.
|
||||
if (excludeBoundary) {
|
||||
// To be on a zero length line pt has to be on the start (and end), BUT we
|
||||
// are excluding start and end from possible matches.
|
||||
return false;
|
||||
}
|
||||
if (pt[0] === lineSegmentStart[0] && pt[1] === lineSegmentStart[1]) {
|
||||
// If point is same as start (and end) it's on the line segment
|
||||
return true;
|
||||
} else {
|
||||
// Otherwise point is somewhere else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!excludeBoundary) {
|
||||
if (Math.abs(dxl) >= Math.abs(dyl)) {
|
||||
return dxl > 0 ? x1 <= x && x <= x2 : x2 <= x && x <= x1;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-point-on-line",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-point-on-line module",
|
||||
"version": "7.2.0",
|
||||
"description": "Checks if a point lies directly on a line, like a path or road.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Rowan Winsemius <@rowanwins>"
|
||||
@ -53,21 +53,21 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,10 @@ import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import test from "tape";
|
||||
import { loadJsonFileSync } from "load-json-file";
|
||||
import { booleanPointOnLine as pointOnLine } from "./index.js";
|
||||
import { point, lineString } from "@turf/helpers";
|
||||
import booleanPointOnLine, {
|
||||
booleanPointOnLine as pointOnLine,
|
||||
} from "./index.js";
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
@ -36,3 +39,33 @@ test("turf-boolean-point-on-line", (t) => {
|
||||
});
|
||||
t.end();
|
||||
});
|
||||
|
||||
test("turf-boolean-point-on-line - issue 2750", (t) => {
|
||||
// Issue 2750 was that in the first test below where point is on a different
|
||||
// longitude to a zero length line booleanPointOnLine gave the correct result,
|
||||
// while the second test where a point on the SAME longitude, but nowhere
|
||||
// near, that zero length line incorrectly returned true.
|
||||
t.false(
|
||||
booleanPointOnLine(
|
||||
point([2, 13]),
|
||||
lineString([
|
||||
[1, 1],
|
||||
[1, 1],
|
||||
])
|
||||
),
|
||||
"#2750 different longitude point not on zero length line"
|
||||
);
|
||||
|
||||
t.false(
|
||||
booleanPointOnLine(
|
||||
point([1, 13]),
|
||||
lineString([
|
||||
[1, 1],
|
||||
[1, 1],
|
||||
])
|
||||
),
|
||||
"#2750 same longitude point not on zero length line"
|
||||
);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
@ -6,7 +6,8 @@ import { getGeom } from "@turf/invariant";
|
||||
/**
|
||||
* Boolean-touches true if none of the points common to both geometries
|
||||
* intersect the interiors of both geometries.
|
||||
* @name booleanTouches
|
||||
*
|
||||
* @function
|
||||
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
||||
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
||||
* @returns {boolean} true/false
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-touches",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-touches module",
|
||||
"version": "7.2.0",
|
||||
"description": "Determine whether none of the points common to both geometries intersect the interiors of both geometries.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Rowan Winsemius <@rowanwins>"
|
||||
@ -58,24 +58,24 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"boolean-jsts": "*",
|
||||
"boolean-shapely": "*",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/boolean-point-in-polygon": "workspace:^",
|
||||
"@turf/boolean-point-on-line": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/boolean-point-in-polygon": "workspace:*",
|
||||
"@turf/boolean-point-on-line": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import { booleanPointOnLine as isPointOnLine } from "@turf/boolean-point-on-line
|
||||
/**
|
||||
* booleanValid checks if the geometry is a valid according to the OGC Simple Feature Specification.
|
||||
*
|
||||
* @name booleanValid
|
||||
* @function
|
||||
* @param {Geometry|Feature<any>} feature GeoJSON Feature or Geometry
|
||||
* @returns {boolean} true/false
|
||||
* @example
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-valid",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-valid module",
|
||||
"version": "7.2.0",
|
||||
"description": "Checks if the geometry is a valid according to the OGC Simple Feature Specification.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Rowan Winsemius <@rowanwins>",
|
||||
@ -56,30 +56,30 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"boolean-jsts": "*",
|
||||
"boolean-shapely": "*",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/bbox": "workspace:^",
|
||||
"@turf/boolean-crosses": "workspace:^",
|
||||
"@turf/boolean-disjoint": "workspace:^",
|
||||
"@turf/boolean-overlap": "workspace:^",
|
||||
"@turf/boolean-point-in-polygon": "workspace:^",
|
||||
"@turf/boolean-point-on-line": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/line-intersect": "workspace:^",
|
||||
"@turf/bbox": "workspace:*",
|
||||
"@turf/boolean-crosses": "workspace:*",
|
||||
"@turf/boolean-disjoint": "workspace:*",
|
||||
"@turf/boolean-overlap": "workspace:*",
|
||||
"@turf/boolean-point-in-polygon": "workspace:*",
|
||||
"@turf/boolean-point-on-line": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@turf/line-intersect": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"geojson-polygon-self-intersections": "^1.2.1",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ import { getGeom } from "@turf/invariant";
|
||||
* must not intersect the exterior of the secondary (geometry b).
|
||||
* Boolean-within returns the exact opposite result of the `@turf/boolean-contains`.
|
||||
*
|
||||
* @name booleanWithin
|
||||
* @function
|
||||
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
|
||||
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
|
||||
* @returns {boolean} true/false
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/boolean-within",
|
||||
"version": "7.0.0",
|
||||
"description": "turf boolean-within module",
|
||||
"version": "7.2.0",
|
||||
"description": "Determines whether the first geometry is completely within the second geometry.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Rowan Winsemius <@rowanwins>"
|
||||
@ -58,25 +58,25 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"boolean-jsts": "*",
|
||||
"boolean-shapely": "*",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/bbox": "workspace:^",
|
||||
"@turf/boolean-point-in-polygon": "workspace:^",
|
||||
"@turf/boolean-point-on-line": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/bbox": "workspace:*",
|
||||
"@turf/boolean-point-in-polygon": "workspace:*",
|
||||
"@turf/boolean-point-on-line": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
## buffer
|
||||
|
||||
Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees.
|
||||
Calculates a buffer for input features for a given radius.
|
||||
|
||||
When using a negative radius, the resulting geometry may be invalid if
|
||||
it's too small compared to the radius magnitude. If the input is a
|
||||
@ -18,7 +18,7 @@ the input, or even be empty.
|
||||
* `radius` **[number][4]** distance to draw the buffer (negative values are allowed)
|
||||
* `options` **[Object][5]** Optional parameters (optional, default `{}`)
|
||||
|
||||
* `options.units` **[string][6]** any of the options supported by turf units (optional, default `"kilometers"`)
|
||||
* `options.units` **Units** Supports all valid Turf [Units][6]. (optional, default `"kilometers"`)
|
||||
* `options.steps` **[number][4]** number of steps (optional, default `8`)
|
||||
|
||||
### Examples
|
||||
@ -43,7 +43,7 @@ Returns **([FeatureCollection][1] | [Feature][3]<([Polygon][7] | [MultiPolygon][
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
[6]: https://turfjs.org/docs/api/types/Units
|
||||
|
||||
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ import {
|
||||
const { BufferOp, GeoJSONReader, GeoJSONWriter } = jsts;
|
||||
|
||||
/**
|
||||
* Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees.
|
||||
* Calculates a buffer for input features for a given radius.
|
||||
*
|
||||
* When using a negative radius, the resulting geometry may be invalid if
|
||||
* it's too small compared to the radius magnitude. If the input is a
|
||||
@ -21,11 +21,11 @@ const { BufferOp, GeoJSONReader, GeoJSONWriter } = jsts;
|
||||
* FeatureCollection - i.e., the output collection may have fewer members than
|
||||
* the input, or even be empty.
|
||||
*
|
||||
* @name buffer
|
||||
* @function
|
||||
* @param {FeatureCollection|Geometry|Feature<any>} geojson input to be buffered
|
||||
* @param {number} radius distance to draw the buffer (negative values are allowed)
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
* @param {string} [options.units="kilometers"] any of the options supported by turf units
|
||||
* @param {Units} [options.units="kilometers"] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}.
|
||||
* @param {number} [options.steps=8] number of steps
|
||||
* @returns {FeatureCollection|Feature<Polygon|MultiPolygon>|undefined} buffered features
|
||||
* @example
|
||||
@ -80,7 +80,7 @@ function buffer(geojson, radius, options) {
|
||||
* @private
|
||||
* @param {Feature<any>} geojson input to be buffered
|
||||
* @param {number} radius distance to draw the buffer
|
||||
* @param {string} [units='kilometers'] any of the options supported by turf units
|
||||
* @param {Units} [units='kilometers'] Supports all valid Turf {@link https://turfjs.org/docs/api/types/Units Units}.
|
||||
* @param {number} [steps=8] number of steps
|
||||
* @returns {Feature<Polygon|MultiPolygon>} buffered feature
|
||||
*/
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/buffer",
|
||||
"version": "7.0.0",
|
||||
"description": "turf buffer module",
|
||||
"version": "7.2.0",
|
||||
"description": "Creates a buffer around a GeoJSON feature.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Tom MacWright <@tmcw>",
|
||||
@ -60,24 +60,24 @@
|
||||
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@turf/truncate": "workspace:^",
|
||||
"@turf/truncate": "workspace:*",
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/bbox": "workspace:^",
|
||||
"@turf/center": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/bbox": "workspace:*",
|
||||
"@turf/center": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/jsts": "^2.7.1",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/projection": "workspace:^",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@turf/projection": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"d3-geo": "1.7.1"
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import { isNumber, point, Id } from "@turf/helpers";
|
||||
/**
|
||||
* Takes a {@link Feature} or {@link FeatureCollection} and returns the mean center. Can be weighted.
|
||||
*
|
||||
* @name centerMean
|
||||
* @function
|
||||
* @param {GeoJSON} geojson GeoJSON to be centered
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
* @param {Object} [options.properties={}] Translate GeoJSON Properties to Point
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/center-mean",
|
||||
"version": "7.0.0",
|
||||
"description": "turf center-mean module",
|
||||
"version": "7.2.0",
|
||||
"description": "Takes a Feature or FeatureCollection and returns the mean center.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Moacir P. de Sá Pereira <@muziejus>"
|
||||
@ -58,25 +58,25 @@
|
||||
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@turf/center": "workspace:^",
|
||||
"@turf/truncate": "workspace:^",
|
||||
"@turf/center": "workspace:*",
|
||||
"@turf/truncate": "workspace:*",
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/bbox": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/bbox": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ import { featureEach } from "@turf/meta";
|
||||
* Statistics for Geographers_, 3rd ed., New York: The Guilford
|
||||
* Press, 2009, 150–151.
|
||||
*
|
||||
* @name centerMedian
|
||||
* @function
|
||||
* @param {FeatureCollection<any>} features Any GeoJSON Feature Collection
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
* @param {string} [options.weight] the property name used to weight the center
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/center-median",
|
||||
"version": "7.0.0",
|
||||
"description": "turf center-median module",
|
||||
"version": "7.2.0",
|
||||
"description": "Takes a FeatureCollection of points and calculates the median center.",
|
||||
"author": "Turf Authors",
|
||||
"contributors": [
|
||||
"Moacir P. de Sá Pereira <@muziejus>"
|
||||
@ -52,28 +52,28 @@
|
||||
"test:tape": "tsx test.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@turf/center": "workspace:^",
|
||||
"@turf/center-of-mass": "workspace:^",
|
||||
"@turf/random": "workspace:^",
|
||||
"@turf/truncate": "workspace:^",
|
||||
"@turf/center": "workspace:*",
|
||||
"@turf/center-of-mass": "workspace:*",
|
||||
"@turf/random": "workspace:*",
|
||||
"@turf/truncate": "workspace:*",
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/center-mean": "workspace:^",
|
||||
"@turf/centroid": "workspace:^",
|
||||
"@turf/distance": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/center-mean": "workspace:*",
|
||||
"@turf/centroid": "workspace:*",
|
||||
"@turf/distance": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import { coordEach } from "@turf/meta";
|
||||
/**
|
||||
* Takes any {@link Feature} or a {@link FeatureCollection} and returns its [center of mass](https://en.wikipedia.org/wiki/Center_of_mass) using this formula: [Centroid of Polygon](https://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon).
|
||||
*
|
||||
* @name centerOfMass
|
||||
* @function
|
||||
* @param {GeoJSON} geojson GeoJSON to be centered
|
||||
* @param {Object} [options={}] Optional Parameters
|
||||
* @param {Object} [options.properties={}] Translate Properties to Feature
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/center-of-mass",
|
||||
"version": "7.0.0",
|
||||
"description": "turf center-of-mass module",
|
||||
"version": "7.2.0",
|
||||
"description": "Finds the “balance point” of irregular shapes, like a country outline.",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -51,24 +51,24 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/centroid": "workspace:^",
|
||||
"@turf/convex": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/invariant": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/centroid": "workspace:*",
|
||||
"@turf/convex": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/invariant": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import { point, Id, AllGeoJSON } from "@turf/helpers";
|
||||
/**
|
||||
* Takes a {@link Feature} or {@link FeatureCollection} and returns the absolute center point of all features.
|
||||
*
|
||||
* @name center
|
||||
* @function
|
||||
* @param {GeoJSON} geojson GeoJSON to be centered
|
||||
* @param {Object} [options={}] Optional parameters
|
||||
* @param {Object} [options.properties={}] Translate GeoJSON Properties to Point
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/center",
|
||||
"version": "7.0.0",
|
||||
"description": "turf center module",
|
||||
"version": "7.2.0",
|
||||
"description": "Finds the central point of a GeoJSON feature, like a city or a park. Ideal for placing labels or markers.",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -54,24 +54,24 @@
|
||||
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@turf/bbox-polygon": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/bbox-polygon": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/bbox": "workspace:^",
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/bbox": "workspace:*",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import { coordEach } from "@turf/meta";
|
||||
/**
|
||||
* Computes the centroid as the mean of all vertices within the object.
|
||||
*
|
||||
* @name centroid
|
||||
* @function
|
||||
* @param {GeoJSON} geojson GeoJSON to be centered
|
||||
* @param {Object} [options={}] Optional Parameters
|
||||
* @param {Object} [options.properties={}] an Object that is used as the {@link Feature}'s properties
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@turf/centroid",
|
||||
"version": "7.0.0",
|
||||
"description": "turf centroid module",
|
||||
"version": "7.2.0",
|
||||
"description": "Determines the geometric center of a polygon or shape.",
|
||||
"author": "Turf Authors",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
@ -53,21 +53,21 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/benchmark": "^2.1.5",
|
||||
"@types/tape": "^4.2.32",
|
||||
"@types/tape": "^5.8.1",
|
||||
"benchmark": "^2.1.4",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^11.0.2",
|
||||
"load-json-file": "^7.0.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"tape": "^5.7.2",
|
||||
"tsup": "^8.0.1",
|
||||
"tsx": "^4.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"write-json-file": "^5.0.0"
|
||||
"tape": "^5.9.0",
|
||||
"tsup": "^8.4.0",
|
||||
"tsx": "^4.19.4",
|
||||
"typescript": "^5.8.3",
|
||||
"write-json-file": "^6.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@turf/helpers": "workspace:^",
|
||||
"@turf/meta": "workspace:^",
|
||||
"@turf/helpers": "workspace:*",
|
||||
"@turf/meta": "workspace:*",
|
||||
"@types/geojson": "^7946.0.10",
|
||||
"tslib": "^2.6.2"
|
||||
"tslib": "^2.8.1"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,17 +4,17 @@
|
||||
|
||||
## circle
|
||||
|
||||
Takes a [Point][1] and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.
|
||||
Takes a [Point][1] and calculates the circle polygon given a radius in [Units][2]; and steps for precision.
|
||||
|
||||
### Parameters
|
||||
|
||||
* `center` **([Feature][2]<[Point][1]> | [Array][3]<[number][4]>)** center point
|
||||
* `radius` **[number][4]** radius of the circle
|
||||
* `options` **[Object][5]** Optional parameters (optional, default `{}`)
|
||||
* `center` **([Feature][3]<[Point][1]> | [Array][4]<[number][5]>)** center point
|
||||
* `radius` **[number][5]** radius of the circle
|
||||
* `options` **[Object][6]** Optional parameters (optional, default `{}`)
|
||||
|
||||
* `options.steps` **[number][4]** number of steps (optional, default `64`)
|
||||
* `options.units` **[string][6]** miles, kilometers, degrees, or radians (optional, default `'kilometers'`)
|
||||
* `options.properties` **[Object][5]** properties (optional, default `{}`)
|
||||
* `options.steps` **[number][5]** number of steps (optional, default `64`)
|
||||
* `options.units` **Units** Supports all valid Turf [Units][2] (optional, default `'kilometers'`)
|
||||
* `options.properties` **[Object][6]** properties (optional, default `{}`)
|
||||
|
||||
### Examples
|
||||
|
||||
@ -28,19 +28,19 @@ var circle = turf.circle(center, radius, options);
|
||||
var addToMap = [turf.point(center), circle]
|
||||
```
|
||||
|
||||
Returns **[Feature][2]<[Polygon][7]>** circle polygon
|
||||
Returns **[Feature][3]<[Polygon][7]>** circle polygon
|
||||
|
||||
[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
|
||||
|
||||
[2]: https://tools.ietf.org/html/rfc7946#section-3.2
|
||||
[2]: https://turfjs.org/docs/api/types/Units
|
||||
|
||||
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
||||
[3]: https://tools.ietf.org/html/rfc7946#section-3.2
|
||||
|
||||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
||||
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
||||
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
||||
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
||||
|
||||
[7]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user