GeoMeasure - calculate properties of Geo structs

Hi Everyone,

I’d like to share my first open-source package and my first Elixir project, GeoMeasure. It enables one to calculate properties, such as area, perimeter, bounding box, extent, etc. of different Geo geometries. It might be of interest to those in the geospatial domain, as it allows easy property calculations without having to worry about extracting coordinates from your Geo structs, and instead just passing the whole item as a parameter to the functions.
Currently, the project is in its infancy, as I have just published it to Hex. It supports calculations with Geo.Point, Geo.LineString and Geo.Polygon for now, but I plan on eventually supporting all available geometries in the Geo package.
Making this package is a great learning experience for me and I hope it can be useful some members of the community, too. Please feel free to ask any question, and make suggestions :slight_smile:

Hex: geomeasure | Hex
HexDocs: GeoMeasure — GeoMeasure v0.0.1

The GitHub repository is available at the link below:

13 Likes

One day, you might be interested to marry it to geolocation, so I’d just drop a link to a geoloc library here: LibLatLon v0.8.0 — Documentation

3 Likes

A good addition to the ecosystem, thank you.

Does the library make any assumptions about whether the coordinates are {lat, lon} or {lon, lat}? Are different SRIDs supported?

2 Likes

The Geo lib takes care of that at least (I use it quite a bit).

3 Likes

Due to the way some properties are calculated, the package can only be used eith projected coordinate systems. Calculating these properties on an ellispoid requires different methods, but I hope I can expand to support those, too, in the near future.

The assumption is, at least for the functions that return geometries, is {lon, lat}, or more like {x,y}, since we are talking projected coordinates.

Thats great, thats what the polygons in tz_world are defined to be. Might be fun to use your library to calculate the area of different timezones (although I can’t image a real-world use for that).

Hi Everyone,

I have just published a new version (v1.0.0) of GeoMeasure, it contains some potentially breaking changes, which, I believe, significantly improve the integrity of the package. GeoMeasure can now handle nil values in input coordinates (throws ArgumentError), and it does not implement functions for geometries where the result does not exist (such as area of Geo.Point). It also encourages the use of the main module as the entry point, instead of the submodules. Overall, the documentation and the way to interface with the package are much clearer now. I hope you’ll find this an improvement in usability and I welcome any and all suggestions for future improvements and expansion.

Have fun using Elixir :slight_smile:

1 Like

Sounds like a fun use case, probably there is some real-world use in it if one wants to research the area of time zones and the number of people inside them, as well as the land area. Might be good for some colonialism studies. But I doubt anyone who does that actually ventures in here :smiley: