diff --git a/previews/PR29/index.html b/previews/PR29/index.html index 598c9395c..a1fb005b2 100644 --- a/previews/PR29/index.html +++ b/previews/PR29/index.html @@ -1,170 +1,170 @@ -Home · GeometryOps.jl

GeometryOps

Documentation for GeometryOps.

GeometryOps.AbstractBarycentricCoordinateMethodType
abstract 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.

source
GeometryOps.DouglasPeuckerType
DouglasPeucker <: SimplifyAlg
+Home · GeometryOps.jl

GeometryOps

Documentation for GeometryOps.

GeometryOps.AbstractBarycentricCoordinateMethodType
abstract 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.

source
GeometryOps.DouglasPeuckerType
DouglasPeucker <: 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.

source
GeometryOps.MeanValueType
MeanValue() <: AbstractBarycentricCoordinateMethod

This method calculates barycentric coordinates using the mean value method.

References

source
GeometryOps.RadialDistanceType
RadialDistance <: 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.

source
GeometryOps.SimplifyAlgType
abstract 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.

source
GeometryOps.VisvalingamWhyattType
VisvalingamWhyatt <: 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.

source
GeometryOps.MeanValueType
MeanValue() <: AbstractBarycentricCoordinateMethod

This method calculates barycentric coordinates using the mean value method.

References

source
GeometryOps.RadialDistanceType
RadialDistance <: 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.

source
GeometryOps.SimplifyAlgType
abstract 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.

source
GeometryOps.VisvalingamWhyattType
VisvalingamWhyatt <: 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.

source
GeometryOps._detMethod
_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]
source
GeometryOps._equals_curvesMethod
_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)

source
GeometryOps._intersection_pointMethod
_intersection_point(
+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.

source
GeometryOps._detMethod
_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]
source
GeometryOps._equals_curvesMethod
_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)

source
GeometryOps._intersection_pointMethod
_intersection_point(
     (a1, a2)::Tuple,
     (b1, b2)::Tuple,
-)

Calculates the intersection point between two lines if it exists, and as if the line extended to infinity, and the fractional component of each line from the initial end point to the intersection point. Inputs: (a1, a2)::Tuple{Tuple{::Real, ::Real}, Tuple{::Real, ::Real}} first line (b1, b2)::Tuple{Tuple{::Real, ::Real}, Tuple{::Real, ::Real}} second line Outputs: (x, y)::Tuple{::Real, ::Real} intersection point (t, u)::Tuple{::Real, ::Real} fractional length of lines to intersection Both are ::Nothing if point doesn't exist!

Calculation derivation can be found here: https://stackoverflow.com/questions/563198/

source
GeometryOps._line_intersectsMethod
_line_intersects(
+)

Calculates the intersection point between two lines if it exists, and as if the line extended to infinity, and the fractional component of each line from the initial end point to the intersection point. Inputs: (a1, a2)::Tuple{Tuple{::Real, ::Real}, Tuple{::Real, ::Real}} first line (b1, b2)::Tuple{Tuple{::Real, ::Real}, Tuple{::Real, ::Real}} second line Outputs: (x, y)::Tuple{::Real, ::Real} intersection point (t, u)::Tuple{::Real, ::Real} fractional length of lines to intersection Both are ::Nothing if point doesn't exist!

Calculation derivation can be found here: https://stackoverflow.com/questions/563198/

source
GeometryOps._line_intersectsMethod
_line_intersects(
     edges_a::Vector{Edge},
     edges_b::Vector{Edge}
-)::Bool

Returns true if there is at least one intersection between edges within the two lists of edges.

source
GeometryOps._overlapsMethod
_overlaps(
+)::Bool

Returns true if there is at least one intersection between edges within the two lists of edges.

source
GeometryOps._overlapsMethod
_overlaps(
     (a1, a2)::Edge,
     (b1, b2)::Edge
-)::Bool

If the edges overlap, meaning that they are colinear but each have one endpoint outside of the other edge, return true. Else false.

source
GeometryOps.applyMethod
apply(f, target::Type{<:AbstractTrait}, obj; crs)

Reconstruct a geometry or feature using the function f on the target trait.

f(target_geom) => x where x also has the target trait, or an equivalent.

The result is an functionally similar geometry with values depending on f

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

source
GeometryOps.centroidMethod
centroid(trait, geom)::Tuple{T, T}

Returns the centroid of a polygon or multipolygon, which is calculated by weighting edges by their area component by convention.

source
GeometryOps.centroidMethod
centroid(geom)::Tuple{T, T}

Returns the centroid of a given line segment, linear ring, polygon, or mutlipolygon.

source
GeometryOps.centroidMethod
centroid(
+)::Bool

If the edges overlap, meaning that they are colinear but each have one endpoint outside of the other edge, return true. Else false.

source
GeometryOps.applyMethod
apply(f, target::Type{<:AbstractTrait}, obj; crs)

Reconstruct a geometry or feature using the function f on the target trait.

f(target_geom) => x where x also has the target trait, or an equivalent.

The result is an functionally similar geometry with values depending on f

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

source
GeometryOps.centroidMethod
centroid(trait, geom)::Tuple{T, T}

Returns the centroid of a polygon or multipolygon, which is calculated by weighting edges by their area component by convention.

source
GeometryOps.centroidMethod
centroid(geom)::Tuple{T, T}

Returns the centroid of a given line segment, linear ring, polygon, or mutlipolygon.

source
GeometryOps.centroidMethod
centroid(
     trait::Union{GI.LineStringTrait, GI.LinearRingTrait},
     geom,
-)::Tuple{T, T}

Returns the centroid of a line string or linear ring, which is calculated by weighting line segments by their length by convention.

source
GeometryOps.centroid_and_areaMethod
centroid_and_area(
+)::Tuple{T, T}

Returns the centroid of a line string or linear ring, which is calculated by weighting line segments by their length by convention.

source
GeometryOps.centroid_and_areaMethod
centroid_and_area(
     ::Union{GI.LineStringTrait, GI.LinearRingTrait}, 
     geom,
-)::(::Tuple{T, T}, ::Real)

Returns the centroid and area of a given geom.

source
GeometryOps.centroid_and_areaMethod
centroid_and_area(
     ::Union{GI.LineStringTrait, GI.LinearRingTrait},
     geom,
-)::(::Tuple{T, T}, ::Real)

Returns the centroid and area of a given a line string or a linear ring. Note that this is only valid if the line segment or linear ring is closed.

source
GeometryOps.centroid_and_lengthMethod
centroid_and_length(geom)::(::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.

source
GeometryOps.centroid_and_lengthMethod
centroid_and_length(geom)::(::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.

source
GeometryOps.containsMethod
contains(ft1::AbstractGeometry, ft2::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 (geometry b) must not intersect the exterior of the primary (geometry a). contains returns the exact opposite result of within.

Examples

import GeometryOps as GO, GeoInterface as GI
+)::(::Tuple{T, T}, ::Real)

Returns the centroid and area of a given a line string or a linear ring. Note that this is only valid if the line segment or linear ring is closed.

source
GeometryOps.centroid_and_lengthMethod
centroid_and_length(geom)::(::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.

source
GeometryOps.centroid_and_lengthMethod
centroid_and_length(geom)::(::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.

source
GeometryOps.containsMethod
contains(ft1::AbstractGeometry, ft2::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 (geometry b) must not intersect the exterior of the primary (geometry a). 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 = (1, 2)
 
 GO.contains(line, point)
 # output
-true
source
GeometryOps.crossesMethod
 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
+true
source
GeometryOps.crossesMethod
 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
 
 line1 = GI.LineString([(1, 1), (1, 2), (1, 3), (1, 4)])
 line2 = GI.LineString([(-2, 2), (4, 2)])
 
 GO.crosses(line1, line2)
 # output
-true
source
GeometryOps.disjointMethod
disjoint(geom1, geom2)::Bool

Return true if the intersection of the two geometries is an empty set.

Examples

import GeometryOps as GO, GeoInterface as GI
+true
source
GeometryOps.disjointMethod
disjoint(geom1, geom2)::Bool

Return true if the intersection of the two geometries is an empty set.

Examples

import GeometryOps as GO, GeoInterface as GI
 
 poly = GI.Polygon([[(-1, 2), (3, 2), (3, 3), (-1, 3), (-1, 2)]])
 point = (1, 1)
 GO.disjoint(poly, point)
 
 # output
-true
source
GeometryOps.embed_extentMethod
embed_extent(obj)

Recursively wrap the object with a GeoInterface.Wrappers geometry, calculating and adding an Extents.Extent to all objects.

This can improve performance when extents need to be checked multiple times.

source
GeometryOps.equalsMethod
equals(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.

source
GeometryOps.equalsMethod
equals(geom1, geom2)::Bool

Compare two Geometries return true if they are the same geometry.

Examples

import GeometryOps as GO, GeoInterface as GI
+true
source
GeometryOps.embed_extentMethod
embed_extent(obj)

Recursively wrap the object with a GeoInterface.Wrappers geometry, calculating and adding an Extents.Extent to all objects.

This can improve performance when extents need to be checked multiple times.

source
GeometryOps.equalsMethod
equals(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.

source
GeometryOps.equalsMethod
equals(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
source
GeometryOps.equalsMethod
equals(
     ::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.

source
GeometryOps.equalsMethod
equals(
+)::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.

source
GeometryOps.equalsMethod
equals(
     ::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

source
GeometryOps.equalsMethod
equals(::GI.MultiPointTrait, mp1, ::GI.MultiPointTrait, mp2)::Bool

Two multipoints are equal if they share the same set of points.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool

Two multipolygons are equal if they share the same set of polygons.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool

Two polygons are equal if they share the same exterior edge and holes.

source
GeometryOps.equalsMethod
equals(
+)::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

source
GeometryOps.equalsMethod
equals(::GI.MultiPointTrait, mp1, ::GI.MultiPointTrait, mp2)::Bool

Two multipoints are equal if they share the same set of points.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool

Two multipolygons are equal if they share the same set of polygons.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.equalsMethod
equals(::GI.PolygonTrait, geom_a, ::GI.PolygonTrait, geom_b)::Bool

Two polygons are equal if they share the same exterior edge and holes.

source
GeometryOps.equalsMethod
equals(
     ::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

source
GeometryOps.equalsMethod
equals(
+)::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

source
GeometryOps.equalsMethod
equals(
     ::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.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.flattenMethod
flatten(target::Type{<:GI.AbstractTrait}, geom)

Lazily flatten any geometry, feature or iterator of geometries or features so that objects with the specified trait are returned by the iterator.

source
GeometryOps.flipMethod
flip(obj)

Swap all of the x and y coordinates in obj, otherwise keeping the original structure (but not necessarily the original type).

source
GeometryOps.intersectionMethod
intersection(geom_a, geom_b)::Union{Tuple{::Real, ::Real}, ::Nothing}

Return an intersection point between two geometries. Return nothing if none are found. Else, the return type depends on the input. It will be a union between: a point, a line, a linear ring, a polygon, or a multipolygon

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.

source
GeometryOps.equalsMethod
equals(::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.

source
GeometryOps.flattenMethod
flatten(target::Type{<:GI.AbstractTrait}, geom)

Lazily flatten any geometry, feature or iterator of geometries or features so that objects with the specified trait are returned by the iterator.

source
GeometryOps.flipMethod
flip(obj)

Swap all of the x and y coordinates in obj, otherwise keeping the original structure (but not necessarily the original type).

source
GeometryOps.intersectionMethod
intersection(geom_a, geom_b)::Union{Tuple{::Real, ::Real}, ::Nothing}

Return an intersection point between two geometries. Return nothing if none are found. Else, the return type depends on the input. It will be a union between: a point, a line, a linear ring, a polygon, or a multipolygon

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.intersection(line1, line2)
 
 # output
-(125.58375366067547, -14.83572303404496)
source
GeometryOps.intersectionMethod
intersection(
     ::GI.AbstractTrait, geom_a,
     ::GI.AbstractTrait, geom_b,
 )::Union{
     ::Vector{Vector{Tuple{::Real, ::Real}}}, # is this a good return type?
     ::Nothing
-}

Calculates the intersection between two line segments. Return nothing if there isn't one.

source
GeometryOps.intersectionMethod
intersection(
     ::GI.LineTrait, line_a,
     ::GI.LineTrait, line_b,
 )::Union{
     ::Tuple{::Real, ::Real},
     ::Nothing
-}

Calculates the intersection between two line segments. Return nothing if there isn't one.

source
GeometryOps.intersectionMethod
intersection(
     ::GI.PolygonTrait, poly_a,
     ::GI.PolygonTrait, poly_b,
 )::Union{
     ::Vector{Vector{Tuple{::Real, ::Real}}}, # is this a good return type?
     ::Nothing
-}

Calculates the intersection between two line segments. Return nothing if there isn't one.

source
GeometryOps.intersection_pointsMethod
intersection_points(
     geom_a,
     geom_b,
 )::Union{
     ::Vector{::Tuple{::Real, ::Real}},
     ::Nothing,
-}

Return a list of intersection points between two geometries. If no intersection point was possible given geometry extents, return nothing. If none are found, return an empty list.

source
GeometryOps.intersection_pointsMethod
intersection_points(
+}

Return a list of intersection points between two geometries. If no intersection point was possible given geometry extents, return nothing. If none are found, return an empty list.

source
GeometryOps.intersection_pointsMethod
intersection_points(
     ::GI.AbstractTrait, geom_a,
     ::GI.AbstractTrait, geom_b,
 )::Union{
     ::Vector{::Tuple{::Real, ::Real}},
     ::Nothing,
-}

Calculates the list of intersection points between two geometries, inlcuding line segments, line strings, linear rings, polygons, and multipolygons. If no intersection points were possible given geometry extents, return nothing. If none are found, return an empty list.

source
GeometryOps.intersectsMethod
intersects(geom1, geom2)::Bool

Check if two geometries intersect, returning true if so and false otherwise.

Example

import GeoInterface as GI, GeometryOps as GO
+}

Calculates the list of intersection points between two geometries, inlcuding line segments, line strings, linear rings, polygons, and multipolygons. If no intersection points were possible given geometry extents, return nothing. If none are found, return an empty list.

source
GeometryOps.intersectsMethod
intersects(geom1, geom2)::Bool

Check if two geometries intersect, returning true if so and false otherwise.

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
source
GeometryOps.intersectsMethod
intersects(::GI.AbstractTrait, a, ::GI.AbstractTrait, b)::Bool

Returns true if two geometries intersect with one another and false otherwise. For all geometries but lines, convert the geometry to a list of edges and cross compare the edges for intersections.

source
GeometryOps.intersectsMethod
intersects(::GI.LineTrait, a, ::GI.LineTrait, b)::Bool

Returns true if two line segments intersect and false otherwise.

source
GeometryOps.isclockwiseMethod
isclockwise(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
source
GeometryOps.intersectsMethod
intersects(::GI.AbstractTrait, a, ::GI.AbstractTrait, b)::Bool

Returns true if two geometries intersect with one another and false otherwise. For all geometries but lines, convert the geometry to a list of edges and cross compare the edges for intersections.

source
GeometryOps.intersectsMethod
intersects(::GI.LineTrait, a, ::GI.LineTrait, b)::Bool

Returns true if two line segments intersect and false otherwise.

source
GeometryOps.isclockwiseMethod
isclockwise(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
source
GeometryOps.isconcaveMethod
isconcave(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
source
GeometryOps.isconcaveMethod
isconcave(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
source
GeometryOps.overlapsMethod
overlaps(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
source
GeometryOps.overlapsMethod
overlaps(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
source
GeometryOps.overlapsMethod
overlaps(::GI.AbstractTrait, geom1, ::GI.AbstractTrait, geom2)::Bool

For any non-specified pair, all have non-matching dimensions, return false.

source
GeometryOps.overlapsMethod
overlaps(::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.

source
GeometryOps.overlapsMethod
overlaps(::GI.AbstractTrait, geom1, ::GI.AbstractTrait, geom2)::Bool

For any non-specified pair, all have non-matching dimensions, return false.

source
GeometryOps.overlapsMethod
overlaps(::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.

source
GeometryOps.overlapsMethod
overlaps(
     ::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.

source
GeometryOps.overlapsMethod
overlaps(
+)::Bool

If the multipoints overlap, meaning some, but not all, of the points within the multipoints are shared, return true.

source
GeometryOps.overlapsMethod
overlaps(
     ::GI.MultiPolygonTrait, polys1,
     ::GI.MultiPolygonTrait, polys2,
-)::Bool

Return true if at least one pair of polygons from multipolygons overlap. Else false.

source
GeometryOps.overlapsMethod
overlaps(
+)::Bool

Return true if at least one pair of polygons from multipolygons overlap. Else false.

source
GeometryOps.overlapsMethod
overlaps(
     ::GI.MultiPolygonTrait, polys1,
     ::GI.PolygonTrait, poly2,
-)::Bool

Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.

source
GeometryOps.overlapsMethod
overlaps(
+)::Bool

Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.

source
GeometryOps.overlapsMethod
overlaps(
     ::GI.PolygonTrait, poly1,
     ::GI.MultiPolygonTrait, polys2,
-)::Bool

Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.

source
GeometryOps.overlapsMethod
overlaps(
+)::Bool

Return true if polygon overlaps with at least one of the polygons within the multipolygon. Else false.

source
GeometryOps.overlapsMethod
overlaps(
     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.

source
GeometryOps.overlapsMethod
overlaps(
+)::Bool

If the two polygons intersect with one another, but are not equal, return true. Else false.

source
GeometryOps.overlapsMethod
overlaps(
     ::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.

source
GeometryOps.point_in_polygonMethod
point_in_polygon(point::Point, polygon::Union{Polygon, MultiPolygon}, ignore_boundary::Bool=false)::Bool

Take a Point and a Polygon and determine if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes.

Examples

import GeoInterface as GI, GeometryOps as GO
+)::Bool

If the curves overlap, meaning that at least one edge of each curve overlaps, return true. Else false.

source
GeometryOps.point_in_polygonMethod
point_in_polygon(point::Point, polygon::Union{Polygon, MultiPolygon}, ignore_boundary::Bool=false)::Bool

Take a Point and a Polygon and determine if the point resides inside the polygon. The polygon can be convex or concave. The function accounts for holes.

Examples

import GeoInterface as GI, GeometryOps as GO
 
 point = (-77.0, 44.0)
 poly = GI.Polygon([[(-81, 41), (-81, 47), (-72, 47), (-72, 41), (-81, 41)]])
 GO.point_in_polygon(point, poly)
 
 # output
-true
source
GeometryOps.point_on_lineMethod
point_on_line(point::Point, line::LineString; ignore_end_vertices::Bool=false)::Bool

Return true if a point is on a line. Accept a optional parameter to ignore the start and end vertices of the linestring.

Examples

import GeoInterface as GI, GeometryOps as GO
+true
source
GeometryOps.point_on_lineMethod
point_on_line(point::Point, line::LineString; ignore_end_vertices::Bool=false)::Bool

Return true if a point is on a line. Accept a optional parameter to ignore the start and end vertices of the linestring.

Examples

import GeoInterface as GI, GeometryOps as GO
 
 point = (1, 1)
 line = GI.LineString([(0, 0), (3, 3), (4, 4)])
 GO.point_on_line(point, line)
 
 # output
-true
source
GeometryOps.polygon_to_lineMethod
polygon_to_line(poly::Polygon)

Converts a Polygon to LineString or MultiLineString

Examples

import GeometryOps as GO, GeoInterface as GI
+true
source
GeometryOps.polygon_to_lineMethod
polygon_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)
source
GeometryOps.polygonizeMethod
polygonize(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.
source
GeometryOps.rebuildMethod
rebuild(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)

source
GeometryOps.reconstructMethod
reconstruct(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.

source
GeometryOps.reprojectMethod
reproject(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)
source
GeometryOps.polygonizeMethod
polygonize(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.
source
GeometryOps.rebuildMethod
rebuild(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)

source
GeometryOps.reconstructMethod
reconstruct(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.

source
GeometryOps.reprojectMethod
reproject(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.

source
GeometryOps.signed_distanceMethod
signed_distance(geom, x::Real, y::Real)::Float64

Calculates the signed distance from the geometry geom to the point defined by (x, y). Points within geom have a negative distance, and points outside of geom have a positive distance.

If geom is a MultiPolygon, then this function returns the maximum distance to any of the polygons in geom.

source
GeometryOps.simplifyMethod
simplify(obj; kw...)
+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.

source
GeometryOps.signed_distanceMethod
signed_distance(geom, x::Real, y::Real)::Float64

Calculates the signed distance from the geometry geom to the point defined by (x, y). Points within geom have a negative distance, and points outside of geom have a positive distance.

If geom is a MultiPolygon, then this function returns the maximum distance to any of the polygons in geom.

source
GeometryOps.simplifyMethod
simplify(obj; kw...)
 simplify(::SimplifyAlg, obj)

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.

Example

Simplify a polygon to have six points:

import GeoInterface as GI
 import GeometryOps as GO
 
@@ -194,5 +194,5 @@
 GI.npoint(simple)
 
 # output
-6
source
GeometryOps.t_valueMethod
t_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ᵢ₊₁}\]

```

source
GeometryOps.to_edgesMethod
to_edges()

Convert any geometry or collection of geometries into a flat vector of Tuple{Tuple{Float64,Float64},Tuple{Float64,Float64}} edges.

source
GeometryOps.unwrapFunction
unwrap(target::Type{<:AbstractTrait}, obj)
-unwrap(f, target::Type{<:AbstractTrait}, obj)

Unwrap the geometry to vectors, down to the target trait.

If f is passed in it will be applied to the target geometries as they are found.

source
GeometryOps.weighted_meanMethod
weighted_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.

source
  • HormannPresentationK. Hormann and N. Sukumar. Generalized Barycentric Coordinates in Computer Graphics and Computational Mechanics. Taylor & Fancis, CRC Press, 2017.
+6
source
GeometryOps.t_valueMethod
t_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ᵢ₊₁}\]

```

source
GeometryOps.to_edgesMethod
to_edges()

Convert any geometry or collection of geometries into a flat vector of Tuple{Tuple{Float64,Float64},Tuple{Float64,Float64}} edges.

source
GeometryOps.unwrapFunction
unwrap(target::Type{<:AbstractTrait}, obj)
+unwrap(f, target::Type{<:AbstractTrait}, obj)

Unwrap the geometry to vectors, down to the target trait.

If f is passed in it will be applied to the target geometries as they are found.

source
GeometryOps.weighted_meanMethod
weighted_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.

source
  • HormannPresentationK. Hormann and N. Sukumar. Generalized Barycentric Coordinates in Computer Graphics and Computational Mechanics. Taylor & Fancis, CRC Press, 2017.
diff --git a/previews/PR29/search/index.html b/previews/PR29/search/index.html index 9bf98f00b..5a2b15013 100644 --- a/previews/PR29/search/index.html +++ b/previews/PR29/search/index.html @@ -1,2 +1,2 @@ -Search · GeometryOps.jl

Loading search...

    +Search · GeometryOps.jl

    Loading search...

      diff --git a/previews/PR29/source/GeometryOps/index.html b/previews/PR29/source/GeometryOps/index.html index f31dca332..41196c23f 100644 --- a/previews/PR29/source/GeometryOps/index.html +++ b/previews/PR29/source/GeometryOps/index.html @@ -38,4 +38,4 @@ include("transformations/reproject.jl") include("transformations/tuples.jl") -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/barycentric/index.html b/previews/PR29/source/methods/barycentric/index.html index ed970b2ce..12907c6a1 100644 --- a/previews/PR29/source/methods/barycentric/index.html +++ b/previews/PR29/source/methods/barycentric/index.html @@ -376,4 +376,4 @@ end struct Wachspress <: AbstractBarycentricCoordinateMethod -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/bools/index.html b/previews/PR29/source/methods/bools/index.html index e54534166..4edb00f64 100644 --- a/previews/PR29/source/methods/bools/index.html +++ b/previews/PR29/source/methods/bools/index.html @@ -276,4 +276,4 @@ function polygon_in_polygon(poly1, poly2)

      edges1, edges2 = toedges(poly1), toedges(poly2) extent1, extent2 = toextent(edges1), toextent(edges2) Check the extents intersect

          Extents.intersects(GI.extent(poly1), GI.extent(poly2)) || return false

      Check all points in poly1 are in poly2

          for point in GI.getpoint(poly1)
               point_in_polygon(point, poly2) || return false
           end

      Check the line of poly1 does not intersect the line of poly2

          #intersects(poly1, poly2) && return false

      poly1 must be in poly2

          return true
      - end

      This page was generated using Literate.jl.

      + end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/centroid/index.html b/previews/PR29/source/methods/centroid/index.html index 2be2bcc3d..316864d84 100644 --- a/previews/PR29/source/methods/centroid/index.html +++ b/previews/PR29/source/methods/centroid/index.html @@ -139,4 +139,4 @@ xcentroid /= area ycentroid /= area return (xcentroid, ycentroid), area -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/contains/index.html b/previews/PR29/source/methods/contains/index.html index c57960cb5..fe834b8c1 100644 --- a/previews/PR29/source/methods/contains/index.html +++ b/previews/PR29/source/methods/contains/index.html @@ -19,4 +19,4 @@ GO.contains(line, point)

      output

      true
       ```
       """
      -contains(g1, g2)::Bool = within(g2, g1)

      This page was generated using Literate.jl.

      +contains(g1, g2)::Bool = within(g2, g1)

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/crosses/index.html b/previews/PR29/source/methods/crosses/index.html index db21b0b57..ddf0783dc 100644 --- a/previews/PR29/source/methods/crosses/index.html +++ b/previews/PR29/source/methods/crosses/index.html @@ -86,4 +86,4 @@ int_point && ext_point && return true end return false -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/disjoint/index.html b/previews/PR29/source/methods/disjoint/index.html index a6028c8a0..591a64465 100644 --- a/previews/PR29/source/methods/disjoint/index.html +++ b/previews/PR29/source/methods/disjoint/index.html @@ -31,4 +31,4 @@ point_in_polygon(point, poly1) && return false end return !intersects(poly1, poly2) -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/equals/index.html b/previews/PR29/source/methods/equals/index.html index 2c973a2ad..d7cb11e41 100644 --- a/previews/PR29/source/methods/equals/index.html +++ b/previews/PR29/source/methods/equals/index.html @@ -262,4 +262,4 @@ has_match || return false end return true -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/intersects/index.html b/previews/PR29/source/methods/intersects/index.html index aaf9cf838..9748b075d 100644 --- a/previews/PR29/source/methods/intersects/index.html +++ b/previews/PR29/source/methods/intersects/index.html @@ -277,4 +277,4 @@ return (x, y), (t, u) end return nothing, nothing -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/overlaps/index.html b/previews/PR29/source/methods/overlaps/index.html index ae4f6eb84..5fd847afa 100644 --- a/previews/PR29/source/methods/overlaps/index.html +++ b/previews/PR29/source/methods/overlaps/index.html @@ -184,4 +184,4 @@ )

      meets in more than one point

          on_top = ExactPredicates.meet(a1, a2, b1, b2) == 0

      one end point is outside of other segment

          a_fully_within = point_on_seg(a1, b1, b2) && point_on_seg(a2, b1, b2)
           b_fully_within = point_on_seg(b1, a1, a2) && point_on_seg(b2, a1, a2)
           return on_top && (!a_fully_within && !b_fully_within)
      -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/polygonize/index.html b/previews/PR29/source/methods/polygonize/index.html index 002914773..25b0e6a73 100644 --- a/previews/PR29/source/methods/polygonize/index.html +++ b/previews/PR29/source/methods/polygonize/index.html @@ -174,4 +174,4 @@ end return contour_list -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/signed_area/index.html b/previews/PR29/source/methods/signed_area/index.html index ac0f5ba33..51dcbc19e 100644 --- a/previews/PR29/source/methods/signed_area/index.html +++ b/previews/PR29/source/methods/signed_area/index.html @@ -27,4 +27,4 @@ return area * sign(s_area) end -signed_area(::GI.MultiPolygonTrait, geom) = sum((signed_area(poly) for poly in GI.getpolygon(geom)))

      This should theoretically work for anything, but I haven't actually tested yet!

      Below is the original GeometryBasics implementation:

      ```julia

      function signed_area(a::Point{2, T}, b::Point{2, T}, c::Point{2, T}) where T return ((b[1] - a[1]) * (c[2] - a[2]) - (c[1] - a[1]) * (b[2] - a[2])) / 2 end

      function signed_area(points::AbstractVector{<: Point{2, T}}) where {T} area = sum((points[i][1] * points[i+1][2] - points[i][2] * points[i+1][1] for i in 1:(length(points)-1))) / 2.0 end

      function signedarea(ls::GeometryBasics.LineString) # coords = GeometryBasics.decompose(Point2f, ls) return sum((p1[1] * p2[2] - p1[2] * p2[1] for (p1, p2) in ls)) / 2.0#signedarea(coords) end

      function signedarea(poly::GeometryBasics.Polygon{2}) sarea = signedarea(poly.exterior) area = abs(sarea) for hole in poly.interiors area -= abs(signedarea(hole)) end return area * sign(sarea) end

      WARNING: this may not do what you expect, since it's

      sensitive to winding order. Use GeoInterface.area instead.

      signedarea(mp::MultiPolygon) = sum(signedarea.(mp.polygons)) ```


      This page was generated using Literate.jl.

      +signed_area(::GI.MultiPolygonTrait, geom) = sum((signed_area(poly) for poly in GI.getpolygon(geom)))

      This should theoretically work for anything, but I haven't actually tested yet!

      Below is the original GeometryBasics implementation:

      ```julia

      function signed_area(a::Point{2, T}, b::Point{2, T}, c::Point{2, T}) where T return ((b[1] - a[1]) * (c[2] - a[2]) - (c[1] - a[1]) * (b[2] - a[2])) / 2 end

      function signed_area(points::AbstractVector{<: Point{2, T}}) where {T} area = sum((points[i][1] * points[i+1][2] - points[i][2] * points[i+1][1] for i in 1:(length(points)-1))) / 2.0 end

      function signedarea(ls::GeometryBasics.LineString) # coords = GeometryBasics.decompose(Point2f, ls) return sum((p1[1] * p2[2] - p1[2] * p2[1] for (p1, p2) in ls)) / 2.0#signedarea(coords) end

      function signedarea(poly::GeometryBasics.Polygon{2}) sarea = signedarea(poly.exterior) area = abs(sarea) for hole in poly.interiors area -= abs(signedarea(hole)) end return area * sign(sarea) end

      WARNING: this may not do what you expect, since it's

      sensitive to winding order. Use GeoInterface.area instead.

      signedarea(mp::MultiPolygon) = sum(signedarea.(mp.polygons)) ```


      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/signed_distance/index.html b/previews/PR29/source/methods/signed_distance/index.html index ce050edc6..b4f8d1e81 100644 --- a/previews/PR29/source/methods/signed_distance/index.html +++ b/previews/PR29/source/methods/signed_distance/index.html @@ -93,4 +93,4 @@ If `geom` is a MultiPolygon, then this function returns the maximum distance to any of the polygons in `geom`. """ -signed_distance(geom, x, y) = signed_distance(GeoInterface.geomtrait(geom), geom, x, y)

      This page was generated using Literate.jl.

      +signed_distance(geom, x, y) = signed_distance(GeoInterface.geomtrait(geom), geom, x, y)

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/methods/within/index.html b/previews/PR29/source/methods/within/index.html index a50fd3f81..8edfb6697 100644 --- a/previews/PR29/source/methods/within/index.html +++ b/previews/PR29/source/methods/within/index.html @@ -24,4 +24,4 @@ within(::GI.PointTrait, g1, ::GI.LinearRingTrait, g2)::Bool = point_on_line(g1, g2; ignore_end_vertices=true) within(::GI.PointTrait, g1, ::GI.PolygonTrait, g2)::Bool = point_in_polygon(g1, g2; ignore_boundary=true)

      Lines in geometries

      within(::GI.LineStringTrait, g1, ::GI.LineStringTrait, g2)::Bool = line_on_line(g1, g2)
       within(::GI.LineStringTrait, g1, ::GI.LinearRingTrait, g2)::Bool = line_on_line(g1, g2)
      -within(::GI.LineStringTrait, g1, ::GI.PolygonTrait, g2)::Bool = line_in_polygon(g1, g2)

      Polygons within geometries

      within(::GI.PolygonTrait, g1, ::GI.PolygonTrait, g2)::Bool = polygon_in_polygon(g1, g2)

      Everything not specified TODO: Add multipolygons

      within(::GI.AbstractTrait, g1, ::GI.AbstractCurveTrait, g2)::Bool = false

      This page was generated using Literate.jl.

      +within(::GI.LineStringTrait, g1, ::GI.PolygonTrait, g2)::Bool = line_in_polygon(g1, g2)

      Polygons within geometries

      within(::GI.PolygonTrait, g1, ::GI.PolygonTrait, g2)::Bool = polygon_in_polygon(g1, g2)

      Everything not specified TODO: Add multipolygons

      within(::GI.AbstractTrait, g1, ::GI.AbstractCurveTrait, g2)::Bool = false

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/primitives/index.html b/previews/PR29/source/primitives/index.html index 4b12c3b0e..f6c9776ed 100644 --- a/previews/PR29/source/primitives/index.html +++ b/previews/PR29/source/primitives/index.html @@ -197,4 +197,4 @@ else return map(f, taskrange) end -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/transformations/extent/index.html b/previews/PR29/source/transformations/extent/index.html index 9d33cd038..0bb67c2ca 100644 --- a/previews/PR29/source/transformations/extent/index.html +++ b/previews/PR29/source/transformations/extent/index.html @@ -22,4 +22,4 @@ extent = GI.extent(geom) return wrapper_type(geom; extent, crs=GI.crs(geom)) end -extent_applicator(::GI.PointTrait, point) = point

      This page was generated using Literate.jl.

      +extent_applicator(::GI.PointTrait, point) = point

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/transformations/flip/index.html b/previews/PR29/source/transformations/flip/index.html index 609593be0..74e6f2537 100644 --- a/previews/PR29/source/transformations/flip/index.html +++ b/previews/PR29/source/transformations/flip/index.html @@ -16,4 +16,4 @@ (GI.y(p), GI.x(p)) end end -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/transformations/reproject/index.html b/previews/PR29/source/transformations/reproject/index.html index 4d87a1a38..37cce11ae 100644 --- a/previews/PR29/source/transformations/reproject/index.html +++ b/previews/PR29/source/transformations/reproject/index.html @@ -58,4 +58,4 @@ transform(GI.x(p), GI.y(p)) end end -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/transformations/simplify/index.html b/previews/PR29/source/transformations/simplify/index.html index 2082aaf39..d51e727fb 100644 --- a/previews/PR29/source/transformations/simplify/index.html +++ b/previews/PR29/source/transformations/simplify/index.html @@ -378,4 +378,4 @@ return result end -_remove!(s, i) = s[i:end-1] .= s[i+1:end]

      This page was generated using Literate.jl.

      +_remove!(s, i) = s[i:end-1] .= s[i+1:end]

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/transformations/tuples/index.html b/previews/PR29/source/transformations/tuples/index.html index b33656511..92e3b841c 100644 --- a/previews/PR29/source/transformations/tuples/index.html +++ b/previews/PR29/source/transformations/tuples/index.html @@ -14,4 +14,4 @@ (Float64(GI.x(p)), Float64(GI.y(p))) end end -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.

      diff --git a/previews/PR29/source/utils/index.html b/previews/PR29/source/utils/index.html index 76ea8e999..ccee760b7 100644 --- a/previews/PR29/source/utils/index.html +++ b/previews/PR29/source/utils/index.html @@ -116,4 +116,4 @@ n += 1 end return n -end

      This page was generated using Literate.jl.

      +end

      This page was generated using Literate.jl.