geojson_area
Version, currently 0.2.14 versions
- 0.2.1latestApr 30, 2024
- 0.2.0not indexedJun 28, 2026
- 0.1.1not indexedJun 28, 2026
- 0.1.0not indexedJun 28, 2026
github.com/geocrystal/geojson_area
Calculate the area inside of any GeoJSON geometry
7 stars
1 dependent
License: MIT
Installation
# Add this to your shard.yml
dependencies:
geojson_area:
github: geocrystal/geojson_area
version: ~> 0.2.1Then run:
shards installshard.yml
- Crystal
>= 1.0.0- License
- MIT
- Author
- Anton Maminov
Dependencies
Runtime Dependencies
Development Dependencies
- ameba*github: crystal-ameba/amebadev
README
GeoJSON::Area
Calculate the area inside of any GeoJSON geometry.
Installation
-
Add the dependency to your
shard.yml:dependencies: geojson_area: github: geocrystal/geojson_area -
Run
shards install
Usage
require "geojson_area"
This adds area method for all GeoJSON objects:
polygon = GeoJSON::Polygon.new([
[[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0,-10.0]],
[[-1.0, -2.0], [3.0, -2.0], [3.0, 2.0], [-1.0,-2.0]]
])
polygon.area
# => 2366726096087.807
Also you can use GeoJSON::Area.area() directly.
This method accept any GeoJSON object, and returns contained area as square meters.
polygon = GeoJSON::Polygon.new([
[[-10.0, -10.0], [10.0, -10.0], [10.0, 10.0], [-10.0,-10.0]],
[[-1.0, -2.0], [3.0, -2.0], [3.0, 2.0], [-1.0,-2.0]]
])
GeoJSON::Area.area(polygon)
# => 2366726096087.807
Contributing
- Fork it (https://github.com/geocrystal/geojson_area/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Anton Maminov - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.2.1- Tagged
- Apr 30, 2024
- Commit
22f65ccd1698- Crystal
>= 1.0.0- Indexed
- yes
Dependents
Repository
github.com/geocrystal/geojson_area
Metadata
- Created
- Aug 12, 2026
- Updated
- Oct 20, 2026
- Synced
- Oct 20, 2026
- Versions
- 4