Skip to content

Commit

Permalink
Merge branch 'main' into paper
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 authored Jun 8, 2024
2 parents 4aec5d3 + ec6090e commit 0886e54
Show file tree
Hide file tree
Showing 31 changed files with 1,091 additions and 461 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ jobs:
- uses: julia-actions/setup-julia@v1
with:
version: '1'
- name: Add custom versions of packages
run: julia --project=docs -e 'using Pkg; Pkg.add(PackageSpec(; url = "https://github.com/JuliaGeo/NaturalEarth.jl", rev = "as/scratchspaces"))'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
Expand Down
9 changes: 7 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name = "GeometryOps"
uuid = "3251bfac-6a57-4b6d-aa61-ac1fef2975ab"
authors = ["Anshul Singhvi <[email protected]> and contributors"]
version = "0.1.4"
version = "0.1.6"

[deps]
CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
ExactPredicates = "429591f6-91af-11e9-00e2-59fbe8cec110"
GeoInterface = "cf35fbd7-0cd7-5166-be24-54bfbe79505f"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand All @@ -22,6 +23,7 @@ GeometryOpsProjExt = "Proj"

[compat]
CoordinateTransformations = "0.5, 0.6"
ExactPredicates = "2.2.8"
FlexiJoins = "0.1.30"
GeoInterface = "1.2"
GeometryBasics = "0.4.7"
Expand All @@ -36,16 +38,19 @@ julia = "1.9"
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
FlexiJoins = "e37f2e79-19fa-4eb7-8510-b63b51fe0a37"
GeoFormatTypes = "68eda718-8dee-11e9-39e7-89f7f65f511f"
GeoJSON = "61d90e0f-e114-555e-ac52-39dfb47a3ef9"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
LibGEOS = "a90b1aa1-3769-5649-ba7e-abc5a9d163eb"
Rasters = "a3a2b9e3-a471-40c9-b274-f788e487c689"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
Proj = "c94c279d-25a6-4763-9509-64d165bea63e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Shapefile = "8e980c4a-a4fe-5da2-b3a7-4b4b0353a2f4"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["ArchGDAL", "CoordinateTransformations", "DataFrames", "Distributions", "FlexiJoins", "GeoFormatTypes", "GeoJSON", "Proj", "JLD2", "LibGEOS", "Random", "Shapefile", "Test"]
test = ["ArchGDAL", "CoordinateTransformations", "DataFrames", "Distributions", "DimensionalData", "FlexiJoins", "GeoFormatTypes", "GeoJSON", "Proj", "JLD2", "LibGEOS", "Random", "Rasters", "OffsetArrays", "Shapefile", "Test"]
14 changes: 7 additions & 7 deletions benchmarks/benchmark_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ function plot_trials(
end

tag_attrs = capture_tag_attrs(results.tags)
tag_theme = merge(theme, tag_attrs)

lp = if legend_position isa Makie.Automatic
gp.layout[gp.span.rows, gp.span.cols, TopRight()]
Expand All @@ -101,12 +100,15 @@ function plot_trials(
error()
end

return Makie.with_theme(tag_theme) do
ax = Makie.with_theme(theme) do
ax = Axis(
gp;
tag_attrs.Axis...,
xlabel = "Number of points", ylabel = "Time to calculate",
xscale = log10, yscale = log10, ytickformat = _prettytime,
xticksvisible = true, xticklabelsvisible = true,
yticks = Makie.LogTicks(Makie.WilkinsonTicks(7; k_min = 4)),
ygridwidth = 0.75,
)
plots = [scatterlines!(ax, x, y; label = label) for (x, y, label) in zip(xs, ys, labels)]
setproperty!.(getindex.(getproperty.(plots, :plots), 1), :alpha, 0.1)
Expand All @@ -118,13 +120,11 @@ function plot_trials(
valign = legend_valign,
orientation = legend_orientation
)
ax.xticksvisible[] = true
ax.xtickcolor[] = ax.xgridcolor[]
ax.xticklabelsvisible[] = true
ax.yticks[] = Makie.LogTicks(Makie.WilkinsonTicks(7; k_min = 4))
ax.ygridwidth[] = 0.75
return ax
ax
end

return ax
end

const _tag_includelist = ["title", "subtitle"]
Expand Down
19 changes: 19 additions & 0 deletions benchmarks/polygon_scaling.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using CairoMakie, Chairmarks, BenchmarkTools
import GeometryOps as GO, GeoInterface as GI, LibGEOS as LG
include("benchmark_plots.jl")

p25 = GI.Polygon([[(0.0, 0.0), (5.0, 0.0), (5.0, 8.0), (0.0, 8.0), (0.0, 0.0)], [(4.0, 0.5), (4.5, 0.5), (4.5, 3.5), (4.0, 3.5), (4.0, 0.5)], [(2.0, 4.0), (4.0, 4.0), (4.0, 6.0), (2.0, 6.0), (2.0, 4.0)]])
p26 = GI.Polygon([[(3.0, 1.0), (8.0, 1.0), (8.0, 7.0), (3.0, 7.0), (3.0, 5.0), (6.0, 5.0), (6.0, 3.0), (3.0, 3.0), (3.0, 1.0)], [(3.5, 5.5), (6.0, 5.5), (6.0, 6.5), (3.5, 6.5), (3.5, 5.5)], [(5.5, 1.5), (5.5, 2.5), (3.5, 2.5), (3.5, 1.5), (5.5, 1.5)]])

suite = BenchmarkGroup(["title:Polygon intersection timing","subtitle:Single polygon, densified"])

for max_distance in exp10.(LinRange(-1, 1.5, 10))
p25s = GO.segmentize(p25; max_distance)
p26s = GO.segmentize(p26; max_distance)
n_verts = GI.npoint(p25s)
suite["GeometryOps"][n_verts] = @be GO.intersection($p25s, $p26s; target = $(GI.PolygonTrait()), fix_multipoly = $nothing)
suite["LibGEOS"][n_verts] = @be LG.intersection($(GI.convert(LG, p25s)), $(GI.convert(LG, p26s)))
end


plot_trials(suite)
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ MakieThemes = "e296ed71-da82-5faf-88ab-0034a9761098"
Measurements = "eff96d63-e80a-5855-80a2-b1b0885c5ab7"
MonteCarloMeasurements = "0987c9cc-fe09-11e8-30f0-b96dd679fdca"
MultiFloats = "bdf0d083-296b-4888-a5b6-7498122e68a5"
NaturalEarth = "436b0209-26ab-4e65-94a9-6526d86fea76"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Proj = "c94c279d-25a6-4763-9509-64d165bea63e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
2 changes: 2 additions & 0 deletions src/GeometryOps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ using GeometryBasics
import Tables
using LinearAlgebra, Statistics
import GeometryBasics.StaticArrays
import ExactPredicates
import Base.@kwdef

using GeoInterface.Extents: Extents
Expand All @@ -26,6 +27,7 @@ include("methods/barycentric.jl")
include("methods/centroid.jl")
include("methods/distance.jl")
include("methods/equals.jl")
include("methods/clipping/predicates.jl")
include("methods/clipping/clipping_processor.jl")
include("methods/clipping/coverage.jl")
include("methods/clipping/cut.jl")
Expand Down
Loading

0 comments on commit 0886e54

Please sign in to comment.