10000 Update examples and docs for longitude range change (#93) by isaacbrodsky · Pull Request #118 · uber/h3 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update examples and docs for longitude range change (#93) #118

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

Merged
merged 2 commits into from
Aug 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The public API of this library consists of the functions declared in file
[h3api.h](./src/h3lib/include/h3api.h).

## [Unreleased]
### Changed
- Longitude outputs are now guaranteed to be in the range [-Pi, Pi]. (#93)

## [3.1.0] - 2018-08-03
### Added
Expand Down
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ This will produce the vertices of the hexagon at this location:
```
8a2a1072b59ffff
{
40.690058601 285.955848238
40.689907695 285.954938208
40.689270936 285.954658582
40.688785091 285.955288969
40.688935993 285.956198979
40.689572744 285.956478623
}
```
40.690058601 -74.044151762
40.689907695 -74.045061792
40.689270936 -74.045341418
40.688785091 -74.044711031
40.688935993 -74.043801021
40.689572744 -74.043521377
}```

You can get the center coordinate of the hexagon like so:

Expand All @@ -125,7 +124,7 @@ You can get the center coordinate of the hexagon like so:
This will produce some coordinate:

```
40.6894218437 285.9555686001
40.6894218437 -74.0444313999
```

### From C
Expand All @@ -141,13 +140,13 @@ You should get output like:

```
The index is: 8a2a1072b59ffff
Boundary vertex #0: 40.690059, 285.955848
Boundary vertex #1: 40.689908, 285.954938
Boundary vertex #2: 40.689271, 285.954659
Boundary vertex #3: 40.688785, 285.955289
Boundary vertex #4: 40.688936, 285.956199
Boundary vertex #5: 40.689573, 285.956479
Center coordinates: 40.689422, 285.955569
Boundary vertex #0: 40.690059, -74.044152
Boundary vertex #1: 40.689908, -74.045062
Boundary vertex #2: 40.689271, -74.045341
Boundary vertex #3: 40.688785, -74.044711
Boundary vertex #4: 40.688936, -74.043801
Boundary vertex #5: 40.689573, -74.043521
Center coordinates: 40.689422, -74.044431
```

## Contributing
Expand Down
6 changes: 3 additions & 3 deletions examples/distance.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ int main(int argc, char *argv[]) {
radsToDegs(geoHQ2.lon), h3Distance(h3HQ1, h3HQ2),
haversineDistance(geoHQ1.lat, geoHQ1.lon, geoHQ2.lat, geoHQ2.lon));
// Output:
// origin: (37.775236, 237.580245)
// destination: (37.789991, 237.597879)
// origin: (37.775236, -122.419755)
// destination: (37.789991, -122.402121)
// grid distance: 2340
// distance in km: 2.256850km
// distance in km: 2.256853km
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why this changed - FPE? Why are all of the coords here so different in their fractional digits from the previous versions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference I see here is 0.000003km difference on the distance. Not sure if that's important. The coords look like they are correctly updated to unconstrained_longitude - 360.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...because apparently I can't do simple math, and wasn't expecting a different fraction with the sign change. Stet.

}
4 changes: 4 additions & 0 deletions examples/edge.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ int main(int argc, char *argv[]) {
radsToDegs(boundary.verts[v].lat),
radsToDegs(boundary.verts[v].lon));
}
// Output:
// The edge is 16a2a1072b59ffff
// Edge vertex #0: 40.690059, -74.044152
// Edge vertex #1: 40.689908, -74.045062
}
0