Skip to content

RESTAR-inc/geojson_area

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GeoJSON.Area

Hex Version docs CI

Compute the area of GeoJSON geometries.

Ported to Elixir from mapbox/geojson-area (javascript).

Installation

The package can be installed by adding geojson_area to your list of dependencies in mix.exs:

def deps do
  [
    {:geojson_area, "~> 0.1.0"}
  ]
end

Examples

geometry_area/1 supports any GeoJSON geometry:

755640.4952324519 = GeoJSON.Area.geometry_area(%{
  type: "Polygon",
  coordinates: [
    [
      [139.7755122184753, 35.721064511354726],
      [139.76765871047974, 35.71514121326722],
      [139.76913928985596, 35.70895612333854],
      [139.77330207824707, 35.71014091012367],
      [139.7796106338501, 35.71869524495784],
      [139.7755122184753, 35.721064511354726]
    ]
  ]
})

Specialized functions such as ring_area/1, polygon_area/1 or multi_polygon_area/1 can work directly on coordinates:

3571505.5755534363 = GeoJSON.Area.ring_area([
  [139.7643756866455, 35.65645937572578],
  [139.78179931640625, 35.633720988098574],
  [139.75862503051758, 35.623256366178964],
  [139.7643756866455, 35.65645937572578]
])

About

Compute the area of GeoJSON geometries in Elixir

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages