geojson_area

Version, currently 0.2.04 versions

github.com/geocrystal/geojson_area

Calculate the area inside of any GeoJSON geometry

7 stars
1 dependent
License: MIT

Nothing has been indexed for 0.2.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  geojson_area:
    github: geocrystal/geojson_area
    version: ~> 0.2.0

Then run:

shards install

shard.yml

No shard.yml has been indexed for 0.2.0. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

# GeoJSON::Area

![Crystal CI](https://github.com/geocrystal/geojson_area/workflows/Crystal%20CI/badge.svg)
[![License](https://img.shields.io/github/license/geocrystal/geojson_area.svg)](https://github.com/geocrystal/geojson_area/blob/master/LICENSE)

Calculate the area inside of any [GeoJSON](https://github.com/geocrystal/geojson) geometry.

## Installation

1. Add the dependency to your `shard.yml`:

   ```yaml
   dependencies:
     geojson_area:
       github: geocrystal/geojson_area
   ```

2. Run `shards install`

## Usage

```crystal
require "geojson_area"
```

This adds `area` method for all `GeoJSON` objects:

```crystal
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.

```crystal
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

1. Fork it (<https://github.com/geocrystal/geojson_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

- [Anton Maminov](https://github.com/mamantoha) - creator and maintainer