Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geocrystal/ring_area
Calculate the approximate area of the polygon were it projected onto the earth.
https://github.com/geocrystal/ring_area
crystal geospatial
Last synced: 15 days ago
JSON representation
Calculate the approximate area of the polygon were it projected onto the earth.
- Host: GitHub
- URL: https://github.com/geocrystal/ring_area
- Owner: geocrystal
- License: mit
- Created: 2024-04-11T11:10:03.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-12-03T09:00:29.000Z (3 months ago)
- Last Synced: 2024-12-12T06:24:00.744Z (2 months ago)
- Topics: crystal, geospatial
- Language: Crystal
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ring_area
[](https://github.com/geocrystal/ring_area/actions/workflows/crystal.yml)
[](https://github.com/geocrystal/ring_area/releases)
[](https://github.com/geocrystal/ring_area/blob/main/LICENSE)Calculate the approximate area of the polygon were it projected onto the earth.
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
ring_area:
github: geocrystal/ring_area
```2. Run `shards install`
## Usage
```crystal
require "ring_area"coordinates = [
[125, -15],
[113, -22],
[117, -37],
[130, -33],
[148, -39],
[154, -27],
[144, -15],
[125, -15],
]RingArea.ring_area(coordinates).to_meters
# => 7748891609977.456
```
Accepts an `Array(Array(Number))` of Ring Coordinates as `[[longitude1, latitude1], [longitude2, latitude2], ...]`.Returns a `RingArea::Area` object which can provide output in kilometers, meters, miles, feet, etc.
## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request## Contributors
- [Anton Maminov](https://github.com/mamantoha) - creator and maintainer