ring_area v0.2.1

Calculate the approximate area of the polygon were it projected onto the earth.

ring_area

Crystal CI GitHub release License

Calculate the approximate area of the polygon were it projected onto the earth.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      ring_area:
        github: geocrystal/ring_area
    
  2. Run shards install

Usage

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 (https://github.com/geocrystal/ring_area/fork)
  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

Repository

ring_area

Owner
Statistic
  • 1
  • 0
  • 0
  • 2
  • 0
  • about 1 month ago
  • April 11, 2024
License

MIT License

Links
Synced at

Thu, 21 Nov 2024 22:38:09 GMT

Languages