-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add vertex mode functions #138
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
[![Coverage Status](https://coveralls.io/repos/github/uber/h3-js/badge.svg?branch=master)](https://coveralls.io/github/uber/h3-js?branch=master) | ||
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) | ||
[![npm version](https://badge.fury.io/js/h3-js.svg)](https://badge.fury.io/js/h3-js) | ||
[![H3 Version](https://img.shields.io/badge/h3_api-v4.0.0-rc2-blue.svg)](https://github.com/uber/h3/releases/tag/v4.0.0-rc2) | ||
[![H3 Version](https://img.shields.io/static/v1?label=h3%20api&message=v4.0.0-rc2&color=blue)](https://github.com/uber/h3/releases/tag/v4.0.0-rc2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, thanks |
||
|
||
The `h3-js` library provides a pure-JavaScript version of the [H3 Core Library](https://github.com/uber/h3), a hexagon-based geographic grid system. It can be used either in Node >= 6 or in the browser. The core library is transpiled from C using [emscripten](http://kripken.github.io/emscripten-site), offering full parity with the C API and highly efficient operations. | ||
|
||
|
@@ -135,6 +135,10 @@ const coordinates = h3.cellsToMultiPolygon(hexagons, true); | |
* [.exactEdgeLength(edge, unit)](#module_h3.exactEdgeLength) ⇒ <code>number</code> | ||
* [.getHexagonAreaAvg(res, unit)](#module_h3.getHexagonAreaAvg) ⇒ <code>number</code> | ||
* [.getHexagonEdgeLengthAvg(res, unit)](#module_h3.getHexagonEdgeLengthAvg) ⇒ <code>number</code> | ||
* [.cellToVertex(h3Index, vertexNum)](#module_h3.cellToVertex) ⇒ <code>H3Index</code> | ||
* [.cellToVertexes(h3Index)](#module_h3.cellToVertexes) ⇒ <code>Array.<H3Index></code> | ||
* [.vertexToLatLng(h3Index)](#module_h3.vertexToLatLng) ⇒ <code>Array.<number></code> | ||
* [.isValidVertex(h3Index)](#module_h3.isValidVertex) ⇒ <code>boolean</code> | ||
* [.getNumCells(res)](#module_h3.getNumCells) ⇒ <code>number</code> | ||
* [.getRes0Cells()](#module_h3.getRes0Cells) ⇒ <code>Array.<H3Index></code> | ||
* [.getPentagons(res)](#module_h3.getPentagons) ⇒ <code>Array.<H3Index></code> | ||
|
@@ -794,6 +798,63 @@ Average hexagon edge length at a given resolution | |
| unit | <code>string</code> | Distance unit (either UNITS.m, UNITS.km, or UNITS.rads) | | ||
|
||
|
||
* * * | ||
|
||
<a name="module_h3.cellToVertex"></a> | ||
|
||
### h3.cellToVertex(h3Index, vertexNum) ⇒ <code>H3Index</code> | ||
Find the index for a vertex of a cell. | ||
|
||
**Returns**: <code>H3Index</code> - Vertex index | ||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| h3Index | <code>H3IndexInput</code> | Cell to find the vertex for | | ||
| vertexNum | <code>number</code> | Number (index) of the vertex to calculate | | ||
|
||
|
||
* * * | ||
|
||
<a name="module_h3.cellToVertexes"></a> | ||
|
||
### h3.cellToVertexes(h3Index) ⇒ <code>Array.<H3Index></code> | ||
Find the indexes for all vertexes of a cell. | ||
|
||
**Returns**: <code>Array.<H3Index></code> - All vertex indexes of this cell | ||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| h3Index | <code>H3IndexInput</code> | Cell to find all vertexes for | | ||
|
||
|
||
* * * | ||
|
||
<a name="module_h3.vertexToLatLng"></a> | ||
|
||
### h3.vertexToLatLng(h3Index) ⇒ <code>Array.<number></code> | ||
Get the lat, lng of a given vertex | ||
|
||
**Returns**: <code>Array.<number></code> - Latitude, longitude coordinates of the vertex | ||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| h3Index | <code>H3IndexInput</code> | A vertex index | | ||
|
||
|
||
* * * | ||
|
||
<a name="module_h3.isValidVertex"></a> | ||
|
||
### h3.isValidVertex(h3Index) ⇒ <code>boolean</code> | ||
Returns true if the input is a valid vertex index. | ||
|
||
**Returns**: <code>boolean</code> - True if the index represents a vertex | ||
|
||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| h3Index | <code>H3IndexInput</code> | An index to test for being a vertex index | | ||
|
||
|
||
* * * | ||
|
||
<a name="module_h3.getNumCells"></a> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙏