Skip to content

Commit

Permalink
Update README.
Browse files Browse the repository at this point in the history
  • Loading branch information
munterfi committed Jul 15, 2023
1 parent a40a0e5 commit 4172b92
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ The flexible polyline encoding is a variant of the [Encoded Polyline Algorithm F

**Note:**

- The order of the coordinates (lng, lat) does not correspond to the original C++ implementation (lat, lng). This enables direct conversion to `sf` objects, without reordering the columns.
- The encoding is lossy, this means the encoding process could reduce the precision of your data.
- The order of the coordinates (lng, lat) does not correspond to the original
C++ implementation (lat, lng). This enables direct conversion to `sf` objects,
without reordering the columns.
- The encoding is lossy, this means the encoding process could reduce the
precision of your data.

## Installation

Expand All @@ -35,16 +38,18 @@ Install the released version of **flexpolyline** from [CRAN](https://CRAN.R-proj
install.packages("flexpolyline")
```

Or get the development version from [GitHub](https://github.com/munterfi/flexpolyline):
To install the development version from [GitHub](https://github.com/munterfi/flexpolyline):

```r
remotes::install_github("munterfi/flexpolyline")
```

## C++ binding

Encoding and decoding in R is straight forward by using `encode()` and `decode()`.
These functions are binding to the flexpolyline C++ implementation and reflect the arguments and return values of their counterparts (`hf::encode_polyline` and `hf::decode_polyline`):
Encoding and decoding in R is straight forward by using `encode()` and
`decode()`. These functions are binding to the flexpolyline C++ implementation
and reflect the arguments and return values of their counterparts
(`hf::flexpolyline::polyline_encode` and `hf::flexpolyline::polyline_decode`):

```r
line <- matrix(
Expand All @@ -62,10 +67,10 @@ decode("BlBoz5xJ67i1BU1B7PUzIhaUxL7YU")

## Simple feature support

A common way to deal with spatial data in R is the
[sf](https://CRAN.R-project.org/package=sf) package, which is
built on the concept of simple features. The functions `encode_sf()` and
`decode_sf()` provide an interface that support the encoding of sf objects:
The **flexpolyline** package integrates with the popular
[sf](https://CRAN.R-project.org/package=sf) package for working with spatial
data in R, which is built on the concept of simple features. The package
provides additional functions for encoding and decoding sf objects directly:

```r
sfg <- sf::st_linestring(line, dim = "XYZ")
Expand All @@ -77,8 +82,10 @@ decode_sf("BlBoz5xJ67i1BU1B7PUzIhaUxL7YU")

## Contributing

- Contributions to this package are very welcome, issues and pull requests are the preferred ways to share them. Please see the [Contribution Guidelines](https://github.com/munterfi/flexpolyline/blob/master/.github/CONTRIBUTING.md).
- This project is released with a [Contributor Code of Conduct](https://github.com/munterfi/flexpolyline/blob/master/.github/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
- Contributions to this package are welcome, issues and pull requests are the
preferred ways to share them. Please see the [Contribution Guidelines](https://github.com/munterfi/flexpolyline/blob/master/.github/CONTRIBUTING.md).
- This project is released with a [Contributor Code of Conduct](https://github.com/munterfi/flexpolyline/blob/master/.github/CODE_OF_CONDUCT.md).
By participating in this project you agree to abide by its terms.

## References

Expand All @@ -89,5 +96,5 @@ decode_sf("BlBoz5xJ67i1BU1B7PUzIhaUxL7YU")

## License

- The **flexpolyline** R package is licensed under GNU GPL v3.0.
- The C++ implementation by HERE Europe B.V. is licensed under MIT.
The **flexpolyline** R package is licensed under GNU GPL v3.0. The C++
implementation by HERE Europe B.V. is licensed under MIT.

0 comments on commit 4172b92

Please sign in to comment.