Full GeometryOps API documentation
This page is still very much WIP!
Documentation for GeometryOps's full API (only for reference!).
GeometryOps.AbstractBarycentricCoordinateMethod
GeometryOps.DouglasPeucker
GeometryOps.LineOrientation
GeometryOps.MeanValue
GeometryOps.PointOrientation
GeometryOps.RadialDistance
GeometryOps.SimplifyAlg
GeometryOps.VisvalingamWhyatt
GeometryOps._det
GeometryOps._equals_curves
GeometryOps.angles
GeometryOps.angles
GeometryOps.apply
GeometryOps.apply
GeometryOps.applyreduce
GeometryOps.area
GeometryOps.area
GeometryOps.centroid
GeometryOps.centroid
GeometryOps.centroid_and_area
GeometryOps.centroid_and_length
GeometryOps.contains
GeometryOps.contains
GeometryOps.coveredby
GeometryOps.coveredby
GeometryOps.covers
GeometryOps.covers
GeometryOps.crosses
GeometryOps.crosses
GeometryOps.difference
GeometryOps.disjoint
GeometryOps.distance
GeometryOps.distance
GeometryOps.embed_extent
GeometryOps.embed_extent
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.flatten
GeometryOps.flip
GeometryOps.get_contours
GeometryOps.intersection
GeometryOps.intersection_points
GeometryOps.intersects
GeometryOps.intersects
GeometryOps.isclockwise
GeometryOps.isconcave
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.polygon_to_line
GeometryOps.polygonize
GeometryOps.rebuild
GeometryOps.reconstruct
GeometryOps.reproject
GeometryOps.reproject
GeometryOps.signed_area
GeometryOps.signed_area
GeometryOps.signed_distance
GeometryOps.signed_distance
GeometryOps.simplify
GeometryOps.t_value
GeometryOps.to_edges
GeometryOps.touches
GeometryOps.touches
GeometryOps.transform
GeometryOps.transform
GeometryOps.tuples
GeometryOps.union
GeometryOps.unwrap
GeometryOps.weighted_mean
GeometryOps.within
GeometryOps.within
apply
and associated functions
GeometryOps.apply
— Functionapply(f, target::Type{<:AbstractTrait}, obj; kw...)
Reconstruct a geometry, feature, feature collection, or nested vectors of either using the function f
on the target
trait.
f(target_geom) => x
where x
also has the target
trait, or a trait that can be substituted. For example, swapping PolgonTrait
to MultiPointTrait
will fail if the outer object has MultiPolygonTrait
, but should work if it has FeatureTrait
.
Objects "shallower" than the target trait are always completely rebuilt, like a Vector
of FeatureCollectionTrait
of FeatureTrait
when the target has PolygonTrait
and is held in the features. But "deeper" objects may remain unchanged - such as points and linear rings if the target is the same PolygonTrait
.
The result is a functionally similar geometry with values depending on f
threaded
:true
orfalse
. Whether to use multithreading. Defaults tofalse
.crs
: The CRS to attach to geometries. Defaults tonothing
.calc_extent
:true
orfalse
. Whether to calculate the extent. Defaults tofalse
.
Example
Flipped point the order in any feature or geometry, or iterables of either:
```juia import GeoInterface as GI import GeometryOps as GO geom = GI.Polygon([GI.LinearRing([(1, 2), (3, 4), (5, 6), (1, 2)]), GI.LinearRing([(3, 4), (5, 6), (6, 7), (3, 4)])])
flipped_geom = GO.apply(GI.PointTrait, geom) do p (GI.y(p), GI.x(p)) end
GeometryOps.reproject
— Functionreproject(geometry; source_crs, target_crs, transform, always_xy, time)
+API Reference · GeometryOps.jl Full GeometryOps API documentation
Warning This page is still very much WIP!
Documentation for GeometryOps's full API (only for reference!).
GeometryOps.AbstractBarycentricCoordinateMethod
GeometryOps.DouglasPeucker
GeometryOps.LineOrientation
GeometryOps.MeanValue
GeometryOps.PointOrientation
GeometryOps.RadialDistance
GeometryOps.SimplifyAlg
GeometryOps.VisvalingamWhyatt
GeometryOps._det
GeometryOps._equals_curves
GeometryOps.angles
GeometryOps.angles
GeometryOps.apply
GeometryOps.apply
GeometryOps.applyreduce
GeometryOps.area
GeometryOps.area
GeometryOps.centroid
GeometryOps.centroid
GeometryOps.centroid_and_area
GeometryOps.centroid_and_length
GeometryOps.contains
GeometryOps.contains
GeometryOps.coveredby
GeometryOps.coveredby
GeometryOps.covers
GeometryOps.covers
GeometryOps.crosses
GeometryOps.crosses
GeometryOps.difference
GeometryOps.disjoint
GeometryOps.disjoint
GeometryOps.distance
GeometryOps.distance
GeometryOps.embed_extent
GeometryOps.embed_extent
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.equals
GeometryOps.flatten
GeometryOps.flip
GeometryOps.get_contours
GeometryOps.intersection
GeometryOps.intersection_points
GeometryOps.intersects
GeometryOps.intersects
GeometryOps.isclockwise
GeometryOps.isconcave
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.overlaps
GeometryOps.polygon_to_line
GeometryOps.polygonize
GeometryOps.rebuild
GeometryOps.reconstruct
GeometryOps.reproject
GeometryOps.reproject
GeometryOps.signed_area
GeometryOps.signed_area
GeometryOps.signed_distance
GeometryOps.signed_distance
GeometryOps.simplify
GeometryOps.t_value
GeometryOps.to_edges
GeometryOps.touches
GeometryOps.touches
GeometryOps.transform
GeometryOps.transform
GeometryOps.tuples
GeometryOps.union
GeometryOps.unwrap
GeometryOps.weighted_mean
GeometryOps.within
GeometryOps.within
apply
and associated functions
GeometryOps.apply
— Functionapply(f, target::Type{<:AbstractTrait}, obj; kw...)
Reconstruct a geometry, feature, feature collection, or nested vectors of either using the function f
on the target
trait.
f(target_geom) => x
where x
also has the target
trait, or a trait that can be substituted. For example, swapping PolgonTrait
to MultiPointTrait
will fail if the outer object has MultiPolygonTrait
, but should work if it has FeatureTrait
.
Objects "shallower" than the target trait are always completely rebuilt, like a Vector
of FeatureCollectionTrait
of FeatureTrait
when the target has PolygonTrait
and is held in the features. But "deeper" objects may remain unchanged - such as points and linear rings if the target is the same PolygonTrait
.
The result is a functionally similar geometry with values depending on f
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
Example
Flipped point the order in any feature or geometry, or iterables of either:
```julia import GeoInterface as GI import GeometryOps as GO geom = GI.Polygon([GI.LinearRing([(1, 2), (3, 4), (5, 6), (1, 2)]), GI.LinearRing([(3, 4), (5, 6), (6, 7), (3, 4)])])
flipped_geom = GO.apply(GI.PointTrait, geom) do p (GI.y(p), GI.x(p)) end
sourceGeometryOps.reproject
— Functionreproject(geometry; source_crs, target_crs, transform, always_xy, time)
reproject(geometry, source_crs, target_crs; always_xy, time)
-reproject(geometry, transform; always_xy, time)
Reproject any GeoInterface.jl compatible geometry
from source_crs
to target_crs
.
The returned object will be constructed from GeoInterface.WrapperGeometry
geometries, wrapping views of a Vector{Proj.Point{D}}
, where D
is the dimension.
Arguments
geometry
: Any GeoInterface.jl compatible geometries.source_crs
: the source coordinate referece system, as a GeoFormatTypes.jl object or a string.target_crs
: the target coordinate referece system, as a GeoFormatTypes.jl object or a string.
If these a passed as keywords, transform
will take priority. Without it target_crs
is always needed, and source_crs
is needed if it is not retreivable from the geometry with GeoInterface.crs(geometry)
.
Keywords
always_xy
: force x, y coordinate order, true
by default. false
will expect and return points in the crs coordinate order.time
: the time for the coordinates. Inf
by default.threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
sourceGeometryOps.transform
— Functiontransform(f, obj)
Apply a function f
to all the points in obj
.
Points will be passed to f
as an SVector
to allow using CoordinateTransformations.jl and Rotations.jl without hassle.
SVector
is also a valid GeoInterface.jl point, so will work in all GeoInterface.jl methods.
Example
julia> import GeoInterface as GI
+reproject(geometry, transform; always_xy, time)
Reproject any GeoInterface.jl compatible geometry
from source_crs
to target_crs
.
The returned object will be constructed from GeoInterface.WrapperGeometry
geometries, wrapping views of a Vector{Proj.Point{D}}
, where D
is the dimension.
Arguments
geometry
: Any GeoInterface.jl compatible geometries.source_crs
: the source coordinate referece system, as a GeoFormatTypes.jl object or a string.target_crs
: the target coordinate referece system, as a GeoFormatTypes.jl object or a string.
If these a passed as keywords, transform
will take priority. Without it target_crs
is always needed, and source_crs
is needed if it is not retreivable from the geometry with GeoInterface.crs(geometry)
.
Keywords
always_xy
: force x, y coordinate order, true
by default. false
will expect and return points in the crs coordinate order.time
: the time for the coordinates. Inf
by default.threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
sourceGeometryOps.transform
— Functiontransform(f, obj)
Apply a function f
to all the points in obj
.
Points will be passed to f
as an SVector
to allow using CoordinateTransformations.jl and Rotations.jl without hassle.
SVector
is also a valid GeoInterface.jl point, so will work in all GeoInterface.jl methods.
Example
julia> import GeoInterface as GI
julia> import GeometryOps as GO
@@ -20,140 +20,147 @@
GeoInterface.Wrappers.Polygon{false, false, Vector{GeoInterface.Wrappers.LinearRing{false, false, Vector{StaticArraysCore.SVector{2, Int64}}, Nothing, Nothing}}, Nothing, Nothing}(GeoInterface.Wrappers.LinearR
ing{false, false, Vector{StaticArraysCore.SVector{2, Int64}}, Nothing, Nothing}[GeoInterface.Wrappers.LinearRing{false, false, Vector{StaticArraysCore.SVector{2, Int64}}, Nothing, Nothing}(StaticArraysCore.SVe
ctor{2, Int64}[[2, 1], [4, 3], [6, 5], [2, 1]], nothing, nothing), GeoInterface.Wrappers.LinearRing{false, false, Vector{StaticArraysCore.SVector{2, Int64}}, Nothing, Nothing}(StaticArraysCore.SVector{2, Int64
-}[[4, 3], [6, 5], [7, 6], [4, 3]], nothing, nothing)], nothing, nothing)
sourceGeneral geometry methods
OGC methods
GeometryOps.contains
— Functioncontains(g1::AbstractGeometry, g2::AbstractGeometry)::Bool
Return true if the second geometry is completely contained by the first geometry. The interiors of both geometries must intersect and the interior and boundary of the secondary (g2) must not intersect the exterior of the first (g1).
contains
returns the exact opposite result of within
.
Examples
import GeometryOps as GO, GeoInterface as GI
+}[[4, 3], [6, 5], [7, 6], [4, 3]], nothing, nothing)], nothing, nothing)
sourceGeneral geometry methods
OGC methods
GeometryOps.contains
— Functioncontains(g1::AbstractGeometry, g2::AbstractGeometry)::Bool
Return true if the second geometry is completely contained by the first geometry. The interiors of both geometries must intersect and the interior and boundary of the secondary (g2) must not intersect the exterior of the first (g1).
contains
returns the exact opposite result of within
.
Examples
import GeometryOps as GO, GeoInterface as GI
line = GI.LineString([(1, 1), (1, 2), (1, 3), (1, 4)])
point = GI.Point((1, 2))
GO.contains(line, point)
# output
-true
sourceGeometryOps.coveredby
— Functioncoveredby(g1, g2)::Bool
Return true
if the first geometry is completely covered by the second geometry. The interior and boundary of the primary geometry (g1) must not intersect the exterior of the secondary geometry (g2).
Furthermore, coveredby
returns the exact opposite result of covers
. They are equivalent with the order of the arguments swapped.
Examples
import GeometryOps as GO, GeoInterface as GI
+true
sourceGeometryOps.coveredby
— Functioncoveredby(g1, g2)::Bool
Return true
if the first geometry is completely covered by the second geometry. The interior and boundary of the primary geometry (g1) must not intersect the exterior of the secondary geometry (g2).
Furthermore, coveredby
returns the exact opposite result of covers
. They are equivalent with the order of the arguments swapped.
Examples
import GeometryOps as GO, GeoInterface as GI
p1 = GI.Point(0.0, 0.0)
p2 = GI.Point(1.0, 1.0)
l1 = GI.Line([p1, p2])
GO.coveredby(p1, l1)
# output
-true
sourceGeometryOps.covers
— Functioncovers(g1::AbstractGeometry, g2::AbstractGeometry)::Bool
Return true if the first geometry is completely covers the second geometry, The exterior and boundary of the second geometry must not be outside of the interior and boundary of the first geometry. However, the interiors need not intersect.
covers
returns the exact opposite result of coveredby
.
Examples
import GeometryOps as GO, GeoInterface as GI
+true
sourceGeometryOps.covers
— Functioncovers(g1::AbstractGeometry, g2::AbstractGeometry)::Bool
Return true if the first geometry is completely covers the second geometry, The exterior and boundary of the second geometry must not be outside of the interior and boundary of the first geometry. However, the interiors need not intersect.
covers
returns the exact opposite result of coveredby
.
Examples
import GeometryOps as GO, GeoInterface as GI
l1 = GI.LineString([(1, 1), (1, 2), (1, 3), (1, 4)])
l2 = GI.LineString([(1, 1), (1, 2)])
GO.covers(l1, l2)
# output
-true
sourceGeometryOps.crosses
— Function crosses(geom1, geom2)::Bool
Return true
if the intersection results in a geometry whose dimension is one less than the maximum dimension of the two source geometries and the intersection set is interior to both source geometries.
TODO: broken
Examples
import GeoInterface as GI, GeometryOps as GO
-# TODO: Add working example
sourceMissing docstring. Missing docstring for disjiont
. Check Documenter's build log for details.
GeometryOps.intersects
— Functionintersects(geom1, geom2)::Bool
Return true if the interiors or boundaries of the two geometries interact.
intersects
returns the exact opposite result of disjoint
.
Example
import GeoInterface as GI, GeometryOps as GO
+true
sourceGeometryOps.crosses
— Function crosses(geom1, geom2)::Bool
Return true
if the intersection results in a geometry whose dimension is one less than the maximum dimension of the two source geometries and the intersection set is interior to both source geometries.
TODO: broken
Examples
import GeoInterface as GI, GeometryOps as GO
+# TODO: Add working example
sourceGeometryOps.disjoint
— Functiondisjoint(geom1, geom2)::Bool
Return true
if the first geometry is disjoint from the second geometry.
Return true
if the first geometry is disjoint from the second geometry. The interiors and boundaries of both geometries must not intersect.
Examples
import GeometryOps as GO, GeoInterface as GI
+
+line = GI.LineString([(1, 1), (1, 2), (1, 3), (1, 4)])
+point = (2, 2)
+GO.disjoint(point, line)
+
+# output
+true
sourceGeometryOps.intersects
— Functionintersects(geom1, geom2)::Bool
Return true if the interiors or boundaries of the two geometries interact.
intersects
returns the exact opposite result of disjoint
.
Example
import GeoInterface as GI, GeometryOps as GO
line1 = GI.Line([(124.584961,-12.768946), (126.738281,-17.224758)])
line2 = GI.Line([(123.354492,-15.961329), (127.22168,-14.008696)])
GO.intersects(line1, line2)
# output
-true
sourceGeometryOps.overlaps
— Functionoverlaps(geom1, geom2)::Bool
Compare two Geometries of the same dimension and return true if their intersection set results in a geometry different from both but of the same dimension. This means one geometry cannot be within or contain the other and they cannot be equal
Examples
import GeometryOps as GO, GeoInterface as GI
+true
sourceGeometryOps.overlaps
— Functionoverlaps(geom1, geom2)::Bool
Compare two Geometries of the same dimension and return true if their intersection set results in a geometry different from both but of the same dimension. This means one geometry cannot be within or contain the other and they cannot be equal
Examples
import GeometryOps as GO, GeoInterface as GI
poly1 = GI.Polygon([[(0,0), (0,5), (5,5), (5,0), (0,0)]])
poly2 = GI.Polygon([[(1,1), (1,6), (6,6), (6,1), (1,1)]])
GO.overlaps(poly1, poly2)
# output
-true
sourceoverlaps(::GI.AbstractTrait, geom1, ::GI.AbstractTrait, geom2)::Bool
For any non-specified pair, all have non-matching dimensions, return false.
sourceoverlaps(
+true
sourceoverlaps(::GI.AbstractTrait, geom1, ::GI.AbstractTrait, geom2)::Bool
For any non-specified pair, all have non-matching dimensions, return false.
sourceoverlaps(
::GI.MultiPointTrait, points1,
::GI.MultiPointTrait, points2,
-)::Bool
If the multipoints overlap, meaning some, but not all, of the points within the multipoints are shared, return true.
sourceoverlaps(::GI.LineTrait, line1, ::GI.LineTrait, line)::Bool
If the lines overlap, meaning that they are colinear but each have one endpoint outside of the other line, return true. Else false.
sourceoverlaps(
+)::Bool
If the multipoints overlap, meaning some, but not all, of the points within the multipoints are shared, return true.
sourceoverlaps(::GI.LineTrait, line1, ::GI.LineTrait, line)::Bool
If the lines overlap, meaning that they are colinear but each have one endpoint outside of the other line, return true. Else false.
sourceoverlaps(
::Union{GI.LineStringTrait, GI.LinearRing}, line1,
::Union{GI.LineStringTrait, GI.LinearRing}, line2,
-)::Bool
If the curves overlap, meaning that at least one edge of each curve overlaps, return true. Else false.
sourceoverlaps(
+)::Bool
If the curves overlap, meaning that at least one edge of each curve overlaps, return true. Else false.
sourceoverlaps(
trait_a::GI.PolygonTrait, poly_a,
trait_b::GI.PolygonTrait, poly_b,
-)::Bool
If the two polygons intersect with one another, but are not equal, return true. Else false.
sourceoverlaps(
+)::Bool
If the two polygons intersect with one another, but are not equal, return true. Else false.
sourceoverlaps(
::GI.PolygonTrait, poly1,
::GI.MultiPolygonTrait, polys2,
-)::Bool
Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.
sourceoverlaps(
+)::Bool
Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.
sourceoverlaps(
::GI.MultiPolygonTrait, polys1,
::GI.PolygonTrait, poly2,
-)::Bool
Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.
sourceoverlaps(
+)::Bool
Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.
sourceoverlaps(
::GI.MultiPolygonTrait, polys1,
::GI.MultiPolygonTrait, polys2,
-)::Bool
Return true if at least one pair of polygons from multipolygons overlap. Else false.
sourceGeometryOps.touches
— Functiontouches(geom1, geom2)::Bool
Return true
if the first geometry touches the second geometry. In other words, the two interiors cannot interact, but one of the geometries must have a boundary point that interacts with either the other geometies interior or boundary.
Examples
import GeometryOps as GO, GeoInterface as GI
+)::Bool
Return true if at least one pair of polygons from multipolygons overlap. Else false.
sourceGeometryOps.touches
— Functiontouches(geom1, geom2)::Bool
Return true
if the first geometry touches the second geometry. In other words, the two interiors cannot interact, but one of the geometries must have a boundary point that interacts with either the other geometies interior or boundary.
Examples
import GeometryOps as GO, GeoInterface as GI
l1 = GI.Line([(0.0, 0.0), (1.0, 0.0)])
l2 = GI.Line([(1.0, 1.0), (1.0, -1.0)])
GO.touches(l1, l2)
# output
-true
sourceGeometryOps.within
— Functionwithin(geom1, geom2)::Bool
Return true
if the first geometry is completely within the second geometry. The interiors of both geometries must intersect and the interior and boundary of the primary geometry (geom1) must not intersect the exterior of the secondary geometry (geom2).
Furthermore, within
returns the exact opposite result of contains
.
Examples
import GeometryOps as GO, GeoInterface as GI
+true
sourceGeometryOps.within
— Functionwithin(geom1, geom2)::Bool
Return true
if the first geometry is completely within the second geometry. The interiors of both geometries must intersect and the interior and boundary of the primary geometry (geom1) must not intersect the exterior of the secondary geometry (geom2).
Furthermore, within
returns the exact opposite result of contains
.
Examples
import GeometryOps as GO, GeoInterface as GI
line = GI.LineString([(1, 1), (1, 2), (1, 3), (1, 4)])
point = (1, 2)
GO.within(point, line)
# output
-true
sourceOther general methods
GeometryOps.equals
— Functionequals(geom1, geom2)::Bool
Compare two Geometries return true if they are the same geometry.
Examples
import GeometryOps as GO, GeoInterface as GI
+true
sourceOther general methods
GeometryOps.equals
— Functionequals(geom1, geom2)::Bool
Compare two Geometries return true if they are the same geometry.
Examples
import GeometryOps as GO, GeoInterface as GI
poly1 = GI.Polygon([[(0,0), (0,5), (5,5), (5,0), (0,0)]])
poly2 = GI.Polygon([[(0,0), (0,5), (5,5), (5,0), (0,0)]])
GO.equals(poly1, poly2)
# output
-true
sourceequals(::T, geom_a, ::T, geom_b)::Bool
Two geometries of the same type, which don't have a equals function to dispatch off of should throw an error.
sourceequals(trait_a, geom_a, trait_b, geom_b)
Two geometries which are not of the same type cannot be equal so they always return false.
sourceequals(::GI.PointTrait, p1, ::GI.PointTrait, p2)::Bool
Two points are the same if they have the same x and y (and z if 3D) coordinates.
sourceequals(::GI.PointTrait, p1, ::GI.MultiPointTrait, mp2)::Bool
A point and a multipoint are equal if the multipoint is composed of a single point that is equivalent to the given point.
sourceequals(::GI.MultiPointTrait, mp1, ::GI.PointTrait, p2)::Bool
A point and a multipoint are equal if the multipoint is composed of a single point that is equivalent to the given point.
sourceequals(::GI.MultiPointTrait, mp1, ::GI.MultiPointTrait, mp2)::Bool
Two multipoints are equal if they share the same set of points.
sourceequals(
+true
sourceequals(::T, geom_a, ::T, geom_b)::Bool
Two geometries of the same type, which don't have a equals function to dispatch off of should throw an error.
sourceequals(trait_a, geom_a, trait_b, geom_b)
Two geometries which are not of the same type cannot be equal so they always return false.
sourceequals(::GI.PointTrait, p1, ::GI.PointTrait, p2)::Bool
Two points are the same if they have the same x and y (and z if 3D) coordinates.
sourceequals(::GI.PointTrait, p1, ::GI.MultiPointTrait, mp2)::Bool
A point and a multipoint are equal if the multipoint is composed of a single point that is equivalent to the given point.
sourceequals(::GI.MultiPointTrait, mp1, ::GI.PointTrait, p2)::Bool
A point and a multipoint are equal if the multipoint is composed of a single point that is equivalent to the given point.
sourceequals(::GI.MultiPointTrait, mp1, ::GI.MultiPointTrait, mp2)::Bool
Two multipoints are equal if they share the same set of points.
sourceequals(
::Union{GI.LineTrait, GI.LineStringTrait}, l1,
::Union{GI.LineTrait, GI.LineStringTrait}, l2,
-)::Bool
Two lines/linestrings are equal if they share the same set of points going along the curve. Note that lines/linestrings aren't closed by defintion.
sourceequals(
+)::Bool
Two lines/linestrings are equal if they share the same set of points going along the curve. Note that lines/linestrings aren't closed by defintion.
sourceequals(
::Union{GI.LineTrait, GI.LineStringTrait}, l1,
::GI.LinearRingTrait, l2,
-)::Bool
A line/linestring and a linear ring are equal if they share the same set of points going along the curve. Note that lines aren't closed by defintion, but rings are, so the line must have a repeated last point to be equal
sourceequals(
+)::Bool
A line/linestring and a linear ring are equal if they share the same set of points going along the curve. Note that lines aren't closed by defintion, but rings are, so the line must have a repeated last point to be equal
sourceequals(
::GI.LinearRingTrait, l1,
::Union{GI.LineTrait, GI.LineStringTrait}, l2,
-)::Bool
A linear ring and a line/linestring are equal if they share the same set of points going along the curve. Note that lines aren't closed by defintion, but rings are, so the line must have a repeated last point to be equal
sourceequals(
+)::Bool
A linear ring and a line/linestring are equal if they share the same set of points going along the curve. Note that lines aren't closed by defintion, but rings are, so the line must have a repeated last point to be equal
sourceequals(
::GI.LinearRingTrait, l1,
::GI.LinearRingTrait, l2,
-)::Bool
Two linear rings are equal if they share the same set of points going along the curve. Note that rings are closed by definition, so they can have, but don't need, a repeated last point to be equal.
sourceequals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
Two polygons are equal if they share the same exterior edge and holes.
sourceequals(::GI.PolygonTrait, geom_a, ::GI.MultiPolygonTrait, geom_b)::Bool
A polygon and a multipolygon are equal if the multipolygon is composed of a single polygon that is equivalent to the given polygon.
sourceequals(::GI.MultiPolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
A polygon and a multipolygon are equal if the multipolygon is composed of a single polygon that is equivalent to the given polygon.
sourceequals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
Two multipolygons are equal if they share the same set of polygons.
sourceGeometryOps.centroid
— Functioncentroid(geom, [T=Float64])::Tuple{T, T}
Returns the centroid of a given line segment, linear ring, polygon, or mutlipolygon.
sourceGeometryOps.distance
— Functiondistance(point, geom, ::Type{T} = Float64)::T
Calculates the ditance from the geometry g1
to the point
. The distance will always be positive or zero.
The method will differ based on the type of the geometry provided: - The distance from a point to a point is just the Euclidean distance between the points. - The distance from a point to a line is the minimum distance from the point to the closest point on the given line. - The distance from a point to a linestring is the minimum distance from the point to the closest segment of the linestring. - The distance from a point to a linear ring is the minimum distance from the point to the closest segment of the linear ring. - The distance from a point to a polygon is zero if the point is within the polygon and otherwise is the minimum distance from the point to an edge of the polygon. This includes edges created by holes. - The distance from a point to a multigeometry or a geometry collection is the minimum distance between the point and any of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.signed_distance
— Functionsigned_distance(point, geom, ::Type{T} = Float64)::T
Calculates the signed distance from the geometry geom
to the given point. Points within geom
have a negative signed distance, and points outside of geom
have a positive signed distance. - The signed distance from a point to a point, line, linestring, or linear ring is equal to the distance between the two. - The signed distance from a point to a polygon is negative if the point is within the polygon and is positive otherwise. The value of the distance is the minimum distance from the point to an edge of the polygon. This includes edges created by holes. - The signed distance from a point to a multigeometry or a geometry collection is the minimum signed distance between the point and any of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.area
— Functionarea(geom, ::Type{T} = Float64)::T
Returns the area of a geometry or collection of geometries. This is computed slightly differently for different geometries:
- The area of a point/multipoint is always zero.
+)::Bool
Two linear rings are equal if they share the same set of points going along the curve. Note that rings are closed by definition, so they can have, but don't need, a repeated last point to be equal.
sourceequals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
Two polygons are equal if they share the same exterior edge and holes.
sourceequals(::GI.PolygonTrait, geom_a, ::GI.MultiPolygonTrait, geom_b)::Bool
A polygon and a multipolygon are equal if the multipolygon is composed of a single polygon that is equivalent to the given polygon.
sourceequals(::GI.MultiPolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
A polygon and a multipolygon are equal if the multipolygon is composed of a single polygon that is equivalent to the given polygon.
sourceequals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
Two multipolygons are equal if they share the same set of polygons.
sourceGeometryOps.centroid
— Functioncentroid(geom, [T=Float64])::Tuple{T, T}
Returns the centroid of a given line segment, linear ring, polygon, or mutlipolygon.
sourceGeometryOps.distance
— Functiondistance(point, geom, ::Type{T} = Float64)::T
Calculates the ditance from the geometry g1
to the point
. The distance will always be positive or zero.
The method will differ based on the type of the geometry provided: - The distance from a point to a point is just the Euclidean distance between the points. - The distance from a point to a line is the minimum distance from the point to the closest point on the given line. - The distance from a point to a linestring is the minimum distance from the point to the closest segment of the linestring. - The distance from a point to a linear ring is the minimum distance from the point to the closest segment of the linear ring. - The distance from a point to a polygon is zero if the point is within the polygon and otherwise is the minimum distance from the point to an edge of the polygon. This includes edges created by holes. - The distance from a point to a multigeometry or a geometry collection is the minimum distance between the point and any of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.signed_distance
— Functionsigned_distance(point, geom, ::Type{T} = Float64)::T
Calculates the signed distance from the geometry geom
to the given point. Points within geom
have a negative signed distance, and points outside of geom
have a positive signed distance. - The signed distance from a point to a point, line, linestring, or linear ring is equal to the distance between the two. - The signed distance from a point to a polygon is negative if the point is within the polygon and is positive otherwise. The value of the distance is the minimum distance from the point to an edge of the polygon. This includes edges created by holes. - The signed distance from a point to a multigeometry or a geometry collection is the minimum signed distance between the point and any of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.area
— Functionarea(geom, ::Type{T} = Float64)::T
Returns the area of a geometry or collection of geometries. This is computed slightly differently for different geometries:
- The area of a point/multipoint is always zero.
- The area of a curve/multicurve is always zero.
- The area of a polygon is the absolute value of the signed area.
- The area multi-polygon is the sum of the areas of all of the sub-polygons.
- The area of a geometry collection, feature collection of array/iterable
- is the sum of the areas of all of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.signed_area
— Functionsigned_area(geom, ::Type{T} = Float64)::T
Returns the signed area of a single geometry, based on winding order. This is computed slighly differently for different geometries:
- The signed area of a point is always zero.
+ is the sum of the areas of all of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.signed_area
— Functionsigned_area(geom, ::Type{T} = Float64)::T
Returns the signed area of a single geometry, based on winding order. This is computed slighly differently for different geometries:
- The signed area of a point is always zero.
- The signed area of a curve is always zero.
- The signed area of a polygon is computed with the shoelace formula and is
positive if the polygon coordinates wind clockwise and negative if
counterclockwise.
- You cannot compute the signed area of a multipolygon as it doesn't have a
-meaning as each sub-polygon could have a different winding order.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.angles
— Functionangles(geom, ::Type{T} = Float64)
Returns the angles of a geometry or collection of geometries. This is computed differently for different geometries:
- The angles of a point is an empty vector.
+meaning as each sub-polygon could have a different winding order.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.angles
— Functionangles(geom, ::Type{T} = Float64)
Returns the angles of a geometry or collection of geometries. This is computed differently for different geometries:
- The angles of a point is an empty vector.
- The angles of a single line segment is an empty vector.
- The angles of a linestring or linearring is a vector of angles formed by the curve.
- The angles of a polygin is a vector of vectors of angles formed by each ring.
- The angles of a multi-geometry collection is a vector of the angles of each of the
- sub-geometries as defined above.
Result will be a Vector, or nested set of vectors, of type T where an optional argument with a default value of Float64.
sourceGeometryOps.embed_extent
— Functionembed_extent(obj)
Recursively wrap the object with a GeoInterface.jl geometry, calculating and adding an Extents.Extent
to all objects.
This can improve performance when extents need to be checked multiple times, such when needing to check if many points are in geometries, and using their extents as a quick filter for obviously exterior points.
Keywords
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.
sourceBarycentric coordinates
Missing docstring. Missing docstring for barycentric_coordinates
. Check Documenter's build log for details.
Missing docstring. Missing docstring for barycentric_coordinates!
. Check Documenter's build log for details.
Missing docstring. Missing docstring for barycentric_interpolate
. Check Documenter's build log for details.
Other methods
GeometryOps.AbstractBarycentricCoordinateMethod
— Typeabstract type AbstractBarycentricCoordinateMethod
Abstract supertype for barycentric coordinate methods. The subtypes may serve as dispatch types, or may cache some information about the target polygon.
API
The following methods must be implemented for all subtypes:
barycentric_coordinates!(λs::Vector{<: Real}, method::AbstractBarycentricCoordinateMethod, exterior::Vector{<: Point{2, T1}}, point::Point{2, T2})
barycentric_interpolate(method::AbstractBarycentricCoordinateMethod, exterior::Vector{<: Point{2, T1}}, values::Vector{V}, point::Point{2, T2})::V
barycentric_interpolate(method::AbstractBarycentricCoordinateMethod, exterior::Vector{<: Point{2, T1}}, interiors::Vector{<: Vector{<: Point{2, T1}}} values::Vector{V}, point::Point{2, T2})::V
The rest of the methods will be implemented in terms of these, and have efficient dispatches for broadcasting.
sourceGeometryOps.DouglasPeucker
— TypeDouglasPeucker <: SimplifyAlg
+ sub-geometries as defined above.
Result will be a Vector, or nested set of vectors, of type T where an optional argument with a default value of Float64.
sourceGeometryOps.embed_extent
— Functionembed_extent(obj)
Recursively wrap the object with a GeoInterface.jl geometry, calculating and adding an Extents.Extent
to all objects.
This can improve performance when extents need to be checked multiple times, such when needing to check if many points are in geometries, and using their extents as a quick filter for obviously exterior points.
Keywords
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.
sourceBarycentric coordinates
Missing docstring. Missing docstring for barycentric_coordinates
. Check Documenter's build log for details.
Missing docstring. Missing docstring for barycentric_coordinates!
. Check Documenter's build log for details.
Missing docstring. Missing docstring for barycentric_interpolate
. Check Documenter's build log for details.
Other methods
GeometryOps.AbstractBarycentricCoordinateMethod
— Typeabstract type AbstractBarycentricCoordinateMethod
Abstract supertype for barycentric coordinate methods. The subtypes may serve as dispatch types, or may cache some information about the target polygon.
API
The following methods must be implemented for all subtypes:
barycentric_coordinates!(λs::Vector{<: Real}, method::AbstractBarycentricCoordinateMethod, exterior::Vector{<: Point{2, T1}}, point::Point{2, T2})
barycentric_interpolate(method::AbstractBarycentricCoordinateMethod, exterior::Vector{<: Point{2, T1}}, values::Vector{V}, point::Point{2, T2})::V
barycentric_interpolate(method::AbstractBarycentricCoordinateMethod, exterior::Vector{<: Point{2, T1}}, interiors::Vector{<: Vector{<: Point{2, T1}}} values::Vector{V}, point::Point{2, T2})::V
The rest of the methods will be implemented in terms of these, and have efficient dispatches for broadcasting.
sourceGeometryOps.DouglasPeucker
— TypeDouglasPeucker <: SimplifyAlg
-DouglasPeucker(; number, ratio, tol)
Simplifies geometries by removing points below tol
distance from the line between its neighboring points.
Keywords
ratio
: the fraction of points that should remain after simplify
. Useful as it will generalise for large collections of objects.
number
: the number of points that should remain after simplify
. Less useful for large collections of mixed size objects.
tol
: the minimum distance a point will be from the line joining its neighboring points.
Note: user input tol
is squared to avoid uneccesary computation in algorithm.
sourceGeometryOps.LineOrientation
— TypeEnum LineOrientation
Enum for the orientation of a line with respect to a curve. A line can be line_cross
(crossing over the curve), line_hinge
(crossing the endpoint of the curve), line_over
(colinear with the curve), or line_out
(not interacting with the curve).
sourceGeometryOps.MeanValue
— TypeMeanValue() <: AbstractBarycentricCoordinateMethod
This method calculates barycentric coordinates using the mean value method.
References
sourceGeometryOps.PointOrientation
— TypeEnum PointOrientation
Enum for the orientation of a point with respect to a curve. A point can be point_in
the curve, point_on
the curve, or point_out
of the curve.
sourceGeometryOps.RadialDistance
— TypeRadialDistance <: SimplifyAlg
Simplifies geometries by removing points less than tol
distance from the line between its neighboring points.
Keywords
ratio
: the fraction of points that should remain after simplify
. Useful as it will generalise for large collections of objects.
number
: the number of points that should remain after simplify
. Less useful for large collections of mixed size objects.
tol
: the minimum distance between points.
Note: user input tol
is squared to avoid uneccesary computation in algorithm.
sourceGeometryOps.SimplifyAlg
— Typeabstract type SimplifyAlg
Abstract type for simplification algorithms.
API
For now, the algorithm must hold the number
, ratio
and tol
properties.
Simplification algorithm types can hook into the interface by implementing the _simplify(trait, alg, geom)
methods for whichever traits are necessary.
sourceGeometryOps.VisvalingamWhyatt
— TypeVisvalingamWhyatt <: SimplifyAlg
+DouglasPeucker(; number, ratio, tol)
Simplifies geometries by removing points below tol
distance from the line between its neighboring points.
Keywords
ratio
: the fraction of points that should remain after simplify
. Useful as it will generalise for large collections of objects.
number
: the number of points that should remain after simplify
. Less useful for large collections of mixed size objects.
tol
: the minimum distance a point will be from the line joining its neighboring points.
Note: user input tol
is squared to avoid uneccesary computation in algorithm.
sourceGeometryOps.LineOrientation
— TypeEnum LineOrientation
Enum for the orientation of a line with respect to a curve. A line can be line_cross
(crossing over the curve), line_hinge
(crossing the endpoint of the curve), line_over
(colinear with the curve), or line_out
(not interacting with the curve).
sourceGeometryOps.MeanValue
— TypeMeanValue() <: AbstractBarycentricCoordinateMethod
This method calculates barycentric coordinates using the mean value method.
References
sourceGeometryOps.PointOrientation
— TypeEnum PointOrientation
Enum for the orientation of a point with respect to a curve. A point can be point_in
the curve, point_on
the curve, or point_out
of the curve.
sourceGeometryOps.RadialDistance
— TypeRadialDistance <: SimplifyAlg
Simplifies geometries by removing points less than tol
distance from the line between its neighboring points.
Keywords
ratio
: the fraction of points that should remain after simplify
. Useful as it will generalise for large collections of objects.
number
: the number of points that should remain after simplify
. Less useful for large collections of mixed size objects.
tol
: the minimum distance between points.
Note: user input tol
is squared to avoid uneccesary computation in algorithm.
sourceGeometryOps.SimplifyAlg
— Typeabstract type SimplifyAlg
Abstract type for simplification algorithms.
API
For now, the algorithm must hold the number
, ratio
and tol
properties.
Simplification algorithm types can hook into the interface by implementing the _simplify(trait, alg, geom)
methods for whichever traits are necessary.
sourceGeometryOps.VisvalingamWhyatt
— TypeVisvalingamWhyatt <: SimplifyAlg
-VisvalingamWhyatt(; kw...)
Simplifies geometries by removing points below tol
distance from the line between its neighboring points.
Keywords
ratio
: the fraction of points that should remain after simplify
. Useful as it will generalise for large collections of objects.
number
: the number of points that should remain after simplify
. Less useful for large collections of mixed size objects.
tol
: the minimum area of a triangle made with a point and its neighboring points.
Note: user input tol
is doubled to avoid uneccesary computation in algorithm.
sourceGeometryOps._det
— Method_det(s1::Point2{T1}, s2::Point2{T2}) where {T1 <: Real, T2 <: Real}
Returns the determinant of the matrix formed by hcat
'ing two points s1
and s2
.
Specifically, this is:
s1[1] * s2[2] - s1[2] * s2[1]
sourceGeometryOps._equals_curves
— Method_equals_curves(c1, c2, closed_type1, closed_type2)::Bool
Two curves are equal if they share the same set of point, representing the same geometry. Both curves must must be composed of the same set of points, however, they do not have to wind in the same direction, or start on the same point to be equivalent. Inputs: c1 first geometry c2 second geometry closedtype1::Bool true if c1 is closed by definition (polygon, linear ring) closedtype2::Bool true if c2 is closed by definition (polygon, linear ring)
sourceGeometryOps.angles
— Methodangles(geom, ::Type{T} = Float64)
Returns the angles of a geometry or collection of geometries. This is computed differently for different geometries:
- The angles of a point is an empty vector.
+VisvalingamWhyatt(; kw...)
Simplifies geometries by removing points below tol
distance from the line between its neighboring points.
Keywords
ratio
: the fraction of points that should remain after simplify
. Useful as it will generalise for large collections of objects.
number
: the number of points that should remain after simplify
. Less useful for large collections of mixed size objects.
tol
: the minimum area of a triangle made with a point and its neighboring points.
Note: user input tol
is doubled to avoid uneccesary computation in algorithm.
sourceGeometryOps._det
— Method_det(s1::Point2{T1}, s2::Point2{T2}) where {T1 <: Real, T2 <: Real}
Returns the determinant of the matrix formed by hcat
'ing two points s1
and s2
.
Specifically, this is:
s1[1] * s2[2] - s1[2] * s2[1]
sourceGeometryOps._equals_curves
— Method_equals_curves(c1, c2, closed_type1, closed_type2)::Bool
Two curves are equal if they share the same set of point, representing the same geometry. Both curves must must be composed of the same set of points, however, they do not have to wind in the same direction, or start on the same point to be equivalent. Inputs: c1 first geometry c2 second geometry closedtype1::Bool true if c1 is closed by definition (polygon, linear ring) closedtype2::Bool true if c2 is closed by definition (polygon, linear ring)
sourceGeometryOps.angles
— Methodangles(geom, ::Type{T} = Float64)
Returns the angles of a geometry or collection of geometries. This is computed differently for different geometries:
- The angles of a point is an empty vector.
- The angles of a single line segment is an empty vector.
- The angles of a linestring or linearring is a vector of angles formed by the curve.
- The angles of a polygin is a vector of vectors of angles formed by each ring.
- The angles of a multi-geometry collection is a vector of the angles of each of the
- sub-geometries as defined above.
Result will be a Vector, or nested set of vectors, of type T where an optional argument with a default value of Float64.
sourceGeometryOps.apply
— Methodapply(f, target::Type{<:AbstractTrait}, obj; kw...)
Reconstruct a geometry, feature, feature collection, or nested vectors of either using the function f
on the target
trait.
f(target_geom) => x
where x
also has the target
trait, or a trait that can be substituted. For example, swapping PolgonTrait
to MultiPointTrait
will fail if the outer object has MultiPolygonTrait
, but should work if it has FeatureTrait
.
Objects "shallower" than the target trait are always completely rebuilt, like a Vector
of FeatureCollectionTrait
of FeatureTrait
when the target has PolygonTrait
and is held in the features. But "deeper" objects may remain unchanged - such as points and linear rings if the target is the same PolygonTrait
.
The result is a functionally similar geometry with values depending on f
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
Example
Flipped point the order in any feature or geometry, or iterables of either:
```juia import GeoInterface as GI import GeometryOps as GO geom = GI.Polygon([GI.LinearRing([(1, 2), (3, 4), (5, 6), (1, 2)]), GI.LinearRing([(3, 4), (5, 6), (6, 7), (3, 4)])])
flipped_geom = GO.apply(GI.PointTrait, geom) do p (GI.y(p), GI.x(p)) end
sourceGeometryOps.applyreduce
— Functionapplyreduce(f, op, target::Type{<:AbstractTrait}, obj; threaded)
Apply function f
to all objects with the target
trait, and reduce the result with an op
like +
.
The order and grouping of application of op
is not guaranteed.
If threaded==true
threads will be used over arrays and iterables, feature collections and nested geometries.
sourceGeometryOps.area
— Methodarea(geom, ::Type{T} = Float64)::T
Returns the area of a geometry or collection of geometries. This is computed slightly differently for different geometries:
- The area of a point/multipoint is always zero.
+ sub-geometries as defined above.
Result will be a Vector, or nested set of vectors, of type T where an optional argument with a default value of Float64.
sourceGeometryOps.apply
— Methodapply(f, target::Type{<:AbstractTrait}, obj; kw...)
Reconstruct a geometry, feature, feature collection, or nested vectors of either using the function f
on the target
trait.
f(target_geom) => x
where x
also has the target
trait, or a trait that can be substituted. For example, swapping PolgonTrait
to MultiPointTrait
will fail if the outer object has MultiPolygonTrait
, but should work if it has FeatureTrait
.
Objects "shallower" than the target trait are always completely rebuilt, like a Vector
of FeatureCollectionTrait
of FeatureTrait
when the target has PolygonTrait
and is held in the features. But "deeper" objects may remain unchanged - such as points and linear rings if the target is the same PolygonTrait
.
The result is a functionally similar geometry with values depending on f
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
Example
Flipped point the order in any feature or geometry, or iterables of either:
```julia import GeoInterface as GI import GeometryOps as GO geom = GI.Polygon([GI.LinearRing([(1, 2), (3, 4), (5, 6), (1, 2)]), GI.LinearRing([(3, 4), (5, 6), (6, 7), (3, 4)])])
flipped_geom = GO.apply(GI.PointTrait, geom) do p (GI.y(p), GI.x(p)) end
sourceGeometryOps.applyreduce
— Functionapplyreduce(f, op, target::Type{<:AbstractTrait}, obj; threaded)
Apply function f
to all objects with the target
trait, and reduce the result with an op
like +
.
The order and grouping of application of op
is not guaranteed.
If threaded==true
threads will be used over arrays and iterables, feature collections and nested geometries.
sourceGeometryOps.area
— Methodarea(geom, ::Type{T} = Float64)::T
Returns the area of a geometry or collection of geometries. This is computed slightly differently for different geometries:
- The area of a point/multipoint is always zero.
- The area of a curve/multicurve is always zero.
- The area of a polygon is the absolute value of the signed area.
- The area multi-polygon is the sum of the areas of all of the sub-polygons.
- The area of a geometry collection, feature collection of array/iterable
- is the sum of the areas of all of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.centroid
— Methodcentroid(geom, [T=Float64])::Tuple{T, T}
Returns the centroid of a given line segment, linear ring, polygon, or mutlipolygon.
sourceGeometryOps.centroid_and_area
— Methodcentroid_and_area(geom, [T=Float64])::(::Tuple{T, T}, ::Real)
Returns the centroid and area of a given geometry.
sourceGeometryOps.centroid_and_length
— Methodcentroid_and_length(geom, [T=Float64])::(::Tuple{T, T}, ::Real)
Returns the centroid and length of a given line/ring. Note this is only valid for line strings and linear rings.
sourceGeometryOps.contains
— Methodcontains(g1::AbstractGeometry, g2::AbstractGeometry)::Bool
Return true if the second geometry is completely contained by the first geometry. The interiors of both geometries must intersect and the interior and boundary of the secondary (g2) must not intersect the exterior of the first (g1).
contains
returns the exact opposite result of within
.
Examples
import GeometryOps as GO, GeoInterface as GI
+ is the sum of the areas of all of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.centroid
— Methodcentroid(geom, [T=Float64])::Tuple{T, T}
Returns the centroid of a given line segment, linear ring, polygon, or mutlipolygon.
sourceGeometryOps.centroid_and_area
— Methodcentroid_and_area(geom, [T=Float64])::(::Tuple{T, T}, ::Real)
Returns the centroid and area of a given geometry.
sourceGeometryOps.centroid_and_length
— Methodcentroid_and_length(geom, [T=Float64])::(::Tuple{T, T}, ::Real)
Returns the centroid and length of a given line/ring. Note this is only valid for line strings and linear rings.
sourceGeometryOps.contains
— Methodcontains(g1::AbstractGeometry, g2::AbstractGeometry)::Bool
Return true if the second geometry is completely contained by the first geometry. The interiors of both geometries must intersect and the interior and boundary of the secondary (g2) must not intersect the exterior of the first (g1).
contains
returns the exact opposite result of within
.
Examples
import GeometryOps as GO, GeoInterface as GI
line = GI.LineString([(1, 1), (1, 2), (1, 3), (1, 4)])
point = GI.Point((1, 2))
GO.contains(line, point)
# output
-true
sourceGeometryOps.coveredby
— Methodcoveredby(g1, g2)::Bool
Return true
if the first geometry is completely covered by the second geometry. The interior and boundary of the primary geometry (g1) must not intersect the exterior of the secondary geometry (g2).
Furthermore, coveredby
returns the exact opposite result of covers
. They are equivalent with the order of the arguments swapped.
Examples
import GeometryOps as GO, GeoInterface as GI
+true
sourceGeometryOps.coveredby
— Methodcoveredby(g1, g2)::Bool
Return true
if the first geometry is completely covered by the second geometry. The interior and boundary of the primary geometry (g1) must not intersect the exterior of the secondary geometry (g2).
Furthermore, coveredby
returns the exact opposite result of covers
. They are equivalent with the order of the arguments swapped.
Examples
import GeometryOps as GO, GeoInterface as GI
p1 = GI.Point(0.0, 0.0)
p2 = GI.Point(1.0, 1.0)
l1 = GI.Line([p1, p2])
GO.coveredby(p1, l1)
# output
-true
sourceGeometryOps.covers
— Methodcovers(g1::AbstractGeometry, g2::AbstractGeometry)::Bool
Return true if the first geometry is completely covers the second geometry, The exterior and boundary of the second geometry must not be outside of the interior and boundary of the first geometry. However, the interiors need not intersect.
covers
returns the exact opposite result of coveredby
.
Examples
import GeometryOps as GO, GeoInterface as GI
+true
sourceGeometryOps.covers
— Methodcovers(g1::AbstractGeometry, g2::AbstractGeometry)::Bool
Return true if the first geometry is completely covers the second geometry, The exterior and boundary of the second geometry must not be outside of the interior and boundary of the first geometry. However, the interiors need not intersect.
covers
returns the exact opposite result of coveredby
.
Examples
import GeometryOps as GO, GeoInterface as GI
l1 = GI.LineString([(1, 1), (1, 2), (1, 3), (1, 4)])
l2 = GI.LineString([(1, 1), (1, 2)])
GO.covers(l1, l2)
# output
-true
sourceGeometryOps.crosses
— Method crosses(geom1, geom2)::Bool
Return true
if the intersection results in a geometry whose dimension is one less than the maximum dimension of the two source geometries and the intersection set is interior to both source geometries.
TODO: broken
Examples
import GeoInterface as GI, GeometryOps as GO
-# TODO: Add working example
sourceGeometryOps.difference
— Methoddifference(geom_a, geom_b, [T::Type]; target::Type)
Return the difference between two geometries as a list of geometries. Return an empty list if none are found. The type of the list will be constrained as much as possible given the input geometries. Furthermore, the user can provide a taget
type as a keyword argument and a list of target geometries found in the difference will be returned. The user can also provide a float type that they would like the points of returned geometries to be.
Example
import GeoInterface as GI, GeometryOps as GO
+true
sourceGeometryOps.crosses
— Method crosses(geom1, geom2)::Bool
Return true
if the intersection results in a geometry whose dimension is one less than the maximum dimension of the two source geometries and the intersection set is interior to both source geometries.
TODO: broken
Examples
import GeoInterface as GI, GeometryOps as GO
+# TODO: Add working example
sourceGeometryOps.difference
— Methoddifference(geom_a, geom_b, [T::Type]; target::Type)
Return the difference between two geometries as a list of geometries. Return an empty list if none are found. The type of the list will be constrained as much as possible given the input geometries. Furthermore, the user can provide a taget
type as a keyword argument and a list of target geometries found in the difference will be returned. The user can also provide a float type that they would like the points of returned geometries to be.
Example
import GeoInterface as GI, GeometryOps as GO
poly1 = GI.Polygon([[[0.0, 0.0], [5.0, 5.0], [10.0, 0.0], [5.0, -5.0], [0.0, 0.0]]])
poly2 = GI.Polygon([[[3.0, 0.0], [8.0, 5.0], [13.0, 0.0], [8.0, -5.0], [3.0, 0.0]]])
@@ -162,33 +169,33 @@
# output
1-element Vector{Vector{Vector{Vector{Float64}}}}:
- [[[6.5, 3.5], [5.0, 5.0], [0.0, 0.0], [5.0, -5.0], [6.5, -3.5], [3.0, 0.0], [6.5, 3.5]]]
sourceGeometryOps.disjoint
— Methoddisjoint(geom1, geom2)::Bool
Return true
if the first geometry is disjoint from the second geometry.
Return true
if the first geometry is disjoint from the second geometry. The interiors and boundaries of both geometries must not intersect.
Examples
import GeometryOps as GO, GeoInterface as GI
+ [[[6.5, 3.5], [5.0, 5.0], [0.0, 0.0], [5.0, -5.0], [6.5, -3.5], [3.0, 0.0], [6.5, 3.5]]]
sourceGeometryOps.disjoint
— Methoddisjoint(geom1, geom2)::Bool
Return true
if the first geometry is disjoint from the second geometry.
Return true
if the first geometry is disjoint from the second geometry. The interiors and boundaries of both geometries must not intersect.
Examples
import GeometryOps as GO, GeoInterface as GI
line = GI.LineString([(1, 1), (1, 2), (1, 3), (1, 4)])
point = (2, 2)
GO.disjoint(point, line)
# output
-true
sourceGeometryOps.distance
— Methoddistance(point, geom, ::Type{T} = Float64)::T
Calculates the ditance from the geometry g1
to the point
. The distance will always be positive or zero.
The method will differ based on the type of the geometry provided: - The distance from a point to a point is just the Euclidean distance between the points. - The distance from a point to a line is the minimum distance from the point to the closest point on the given line. - The distance from a point to a linestring is the minimum distance from the point to the closest segment of the linestring. - The distance from a point to a linear ring is the minimum distance from the point to the closest segment of the linear ring. - The distance from a point to a polygon is zero if the point is within the polygon and otherwise is the minimum distance from the point to an edge of the polygon. This includes edges created by holes. - The distance from a point to a multigeometry or a geometry collection is the minimum distance between the point and any of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.embed_extent
— Methodembed_extent(obj)
Recursively wrap the object with a GeoInterface.jl geometry, calculating and adding an Extents.Extent
to all objects.
This can improve performance when extents need to be checked multiple times, such when needing to check if many points are in geometries, and using their extents as a quick filter for obviously exterior points.
Keywords
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.
sourceGeometryOps.equals
— Methodequals(trait_a, geom_a, trait_b, geom_b)
Two geometries which are not of the same type cannot be equal so they always return false.
sourceGeometryOps.equals
— Methodequals(geom1, geom2)::Bool
Compare two Geometries return true if they are the same geometry.
Examples
import GeometryOps as GO, GeoInterface as GI
+true
sourceGeometryOps.distance
— Methoddistance(point, geom, ::Type{T} = Float64)::T
Calculates the ditance from the geometry g1
to the point
. The distance will always be positive or zero.
The method will differ based on the type of the geometry provided: - The distance from a point to a point is just the Euclidean distance between the points. - The distance from a point to a line is the minimum distance from the point to the closest point on the given line. - The distance from a point to a linestring is the minimum distance from the point to the closest segment of the linestring. - The distance from a point to a linear ring is the minimum distance from the point to the closest segment of the linear ring. - The distance from a point to a polygon is zero if the point is within the polygon and otherwise is the minimum distance from the point to an edge of the polygon. This includes edges created by holes. - The distance from a point to a multigeometry or a geometry collection is the minimum distance between the point and any of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.embed_extent
— Methodembed_extent(obj)
Recursively wrap the object with a GeoInterface.jl geometry, calculating and adding an Extents.Extent
to all objects.
This can improve performance when extents need to be checked multiple times, such when needing to check if many points are in geometries, and using their extents as a quick filter for obviously exterior points.
Keywords
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.
sourceGeometryOps.equals
— Methodequals(trait_a, geom_a, trait_b, geom_b)
Two geometries which are not of the same type cannot be equal so they always return false.
sourceGeometryOps.equals
— Methodequals(geom1, geom2)::Bool
Compare two Geometries return true if they are the same geometry.
Examples
import GeometryOps as GO, GeoInterface as GI
poly1 = GI.Polygon([[(0,0), (0,5), (5,5), (5,0), (0,0)]])
poly2 = GI.Polygon([[(0,0), (0,5), (5,5), (5,0), (0,0)]])
GO.equals(poly1, poly2)
# output
-true
sourceGeometryOps.equals
— Methodequals(
+true
sourceGeometryOps.equals
— Methodequals(
::GI.LinearRingTrait, l1,
::GI.LinearRingTrait, l2,
-)::Bool
Two linear rings are equal if they share the same set of points going along the curve. Note that rings are closed by definition, so they can have, but don't need, a repeated last point to be equal.
sourceGeometryOps.equals
— Methodequals(
+)::Bool
Two linear rings are equal if they share the same set of points going along the curve. Note that rings are closed by definition, so they can have, but don't need, a repeated last point to be equal.
sourceGeometryOps.equals
— Methodequals(
::GI.LinearRingTrait, l1,
::Union{GI.LineTrait, GI.LineStringTrait}, l2,
-)::Bool
A linear ring and a line/linestring are equal if they share the same set of points going along the curve. Note that lines aren't closed by defintion, but rings are, so the line must have a repeated last point to be equal
sourceGeometryOps.equals
— Methodequals(::GI.MultiPointTrait, mp1, ::GI.MultiPointTrait, mp2)::Bool
Two multipoints are equal if they share the same set of points.
sourceGeometryOps.equals
— Methodequals(::GI.MultiPointTrait, mp1, ::GI.PointTrait, p2)::Bool
A point and a multipoint are equal if the multipoint is composed of a single point that is equivalent to the given point.
sourceGeometryOps.equals
— Methodequals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
Two multipolygons are equal if they share the same set of polygons.
sourceGeometryOps.equals
— Methodequals(::GI.MultiPolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
A polygon and a multipolygon are equal if the multipolygon is composed of a single polygon that is equivalent to the given polygon.
sourceGeometryOps.equals
— Methodequals(::GI.PointTrait, p1, ::GI.MultiPointTrait, mp2)::Bool
A point and a multipoint are equal if the multipoint is composed of a single point that is equivalent to the given point.
sourceGeometryOps.equals
— Methodequals(::GI.PointTrait, p1, ::GI.PointTrait, p2)::Bool
Two points are the same if they have the same x and y (and z if 3D) coordinates.
sourceGeometryOps.equals
— Methodequals(::GI.PolygonTrait, geom_a, ::GI.MultiPolygonTrait, geom_b)::Bool
A polygon and a multipolygon are equal if the multipolygon is composed of a single polygon that is equivalent to the given polygon.
sourceGeometryOps.equals
— Methodequals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
Two polygons are equal if they share the same exterior edge and holes.
sourceGeometryOps.equals
— Methodequals(
+)::Bool
A linear ring and a line/linestring are equal if they share the same set of points going along the curve. Note that lines aren't closed by defintion, but rings are, so the line must have a repeated last point to be equal
sourceGeometryOps.equals
— Methodequals(::GI.MultiPointTrait, mp1, ::GI.MultiPointTrait, mp2)::Bool
Two multipoints are equal if they share the same set of points.
sourceGeometryOps.equals
— Methodequals(::GI.MultiPointTrait, mp1, ::GI.PointTrait, p2)::Bool
A point and a multipoint are equal if the multipoint is composed of a single point that is equivalent to the given point.
sourceGeometryOps.equals
— Methodequals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
Two multipolygons are equal if they share the same set of polygons.
sourceGeometryOps.equals
— Methodequals(::GI.MultiPolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
A polygon and a multipolygon are equal if the multipolygon is composed of a single polygon that is equivalent to the given polygon.
sourceGeometryOps.equals
— Methodequals(::GI.PointTrait, p1, ::GI.MultiPointTrait, mp2)::Bool
A point and a multipoint are equal if the multipoint is composed of a single point that is equivalent to the given point.
sourceGeometryOps.equals
— Methodequals(::GI.PointTrait, p1, ::GI.PointTrait, p2)::Bool
Two points are the same if they have the same x and y (and z if 3D) coordinates.
sourceGeometryOps.equals
— Methodequals(::GI.PolygonTrait, geom_a, ::GI.MultiPolygonTrait, geom_b)::Bool
A polygon and a multipolygon are equal if the multipolygon is composed of a single polygon that is equivalent to the given polygon.
sourceGeometryOps.equals
— Methodequals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool
Two polygons are equal if they share the same exterior edge and holes.
sourceGeometryOps.equals
— Methodequals(
::Union{GI.LineTrait, GI.LineStringTrait}, l1,
::GI.LinearRingTrait, l2,
-)::Bool
A line/linestring and a linear ring are equal if they share the same set of points going along the curve. Note that lines aren't closed by defintion, but rings are, so the line must have a repeated last point to be equal
sourceGeometryOps.equals
— Methodequals(
+)::Bool
A line/linestring and a linear ring are equal if they share the same set of points going along the curve. Note that lines aren't closed by defintion, but rings are, so the line must have a repeated last point to be equal
sourceGeometryOps.equals
— Methodequals(
::Union{GI.LineTrait, GI.LineStringTrait}, l1,
::Union{GI.LineTrait, GI.LineStringTrait}, l2,
-)::Bool
Two lines/linestrings are equal if they share the same set of points going along the curve. Note that lines/linestrings aren't closed by defintion.
sourceGeometryOps.equals
— Methodequals(::T, geom_a, ::T, geom_b)::Bool
Two geometries of the same type, which don't have a equals function to dispatch off of should throw an error.
sourceGeometryOps.flatten
— Methodflatten(target::Type{<:GI.AbstractTrait}, obj)
-flatten(f, target::Type{<:GI.AbstractTrait}, obj)
Lazily flatten any AbstractArray
, iterator, FeatureCollectionTrait
, FeatureTrait
or AbstractGeometryTrait
object obj
, so that objects with the target
trait are returned by the iterator.
If f
is passed in it will be applied to the target geometries.
sourceGeometryOps.flip
— Methodflip(obj)
Swap all of the x and y coordinates in obj, otherwise keeping the original structure (but not necessarily the original type).
Keywords
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
sourceGeometryOps.get_contours
— Methodget_contours(A::AbstractMatrix)
Returns contours as vectors of CartesianIndex
.
sourceGeometryOps.intersection
— Methodintersection(geom_a, geom_b, [T::Type]; target::Type)
Return the intersection between two geometries as a list of geometries. Return an empty list if none are found. The type of the list will be constrained as much as possible given the input geometries. Furthermore, the user can provide a taget
type as a keyword argument and a list of target geometries found in the intersection will be returned. The user can also provide a float type that they would like the points of returned geometries to be.
Example
import GeoInterface as GI, GeometryOps as GO
+)::Bool
Two lines/linestrings are equal if they share the same set of points going along the curve. Note that lines/linestrings aren't closed by defintion.
sourceGeometryOps.equals
— Methodequals(::T, geom_a, ::T, geom_b)::Bool
Two geometries of the same type, which don't have a equals function to dispatch off of should throw an error.
sourceGeometryOps.flatten
— Methodflatten(target::Type{<:GI.AbstractTrait}, obj)
+flatten(f, target::Type{<:GI.AbstractTrait}, obj)
Lazily flatten any AbstractArray
, iterator, FeatureCollectionTrait
, FeatureTrait
or AbstractGeometryTrait
object obj
, so that objects with the target
trait are returned by the iterator.
If f
is passed in it will be applied to the target geometries.
sourceGeometryOps.flip
— Methodflip(obj)
Swap all of the x and y coordinates in obj, otherwise keeping the original structure (but not necessarily the original type).
Keywords
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
sourceGeometryOps.get_contours
— Methodget_contours(A::AbstractMatrix)
Returns contours as vectors of CartesianIndex
.
sourceGeometryOps.intersection
— Methodintersection(geom_a, geom_b, [T::Type]; target::Type)
Return the intersection between two geometries as a list of geometries. Return an empty list if none are found. The type of the list will be constrained as much as possible given the input geometries. Furthermore, the user can provide a taget
type as a keyword argument and a list of target geometries found in the intersection will be returned. The user can also provide a float type that they would like the points of returned geometries to be.
Example
import GeoInterface as GI, GeometryOps as GO
line1 = GI.Line([(124.584961,-12.768946), (126.738281,-17.224758)])
line2 = GI.Line([(123.354492,-15.961329), (127.22168,-14.008696)])
@@ -197,70 +204,70 @@
# output
1-element Vector{Vector{Float64}}:
- [125.58375366067547, -14.83572303404496]
sourceGeometryOps.intersection_points
— Methodintersection_points(
+ [125.58375366067547, -14.83572303404496]
sourceGeometryOps.intersection_points
— Methodintersection_points(
geom_a,
geom_b,
)::Union{
::Vector{::Tuple{::Real, ::Real}},
::Nothing,
-}
Return a list of intersection points between two geometries of type GI.Point. If no intersection point was possible given geometry extents, returns an empty list.
sourceGeometryOps.intersects
— Methodintersects(geom1, geom2)::Bool
Return true if the interiors or boundaries of the two geometries interact.
intersects
returns the exact opposite result of disjoint
.
Example
import GeoInterface as GI, GeometryOps as GO
+}
Return a list of intersection points between two geometries of type GI.Point. If no intersection point was possible given geometry extents, returns an empty list.
sourceGeometryOps.intersects
— Methodintersects(geom1, geom2)::Bool
Return true if the interiors or boundaries of the two geometries interact.
intersects
returns the exact opposite result of disjoint
.
Example
import GeoInterface as GI, GeometryOps as GO
line1 = GI.Line([(124.584961,-12.768946), (126.738281,-17.224758)])
line2 = GI.Line([(123.354492,-15.961329), (127.22168,-14.008696)])
GO.intersects(line1, line2)
# output
-true
sourceGeometryOps.isclockwise
— Methodisclockwise(line::Union{LineString, Vector{Position}})::Bool
Take a ring and return true or false whether or not the ring is clockwise or counter-clockwise.
Example
import GeoInterface as GI, GeometryOps as GO
+true
sourceGeometryOps.isclockwise
— Methodisclockwise(line::Union{LineString, Vector{Position}})::Bool
Take a ring and return true or false whether or not the ring is clockwise or counter-clockwise.
Example
import GeoInterface as GI, GeometryOps as GO
ring = GI.LinearRing([(0, 0), (1, 1), (1, 0), (0, 0)])
GO.isclockwise(ring)
# output
-true
sourceGeometryOps.isconcave
— Methodisconcave(poly::Polygon)::Bool
Take a polygon and return true or false as to whether it is concave or not.
Examples
import GeoInterface as GI, GeometryOps as GO
+true
sourceGeometryOps.isconcave
— Methodisconcave(poly::Polygon)::Bool
Take a polygon and return true or false as to whether it is concave or not.
Examples
import GeoInterface as GI, GeometryOps as GO
poly = GI.Polygon([[(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)]])
GO.isconcave(poly)
# output
-false
sourceGeometryOps.overlaps
— Methodoverlaps(geom1, geom2)::Bool
Compare two Geometries of the same dimension and return true if their intersection set results in a geometry different from both but of the same dimension. This means one geometry cannot be within or contain the other and they cannot be equal
Examples
import GeometryOps as GO, GeoInterface as GI
+false
sourceGeometryOps.overlaps
— Methodoverlaps(geom1, geom2)::Bool
Compare two Geometries of the same dimension and return true if their intersection set results in a geometry different from both but of the same dimension. This means one geometry cannot be within or contain the other and they cannot be equal
Examples
import GeometryOps as GO, GeoInterface as GI
poly1 = GI.Polygon([[(0,0), (0,5), (5,5), (5,0), (0,0)]])
poly2 = GI.Polygon([[(1,1), (1,6), (6,6), (6,1), (1,1)]])
GO.overlaps(poly1, poly2)
# output
-true
sourceGeometryOps.overlaps
— Methodoverlaps(::GI.AbstractTrait, geom1, ::GI.AbstractTrait, geom2)::Bool
For any non-specified pair, all have non-matching dimensions, return false.
sourceGeometryOps.overlaps
— Methodoverlaps(::GI.LineTrait, line1, ::GI.LineTrait, line)::Bool
If the lines overlap, meaning that they are colinear but each have one endpoint outside of the other line, return true. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
+true
sourceGeometryOps.overlaps
— Methodoverlaps(::GI.AbstractTrait, geom1, ::GI.AbstractTrait, geom2)::Bool
For any non-specified pair, all have non-matching dimensions, return false.
sourceGeometryOps.overlaps
— Methodoverlaps(::GI.LineTrait, line1, ::GI.LineTrait, line)::Bool
If the lines overlap, meaning that they are colinear but each have one endpoint outside of the other line, return true. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
::GI.MultiPointTrait, points1,
::GI.MultiPointTrait, points2,
-)::Bool
If the multipoints overlap, meaning some, but not all, of the points within the multipoints are shared, return true.
sourceGeometryOps.overlaps
— Methodoverlaps(
+)::Bool
If the multipoints overlap, meaning some, but not all, of the points within the multipoints are shared, return true.
sourceGeometryOps.overlaps
— Methodoverlaps(
::GI.MultiPolygonTrait, polys1,
::GI.MultiPolygonTrait, polys2,
-)::Bool
Return true if at least one pair of polygons from multipolygons overlap. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
+)::Bool
Return true if at least one pair of polygons from multipolygons overlap. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
::GI.MultiPolygonTrait, polys1,
::GI.PolygonTrait, poly2,
-)::Bool
Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
+)::Bool
Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
::GI.PolygonTrait, poly1,
::GI.MultiPolygonTrait, polys2,
-)::Bool
Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
+)::Bool
Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
trait_a::GI.PolygonTrait, poly_a,
trait_b::GI.PolygonTrait, poly_b,
-)::Bool
If the two polygons intersect with one another, but are not equal, return true. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
+)::Bool
If the two polygons intersect with one another, but are not equal, return true. Else false.
sourceGeometryOps.overlaps
— Methodoverlaps(
::Union{GI.LineStringTrait, GI.LinearRing}, line1,
::Union{GI.LineStringTrait, GI.LinearRing}, line2,
-)::Bool
If the curves overlap, meaning that at least one edge of each curve overlaps, return true. Else false.
sourceGeometryOps.polygon_to_line
— Methodpolygon_to_line(poly::Polygon)
Converts a Polygon to LineString or MultiLineString
Examples
import GeometryOps as GO, GeoInterface as GI
+)::Bool
If the curves overlap, meaning that at least one edge of each curve overlaps, return true. Else false.
sourceGeometryOps.polygon_to_line
— Methodpolygon_to_line(poly::Polygon)
Converts a Polygon to LineString or MultiLineString
Examples
import GeometryOps as GO, GeoInterface as GI
poly = GI.Polygon([[(-2.275543, 53.464547), (-2.275543, 53.489271), (-2.215118, 53.489271), (-2.215118, 53.464547), (-2.275543, 53.464547)]])
GO.polygon_to_line(poly)
# output
-GeoInterface.Wrappers.LineString{false, false, Vector{Tuple{Float64, Float64}}, Nothing, Nothing}([(-2.275543, 53.464547), (-2.275543, 53.489271), (-2.215118, 53.489271), (-2.215118, 53.464547), (-2.275543, 53.464547)], nothing, nothing)
sourceGeometryOps.polygonize
— Methodpolygonize(A; minpoints=10)
-polygonize(xs, ys, A; minpoints=10)
Convert matrix A
to polygons.
If xs
and ys
are passed in they are used as the pixel center points.
Keywords
minpoints
: ignore polygons with less than minpoints
points.
sourceGeometryOps.rebuild
— Methodrebuild(geom, child_geoms)
Rebuild a geometry from child geometries.
By default geometries will be rebuilt as a GeoInterface.Wrappers
geometry, but rebuild
can have methods added to it to dispatch on geometries from other packages and specify how to rebuild them.
(Maybe it should go into GeoInterface.jl)
sourceGeometryOps.reconstruct
— Methodreconstruct(geom, components)
Reconstruct geom
from an iterable of component objects that match its structure.
All objects in components
must have the same GeoInterface.trait
.
Ususally used in combination with flatten
.
sourceGeometryOps.reproject
— Methodreproject(geometry; source_crs, target_crs, transform, always_xy, time)
+GeoInterface.Wrappers.LineString{false, false, Vector{Tuple{Float64, Float64}}, Nothing, Nothing}([(-2.275543, 53.464547), (-2.275543, 53.489271), (-2.215118, 53.489271), (-2.215118, 53.464547), (-2.275543, 53.464547)], nothing, nothing)
sourceGeometryOps.polygonize
— Methodpolygonize(A; minpoints=10)
+polygonize(xs, ys, A; minpoints=10)
Convert matrix A
to polygons.
If xs
and ys
are passed in they are used as the pixel center points.
Keywords
minpoints
: ignore polygons with less than minpoints
points.
sourceGeometryOps.rebuild
— Methodrebuild(geom, child_geoms)
Rebuild a geometry from child geometries.
By default geometries will be rebuilt as a GeoInterface.Wrappers
geometry, but rebuild
can have methods added to it to dispatch on geometries from other packages and specify how to rebuild them.
(Maybe it should go into GeoInterface.jl)
sourceGeometryOps.reconstruct
— Methodreconstruct(geom, components)
Reconstruct geom
from an iterable of component objects that match its structure.
All objects in components
must have the same GeoInterface.trait
.
Ususally used in combination with flatten
.
sourceGeometryOps.reproject
— Methodreproject(geometry; source_crs, target_crs, transform, always_xy, time)
reproject(geometry, source_crs, target_crs; always_xy, time)
-reproject(geometry, transform; always_xy, time)
Reproject any GeoInterface.jl compatible geometry
from source_crs
to target_crs
.
The returned object will be constructed from GeoInterface.WrapperGeometry
geometries, wrapping views of a Vector{Proj.Point{D}}
, where D
is the dimension.
Arguments
geometry
: Any GeoInterface.jl compatible geometries.source_crs
: the source coordinate referece system, as a GeoFormatTypes.jl object or a string.target_crs
: the target coordinate referece system, as a GeoFormatTypes.jl object or a string.
If these a passed as keywords, transform
will take priority. Without it target_crs
is always needed, and source_crs
is needed if it is not retreivable from the geometry with GeoInterface.crs(geometry)
.
Keywords
always_xy
: force x, y coordinate order, true
by default. false
will expect and return points in the crs coordinate order.time
: the time for the coordinates. Inf
by default.threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
sourceGeometryOps.signed_area
— Methodsigned_area(geom, ::Type{T} = Float64)::T
Returns the signed area of a single geometry, based on winding order. This is computed slighly differently for different geometries:
- The signed area of a point is always zero.
+reproject(geometry, transform; always_xy, time)
Reproject any GeoInterface.jl compatible geometry
from source_crs
to target_crs
.
The returned object will be constructed from GeoInterface.WrapperGeometry
geometries, wrapping views of a Vector{Proj.Point{D}}
, where D
is the dimension.
Arguments
geometry
: Any GeoInterface.jl compatible geometries.source_crs
: the source coordinate referece system, as a GeoFormatTypes.jl object or a string.target_crs
: the target coordinate referece system, as a GeoFormatTypes.jl object or a string.
If these a passed as keywords, transform
will take priority. Without it target_crs
is always needed, and source_crs
is needed if it is not retreivable from the geometry with GeoInterface.crs(geometry)
.
Keywords
always_xy
: force x, y coordinate order, true
by default. false
will expect and return points in the crs coordinate order.time
: the time for the coordinates. Inf
by default.threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
sourceGeometryOps.signed_area
— Methodsigned_area(geom, ::Type{T} = Float64)::T
Returns the signed area of a single geometry, based on winding order. This is computed slighly differently for different geometries:
- The signed area of a point is always zero.
- The signed area of a curve is always zero.
- The signed area of a polygon is computed with the shoelace formula and is
positive if the polygon coordinates wind clockwise and negative if
counterclockwise.
- You cannot compute the signed area of a multipolygon as it doesn't have a
-meaning as each sub-polygon could have a different winding order.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.signed_distance
— Methodsigned_distance(point, geom, ::Type{T} = Float64)::T
Calculates the signed distance from the geometry geom
to the given point. Points within geom
have a negative signed distance, and points outside of geom
have a positive signed distance. - The signed distance from a point to a point, line, linestring, or linear ring is equal to the distance between the two. - The signed distance from a point to a polygon is negative if the point is within the polygon and is positive otherwise. The value of the distance is the minimum distance from the point to an edge of the polygon. This includes edges created by holes. - The signed distance from a point to a multigeometry or a geometry collection is the minimum signed distance between the point and any of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.simplify
— Methodsimplify(obj; kw...)
+meaning as each sub-polygon could have a different winding order.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.signed_distance
— Methodsigned_distance(point, geom, ::Type{T} = Float64)::T
Calculates the signed distance from the geometry geom
to the given point. Points within geom
have a negative signed distance, and points outside of geom
have a positive signed distance. - The signed distance from a point to a point, line, linestring, or linear ring is equal to the distance between the two. - The signed distance from a point to a polygon is negative if the point is within the polygon and is positive otherwise. The value of the distance is the minimum distance from the point to an edge of the polygon. This includes edges created by holes. - The signed distance from a point to a multigeometry or a geometry collection is the minimum signed distance between the point and any of the sub-geometries.
Result will be of type T, where T is an optional argument with a default value of Float64.
sourceGeometryOps.simplify
— Methodsimplify(obj; kw...)
simplify(::SimplifyAlg, obj; kw...)
Simplify a geometry, feature, feature collection, or nested vectors or a table of these.
RadialDistance
, DouglasPeucker
, or VisvalingamWhyatt
algorithms are available, listed in order of increasing quality but decreaseing performance.
PoinTrait
and MultiPointTrait
are returned unchanged.
The default behaviour is simplify(DouglasPeucker(; kw...), obj)
. Pass in other SimplifyAlg
to use other algorithms.
Keywords
prefilter_alg
: SimplifyAlg
algorithm used to pre-filter object before using primary filtering algorithm.threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
Keywords for DouglasPeucker are allowed when no algorithm is specified:
Keywords
ratio
: the fraction of points that should remain after simplify
. Useful as it will generalise for large collections of objects.
number
: the number of points that should remain after simplify
. Less useful for large collections of mixed size objects.
tol
: the minimum distance a point will be from the line joining its neighboring points.
Example
Simplify a polygon to have six points:
import GeoInterface as GI
import GeometryOps as GO
@@ -290,14 +297,14 @@
GI.npoint(simple)
# output
-6
sourceGeometryOps.t_value
— Methodt_value(sᵢ, sᵢ₊₁, rᵢ, rᵢ₊₁)
Returns the "T-value" as described in Hormann's presentation [HormannPresentation] on how to calculate the mean-value coordinate.
Here, sᵢ
is the vector from vertex vᵢ
to the point, and rᵢ
is the norm (length) of sᵢ
. s
must be Point
and r
must be real numbers.
\[tᵢ = \frac{\mathrm{det}\left(sᵢ, sᵢ₊₁\right)}{rᵢ * rᵢ₊₁ + sᵢ ⋅ sᵢ₊₁}\]
```
sourceGeometryOps.to_edges
— Methodto_edges()
Convert any geometry or collection of geometries into a flat vector of Tuple{Tuple{Float64,Float64},Tuple{Float64,Float64}}
edges.
sourceGeometryOps.touches
— Methodtouches(geom1, geom2)::Bool
Return true
if the first geometry touches the second geometry. In other words, the two interiors cannot interact, but one of the geometries must have a boundary point that interacts with either the other geometies interior or boundary.
Examples
import GeometryOps as GO, GeoInterface as GI
+6
sourceGeometryOps.t_value
— Methodt_value(sᵢ, sᵢ₊₁, rᵢ, rᵢ₊₁)
Returns the "T-value" as described in Hormann's presentation [HormannPresentation] on how to calculate the mean-value coordinate.
Here, sᵢ
is the vector from vertex vᵢ
to the point, and rᵢ
is the norm (length) of sᵢ
. s
must be Point
and r
must be real numbers.
\[tᵢ = \frac{\mathrm{det}\left(sᵢ, sᵢ₊₁\right)}{rᵢ * rᵢ₊₁ + sᵢ ⋅ sᵢ₊₁}\]
```
sourceGeometryOps.to_edges
— Methodto_edges()
Convert any geometry or collection of geometries into a flat vector of Tuple{Tuple{Float64,Float64},Tuple{Float64,Float64}}
edges.
sourceGeometryOps.touches
— Methodtouches(geom1, geom2)::Bool
Return true
if the first geometry touches the second geometry. In other words, the two interiors cannot interact, but one of the geometries must have a boundary point that interacts with either the other geometies interior or boundary.
Examples
import GeometryOps as GO, GeoInterface as GI
l1 = GI.Line([(0.0, 0.0), (1.0, 0.0)])
l2 = GI.Line([(1.0, 1.0), (1.0, -1.0)])
GO.touches(l1, l2)
# output
-true
sourceGeometryOps.transform
— Methodtransform(f, obj)
Apply a function f
to all the points in obj
.
Points will be passed to f
as an SVector
to allow using CoordinateTransformations.jl and Rotations.jl without hassle.
SVector
is also a valid GeoInterface.jl point, so will work in all GeoInterface.jl methods.
Example
julia> import GeoInterface as GI
+true
sourceGeometryOps.transform
— Methodtransform(f, obj)
Apply a function f
to all the points in obj
.
Points will be passed to f
as an SVector
to allow using CoordinateTransformations.jl and Rotations.jl without hassle.
SVector
is also a valid GeoInterface.jl point, so will work in all GeoInterface.jl methods.
Example
julia> import GeoInterface as GI
julia> import GeometryOps as GO
@@ -316,7 +323,7 @@
GeoInterface.Wrappers.Polygon{false, false, Vector{GeoInterface.Wrappers.LinearRing{false, false, Vector{StaticArraysCore.SVector{2, Int64}}, Nothing, Nothing}}, Nothing, Nothing}(GeoInterface.Wrappers.LinearR
ing{false, false, Vector{StaticArraysCore.SVector{2, Int64}}, Nothing, Nothing}[GeoInterface.Wrappers.LinearRing{false, false, Vector{StaticArraysCore.SVector{2, Int64}}, Nothing, Nothing}(StaticArraysCore.SVe
ctor{2, Int64}[[2, 1], [4, 3], [6, 5], [2, 1]], nothing, nothing), GeoInterface.Wrappers.LinearRing{false, false, Vector{StaticArraysCore.SVector{2, Int64}}, Nothing, Nothing}(StaticArraysCore.SVector{2, Int64
-}[[4, 3], [6, 5], [7, 6], [4, 3]], nothing, nothing)], nothing, nothing)
sourceGeometryOps.tuples
— Methodtuples(obj)
Convert all points in obj
to Tuple
s, wherever the are nested.
Returns a similar object or collection of objects using GeoInterface.jl geometries wrapping Tuple
points.
Keywords
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
sourceGeometryOps.union
— Methodunion(geom_a, geom_b, [::Type{T}]; target::Type)
Return the union between two geometries as a list of geometries. Return an empty list if none are found. The type of the list will be constrained as much as possible given the input geometries. Furthermore, the user can provide a taget
type as a keyword argument and a list of target geometries found in the difference will be returned. The user can also provide a float type 'T' that they would like the points of returned geometries to be.
Calculates the union between two polygons.
Example
import GeoInterface as GI, GeometryOps as GO
+}[[4, 3], [6, 5], [7, 6], [4, 3]], nothing, nothing)], nothing, nothing)
sourceGeometryOps.tuples
— Methodtuples(obj)
Convert all points in obj
to Tuple
s, wherever the are nested.
Returns a similar object or collection of objects using GeoInterface.jl geometries wrapping Tuple
points.
Keywords
threaded
: true
or false
. Whether to use multithreading. Defaults to false
.crs
: The CRS to attach to geometries. Defaults to nothing
.calc_extent
: true
or false
. Whether to calculate the extent. Defaults to false
.
sourceGeometryOps.union
— Methodunion(geom_a, geom_b, [::Type{T}]; target::Type)
Return the union between two geometries as a list of geometries. Return an empty list if none are found. The type of the list will be constrained as much as possible given the input geometries. Furthermore, the user can provide a taget
type as a keyword argument and a list of target geometries found in the difference will be returned. The user can also provide a float type 'T' that they would like the points of returned geometries to be.
Calculates the union between two polygons.
Example
import GeoInterface as GI, GeometryOps as GO
p1 = GI.Polygon([[(0.0, 0.0), (5.0, 5.0), (10.0, 0.0), (5.0, -5.0), (0.0, 0.0)]])
p2 = GI.Polygon([[(3.0, 0.0), (8.0, 5.0), (13.0, 0.0), (8.0, -5.0), (3.0, 0.0)]])
@@ -325,12 +332,12 @@
# output
1-element Vector{Vector{Vector{Vector{Float64}}}}:
- [[[6.5, 3.5], [5.0, 5.0], [0.0, 0.0], [5.0, -5.0], [6.5, -3.5], [8.0, -5.0], [13.0, 0.0], [8.0, 5.0], [6.5, 3.5]]]
sourceGeometryOps.unwrap
— Functionunwrap(target::Type{<:AbstractTrait}, obj)
-unwrap(f, target::Type{<:AbstractTrait}, obj)
Unwrap the object to vectors, down to the target trait.
If f
is passed in it will be applied to the target geometries as they are found.
sourceGeometryOps.weighted_mean
— Methodweighted_mean(weight::Real, x1, x2)
Returns the weighted mean of x1
and x2
, where weight
is the weight of x1
.
Specifically, calculates x1 * weight + x2 * (1 - weight)
.
Note The idea for this method is that you can override this for custom types, like Color types, in extension modules.
sourceGeometryOps.within
— Methodwithin(geom1, geom2)::Bool
Return true
if the first geometry is completely within the second geometry. The interiors of both geometries must intersect and the interior and boundary of the primary geometry (geom1) must not intersect the exterior of the secondary geometry (geom2).
Furthermore, within
returns the exact opposite result of contains
.
Examples
import GeometryOps as GO, GeoInterface as GI
+ [[[6.5, 3.5], [5.0, 5.0], [0.0, 0.0], [5.0, -5.0], [6.5, -3.5], [8.0, -5.0], [13.0, 0.0], [8.0, 5.0], [6.5, 3.5]]]
sourceGeometryOps.unwrap
— Functionunwrap(target::Type{<:AbstractTrait}, obj)
+unwrap(f, target::Type{<:AbstractTrait}, obj)
Unwrap the object to vectors, down to the target trait.
If f
is passed in it will be applied to the target geometries as they are found.
sourceGeometryOps.weighted_mean
— Methodweighted_mean(weight::Real, x1, x2)
Returns the weighted mean of x1
and x2
, where weight
is the weight of x1
.
Specifically, calculates x1 * weight + x2 * (1 - weight)
.
Note The idea for this method is that you can override this for custom types, like Color types, in extension modules.
sourceGeometryOps.within
— Methodwithin(geom1, geom2)::Bool
Return true
if the first geometry is completely within the second geometry. The interiors of both geometries must intersect and the interior and boundary of the primary geometry (geom1) must not intersect the exterior of the secondary geometry (geom2).
Furthermore, within
returns the exact opposite result of contains
.
Examples
import GeometryOps as GO, GeoInterface as GI
line = GI.LineString([(1, 1), (1, 2), (1, 3), (1, 4)])
point = (1, 2)
GO.within(point, line)
# output
-true
source- HormannPresentationK. Hormann and N. Sukumar. Generalized Barycentric Coordinates in Computer Graphics and Computational Mechanics. Taylor & Fancis, CRC Press, 2017.
Settings
This document was generated with Documenter.jl version 1.2.1 on Saturday 3 February 2024. Using Julia version 1.10.0.
+true
- HormannPresentationK. Hormann and N. Sukumar. Generalized Barycentric Coordinates in Computer Graphics and Computational Mechanics. Taylor & Fancis, CRC Press, 2017.