simagyari
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 ![]()
Hex: geomeasure | Hex
HexDocs: GeoMeasure — GeoMeasure v1.8.0
The GitHub repository is available at the link below:
Most Liked
simagyari
Hi Everyone,
Just a quick note that with the recently published v1.4.0, GeoMeasure enables the transfer of SRIDs from the input to the output in functions that return Geo structs. I think this is an important step for the usability of this package. With the current state of development, it can now function well for everyday tasks that require measuring the supported properties, with limitations explained in the readme of the package.
For future development angles, I am working on the support of Z values for more complex structs, which will be a larger piece of work, as it probably requires contributing to Geo with some PolygonZ and potentially PolygonZM implementations. I am also thinking about issues with handling coplanar and non-coplanar polygons for area calculations, which might be quite troublesome. Once I am happy with the single-geometry situation, I will move on to implementing the methods for multipart geometries, too.
For more information, feel free to check out the links I posted at the beginning of the thread.
mudasobwa
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
kip
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?
olivermt
The Geo lib takes care of that at least (I use it quite a bit).
simagyari
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 ![]()







