-
Notifications
You must be signed in to change notification settings - Fork 35
towsg84 and tomercator unit [Improve helpers.dart with better documentation and code style] #219
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
Open
Newmanjack
wants to merge
10
commits into
dartclub:main
Choose a base branch
from
deanpapas:oWSG84_and_toMercator_unit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8dc4b65
Add pointOnFeature functionality to find points on GeoJSON features
Newmanjack 1cdef12
Update pointOnFeature tests and export functionality in turf.dart
Newmanjack c1b3fc7
Move point_on_feature test to components directory and improve test o…
Newmanjack f6c0e41
Add point_on_feature benchmark for performance testing
Newmanjack 41bfee5
Added toWGS84 and toMercator as member functions of the coordinate types
Newmanjack a343ee7
Improve documentation for coordinate projection functions to follow D…
Newmanjack bc121a5
Add comprehensive helpers examples with coordinate system conversions
Newmanjack ac923d9
Improve helpers.dart with better documentation and code style
Newmanjack 4c2bc53
Remove point_on_feature files from this branch
Newmanjack f76bb45
Refactor coordinate system conversion functions to use Position type
Newmanjack 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Turf Helpers Examples | ||
|
||
This directory contains examples demonstrating the utility functions in the `helpers.dart` file of the turf_dart library. | ||
|
||
## Files in this Directory | ||
|
||
1. **helpers_example.dart**: Practical examples of using the helpers functions with explanations and output | ||
2. **helpers_visualization.geojson**: Visual demonstration of the helpers functions for viewing in a GeoJSON viewer | ||
3. **test_helpers.dart**: Simple test functions that exercise each major function in the helpers.dart file | ||
|
||
## Functionality Demonstrated | ||
|
||
### Unit Conversions | ||
- Convert between different length units (kilometers, miles, meters, etc.) | ||
- Convert between different area units | ||
- Convert between radians, degrees, and real-world units | ||
|
||
### Angle Conversions | ||
- Convert between degrees and radians | ||
- Convert bearings to azimuths (normalized angles) | ||
|
||
### Rounding Functions | ||
- Round numbers to specific precision levels | ||
|
||
## Running the Examples | ||
|
||
To run the example code and see the output: | ||
|
||
```bash | ||
dart test/examples/helpers/helpers_example.dart | ||
``` | ||
|
||
## Visualization | ||
|
||
The `helpers_visualization.geojson` file can be viewed in any GeoJSON viewer to see visual examples of: | ||
|
||
1. **Distance Conversion**: Circle with 10km radius showing conversion between degrees and kilometers | ||
2. **Bearing Example**: Line and points showing bearing/azimuth concepts | ||
3. **Angle Conversion**: Points at different angles (0°, 90°, 180°, 270°) around a circle | ||
4. **Area Conversion**: Square with 10km² area | ||
|
||
## Helper Functions Reference | ||
|
||
| Function | Description | | ||
|----------|-------------| | ||
| `radiansToLength(radians, unit)` | Convert radians to real-world distance units | | ||
| `lengthToRadians(distance, unit)` | Convert real-world distance to radians | | ||
| `lengthToDegrees(distance, unit)` | Convert real-world distance to degrees | | ||
| `bearingToAzimuth(bearing)` | Convert any bearing angle to standard azimuth (0-360°) | | ||
| `radiansToDegrees(radians)` | Convert radians to degrees | | ||
| `degreesToRadians(degrees)` | Convert degrees to radians | | ||
| `convertLength(length, fromUnit, toUnit)` | Convert length between different units | | ||
| `convertArea(area, fromUnit, toUnit)` | Convert area between different units | | ||
| `round(value, precision)` | Round number to specified precision | | ||
| `toMercator(coord)` | Convert WGS84 coordinates [lon, lat] to Web Mercator [x, y] | | ||
| `toWGS84(coord)` | Convert Web Mercator coordinates [x, y] to WGS84 [lon, lat] | | ||
| `convertCoordinates(coord, fromSystem, toSystem)` | Convert coordinates between different systems | |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.