Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mamantoha committed Mar 29, 2020
1 parent 354d092 commit 8e534b6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# geojson_area
# GeoJSON::Area

TODO: Write a description here
[![Build Status](https://travis-ci.org/geocrystal/geojson_area.svg?branch=master)](https://travis-ci.org/geocrystal/geojson_area)
[![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

Expand All @@ -9,7 +12,7 @@ TODO: Write a description here
```yaml
dependencies:
geojson_area:
github: your-github-user/geojson_area
github: geocrystal/geojson_area
```
2. Run `shards install`
Expand All @@ -20,20 +23,26 @@ TODO: Write a description here
require "geojson_area"
```

TODO: Write usage instructions here
`GeoJSON::Area.area()` accept any `GeoJSON` object, and returns contained area as square meters.

## Development
```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]]
])
TODO: Write development instructions here
GeoJSON::Area.area(polygon)
# => 2366726096087.807
```

## Contributing

1. Fork it (<https://github.com/your-github-user/geojson_area/fork>)
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/your-github-user) - creator and maintainer
- [Anton Maminov](https://github.com/mamantoha) - creator and maintainer
10 changes: 10 additions & 0 deletions spec/geojson_area_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,14 @@ describe GeoJSON::Area do

area.zero?.should be_truthy
end

it "computes the area of polygon from readme" do
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]],
])

area = GeoJSON::Area.area(polygon)
area.should eq(2366726096087.807)
end
end

0 comments on commit 8e534b6

Please sign in to comment.