All Projects → pkinney → topo

pkinney / topo

Licence: MIT license
A Geometry library for Elixir that calculates spatial relationships between two geometries

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to topo

Cga.js
CGA 3D 计算几何算法库 | 3D Compute Geometry Algorithm Library webgl three.js babylon.js等任何库都可以使用
Stars: ✭ 313 (+150.4%)
Mutual labels:  geometry, geospatial, gis
Geopython
Notebooks and libraries for spatial/geo Python explorations
Stars: ✭ 268 (+114.4%)
Mutual labels:  geospatial, computational-geometry, spatial-analysis
python-for-gis-progression-path
Progression path for a GIS analyst who wants to become proficient in using Python for GIS: from apprentice to guru
Stars: ✭ 98 (-21.6%)
Mutual labels:  geospatial, gis, spatial-analysis
Urbansprawl
Open framework for calculating spatial urban sprawl indices and performing disaggregated population estimates using open data
Stars: ✭ 48 (-61.6%)
Mutual labels:  geospatial, gis, spatial-analysis
Awesome Gis
😎Awesome GIS is a collection of geospatial related sources, including cartographic tools, geoanalysis tools, developer tools, data, conference & communities, news, massive open online course, some amazing map sites, and more.
Stars: ✭ 2,582 (+1965.6%)
Mutual labels:  geospatial, gis, spatial-analysis
Turf Swift
A Swift language port of Turf.js.
Stars: ✭ 123 (-1.6%)
Mutual labels:  geospatial, gis, computational-geometry
Osmnx
OSMnx: Python for street networks. Retrieve, model, analyze, and visualize street networks and other spatial data from OpenStreetMap.
Stars: ✭ 3,357 (+2585.6%)
Mutual labels:  geospatial, gis, spatial-analysis
Geometry
Boost.Geometry - Generic Geometry Library | Requires C++14 since Boost 1.75
Stars: ✭ 282 (+125.6%)
Mutual labels:  geometry, computational-geometry, spatial-analysis
spatial efd
A spatial aware implementation of elliptical Fourier analysis
Stars: ✭ 19 (-84.8%)
Mutual labels:  geospatial, gis, spatial-analysis
deegree3
Official deegree repository providing geospatial core libraries, data access and advanced OGC web service implementations
Stars: ✭ 118 (-5.6%)
Mutual labels:  geospatial, gis
SplashGeom
Open-source C++ library for geometry and linear algebra
Stars: ✭ 22 (-82.4%)
Mutual labels:  geometry, computational-geometry
olturf
A Turf toolbar for OpenLayers.
Stars: ✭ 30 (-76%)
Mutual labels:  geospatial, gis
localtileserver
🌐 dynamic tile server for visualizing rasters in Jupyter with ipyleaflet or folium
Stars: ✭ 190 (+52%)
Mutual labels:  geospatial, gis
kdtree
A pure Nim k-d tree implementation for efficient spatial querying of point data
Stars: ✭ 40 (-68%)
Mutual labels:  gis, spatial-analysis
Spatial-Analysis-Mapping-Projects
Project Documentation, Best Practices & Procedures for Spatial Analysis and Mapping Projects
Stars: ✭ 15 (-88%)
Mutual labels:  geospatial, spatial-analysis
Tinfour
Delaunay and Constrained Delaunay Triangulations in Java, providing high-performance utilities for modeling surfaces with support for Lidar LAS files, Digital Elevation Models (DEM), finite element analysis, path planning, natural neighbor interpolation, and other applications of Triangulated Irregular Networks (TIN)
Stars: ✭ 119 (-4.8%)
Mutual labels:  gis, computational-geometry
earthengine-apps
A collection of Earth Engine Apps created using geemap, voila, and heroku
Stars: ✭ 20 (-84%)
Mutual labels:  geospatial, gis
rsgislib
Remote Sensing and GIS Software Library; python module tools for processing spatial data.
Stars: ✭ 103 (-17.6%)
Mutual labels:  gis, spatial-analysis
Cgal
The public CGAL repository, see the README below
Stars: ✭ 2,825 (+2160%)
Mutual labels:  geometry, computational-geometry
pygeopackage
A Python package to read/write spatial data to a geopackage.
Stars: ✭ 33 (-73.6%)
Mutual labels:  geospatial, gis

Geometry Library for Elixir

Build Status Hex.pm

A Geometry library for Elixir that calculates spatial relationships between two geometries. Geometries can be of any of the following types:

  • Point
  • LineString
  • Polygon
  • MultiPoint
  • MultiLineString
  • MultiPolygon

Installation

defp deps do
  [{:topo, "~> 0.5"}]
end

Usage

Full Documentation

The Topo module provides functions for determining the relationship between two geometries. Each function returns a boolean and accepts any combination of Point, LineString, Polygon, MultiPoint, MultiLineString, or MultiPolygon.

  • intersects? - Geometries A and B share at least one point in common.
  • disjoint? - Disjoint geometries share no points in common. This is the direct opposite of the intersects? result.
  • contains? - All points of geometry B lie within A. See section below on [Contains].
  • within? - This is the direct inverse of contains?. All points of geometry A lie within geometry B.
  • equals? - Geometries A and B are equivalent and cover the exact same set of points. By definition, A and B are equal if A contains B and B contains A. Equality does not necessarily mean that the geometries are of the same type. A Point A is equal to a MultiPoint that contains only the same Point A.

Each of these functions can be passed any two Geometries in either a Map with a :type and :coordinates keys or as a struct generated via the Geo library. Coordinates are represented as atoms {x, y} and multiple coordinates as Lists.

a = %{type: "Polygon", coordinates: [[{2, 2}, {20, 2}, {11, 11}, {2, 2}]]}
b = %Geo.Polygon{coordinates: [[{2, 2}, {20, 2}, {11, 11}, {2, 2}]]}

Topo.equals? a, b # => true

Instead of a Point geometry, just a single coordinate can be used.

a = %{type: "Polygon", coordinates: [[{2, 2}, {20, 2}, {11, 11}, {2, 2}]]}

Topo.intersects? a, {4, 6} # => true

The Topo library's functions will automatically attempt to "clean" geometries passed to them:

  • Linear Rings (including Polygons) will be reordered to a counter-clockwise direction.
  • Polygon's Linear Rings will automatically be closed if the first point is not repeated as the last point.
  • Points that are equal or collinear with surrounding points are removed from LineStrings or Polygons.

A note on contains?

There are a few non-obvious special cases that are worth mentioning:

  • A Polygon does not contain its own boundary. Specifically a LineString that is the exact same as a Polygon's exterior Linear ring is not contained within a that Polygon.
a = %Geo.Polygon{coordinates: [[{2, 2}, {20, 2}, {11, 11}, {2, 2}]]}
b = %Geo.LineString{coordinates: [{2, 2}, {20, 2}, {11, 11}, {2, 2}]}

Topo.contains? a, b # => false
Topo.intersects? a, b  # => true
  • A LineString does not contain it's own first and last point (unless those points are the same, as in a LinearRing)
a = %Geo.LineString{coordinates: [{1, 3}, {2, -1}, {0, -1}]}
b = %Geo.LineString{coordinates: [{1, 3}, {2, -1}, {0, -1}, {1, 3}]}

Topo.contains? a, {1, 3} # => false
Topo.intersects? a, {1, 3} # => true
Topo.contains? b, {1, 3} # => true

Tests

> mix test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].