Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor documentation improvements #181

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions benchmarks/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import GeometryOps as GO,
GeoInterface as GI,
GeometryBasics as GB,
LibGEOS as LG
import GeoJSON
import GeoJSON, NaturalEarth
# In order to benchmark, we'll actually use the new [Chairmarks.jl](https://github.com/lilithhafner/Chairmarks.jl),
# since it's significantly faster than BenchmarkTools. To keep benchmarks organized, though, we'll still use BenchmarkTools'
# `BenchmarkGroup` structure.
Expand Down Expand Up @@ -184,7 +184,7 @@ usa_difference_suite = usa_poly_suite["difference"] = BenchmarkGroup(["title:USA
usa_intersection_suite = usa_poly_suite["intersection"] = BenchmarkGroup(["title:USA intersection", "subtitle:Tested on CONUS"])
usa_union_suite = usa_poly_suite["union"] = BenchmarkGroup(["title:USA union", "subtitle:Tested on CONUS"])

fc = GeoJSON.read(read(download("https://rawcdn.githack.com/nvkelso/natural-earth-vector/ca96624a56bd078437bca8184e78163e5039ad19/geojson/ne_10m_admin_0_countries.geojson")))
fc = NaturalEarth.naturalearth("admin_0_countries", 10)
usa_multipoly = fc.geometry[findfirst(==("United States of America"), fc.NAME)] |> x -> GI.convert(LG, x) |> LG.makeValid |> GO.tuples

usa_poly = GI.getgeom(usa_multipoly, findmax(GO.area.(GI.getgeom(usa_multipoly)))[2]) # isolate the poly with the most area
Expand All @@ -194,7 +194,7 @@ f, a, p = plot(usa_poly; label = "Original", axis = (; aspect = DataAspect()));
axislegend(a)
f

# Now, we get to benchmarking:
# Now, we get to benchmarking:


usa_o_lg, usa_o_go = lg_and_go(usa_poly)
Expand Down
17 changes: 17 additions & 0 deletions docs/src/tutorials/geodesic_paths.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Geodesic paths

Geodesic paths are paths computed on an ellipsoid, as opposed to a plane.

```@example geodesic
import GeometryOps as GO, GeoInterface as GI
using CairoMakie, GeoMakie


IAH = (-95.358421, 29.749907)
AMS = (4.897070, 52.377956)


fig, ga, _cp = lines(GeoMakie.coastlines(); axis = (; type = GeoAxis))
lines!(ga, GO.segmentize(GO.GeodesicSegments(; max_distance = 100_000), GI.LineString([IAH, AMS])); color = Makie.wong_colors()[2])
fig
```
14 changes: 7 additions & 7 deletions src/methods/geom_relations/within.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ implementation based on the geometry trait.

Each of these calls a method in the geom_geom_processors file. The methods in
this file determine if the given geometries meet a set of criteria. For the
`within` function and arguments g1 and g2, this criteria is as follows:
- points of g1 are allowed to be in the interior of g2 (either through
`within` function and arguments `g1` and `g2`, this criteria is as follows:
- points of `g1` are allowed to be in the interior of `g2` (either through
overlap or crossing for lines)
- points of g1 are allowed to be on the boundary of g2
- points of g1 are not allowed to be in the exterior of g2
- at least one point of g1 is required to be in the interior of g2
- no points of g1 are required to be on the boundary of g2
- no points of g1 are required to be in the exterior of g2
- points of `g1` are allowed to be on the boundary of `g2`
- points of `g1` are not allowed to be in the exterior of `g2`
- at least one point of `g1` is required to be in the interior of `g2`
- no points of `g1` are required to be on the boundary of `g2`
- no points of `g1` are required to be in the exterior of `g2`

The code for the specific implementations is in the geom_geom_processors file.
=#
Expand Down
3 changes: 2 additions & 1 deletion src/transformations/simplify.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ We benchmark these methods against LibGEOS's `simplify` implementation, which us
using BenchmarkTools, Chairmarks, GeoJSON, CairoMakie
import GeometryOps as GO, LibGEOS as LG, GeoInterface as GI
using CoordinateTransformations
using NaturalEarth
import Main: plot_trials # hide
lg_and_go(geometry) = (GI.convert(LG, geometry), GO.tuples(geometry))
# Load in the Natural Earth admin GeoJSON, then extract the USA's geometry
fc = GeoJSON.read(read(download("https://rawcdn.githack.com/nvkelso/natural-earth-vector/ca96624a56bd078437bca8184e78163e5039ad19/geojson/ne_10m_admin_0_countries.geojson")))
fc = NaturalEarth.naturalearth("admin_0_countries", 10)
usa_multipoly = fc.geometry[findfirst(==("United States of America"), fc.NAME)] |> x -> GI.convert(LG, x) |> LG.makeValid |> GO.tuples
include(joinpath(dirname(dirname(pathof(GO))), "test", "data", "polygon_generation.jl"))

Expand Down
Loading