From 62feaad232fd37b2504eec83e33ec0ce12534358 Mon Sep 17 00:00:00 2001 From: Elias Carvalho Date: Fri, 22 Mar 2024 18:23:49 -0300 Subject: [PATCH 1/7] Add support for writing feature collection without properties --- src/writer.jl | 3 ++- test/writer.jl | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/writer.jl b/src/writer.jl index ba67a5f..1966a06 100644 --- a/src/writer.jl +++ b/src/writer.jl @@ -60,7 +60,8 @@ function get_writer(obj) elseif GI.trait(obj) isa GI.AbstractFeatureCollectionTrait geoms = map(GI.geometry, GI.getfeature(obj)) feats = Tables.dictcolumntable(map(GI.properties, GI.getfeature(obj))) - return Writer(geoms, feats, crs) + tbl = isempty(feats) ? emptytable(geoms) : feats + return Writer(geoms, tbl, crs) elseif Tables.istable(obj) tbl = getfield(Tables.dictcolumntable(obj), :values) # an OrderedDict geomfields = findall(tbl) do data diff --git a/test/writer.jl b/test/writer.jl index 3523ac0..bf830d3 100644 --- a/test/writer.jl +++ b/test/writer.jl @@ -71,6 +71,18 @@ @test t.one == [1, 1] @test t.two == [2, 2] + # feature collection without properties + struct NoProps end + feats = [(; geometry=Point(0,0)), (; geometry=Point(1,1))] + GI.geomtrait(::NoProps) = GI.FeatureCollectionTrait() + GI.isfeaturecollection(::NoProps) = true + GI.getfeature(::GI.FeatureCollectionTrait, ::NoProps, i) = feats[i] + GI.nfeature(::GI.FeatureCollectionTrait, ::NoProps) = length(feats) + file = tempname() + Shapefile.write(file, NoProps()) + t = Shapefile.Table(file) + @test t.geometry == [Point(0,0), Point(1,1)] + # table (with missing) tbl = [ (geo=Point(0,0), feature=1), From 3b1f6dba16e16e305366d8722323abf74d2ca9dc Mon Sep 17 00:00:00 2001 From: Elias Carvalho Date: Mon, 25 Mar 2024 13:33:02 -0300 Subject: [PATCH 2/7] Test: Comment Julia 1.9 and Windows in CI --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 68e2c20..17e67da 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,12 +13,12 @@ jobs: fail-fast: true matrix: version: - - '1.9' + # - '1.9' - '1' os: - ubuntu-latest - macOS-latest - - windows-latest + # - windows-latest arch: - x64 steps: From 007b0cbc2f1ca32928ef491463d918befe392a98 Mon Sep 17 00:00:00 2001 From: Elias Carvalho Date: Mon, 25 Mar 2024 15:46:39 -0300 Subject: [PATCH 3/7] Test: Comment Windows in CI --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 17e67da..db2a92b 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ jobs: fail-fast: true matrix: version: - # - '1.9' + - '1.9' - '1' os: - ubuntu-latest From 25baefed20db430ed71b6a8e0eba44a9a524e86a Mon Sep 17 00:00:00 2001 From: Elias Carvalho Date: Mon, 25 Mar 2024 16:00:01 -0300 Subject: [PATCH 4/7] Test: Comment 1.9 in CI --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index db2a92b..6415ef6 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,12 +13,12 @@ jobs: fail-fast: true matrix: version: - - '1.9' + # - '1.9' - '1' os: - ubuntu-latest - macOS-latest - # - windows-latest + - windows-latest arch: - x64 steps: From fcdb5c84efd144f7741ac8bfcdcb68cec8219371 Mon Sep 17 00:00:00 2001 From: Elias Carvalho Date: Tue, 26 Mar 2024 08:19:31 -0300 Subject: [PATCH 5/7] Test: Undo CI changes --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 6415ef6..68e2c20 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,7 +13,7 @@ jobs: fail-fast: true matrix: version: - # - '1.9' + - '1.9' - '1' os: - ubuntu-latest From 7f29ead72267f321b5415edc94e0cdd89a9fb397 Mon Sep 17 00:00:00 2001 From: Elias Carvalho Date: Tue, 26 Mar 2024 08:25:50 -0300 Subject: [PATCH 6/7] Exclude Windows from Julia 1.9 tests --- .github/workflows/CI.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 68e2c20..37384f2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,6 +21,9 @@ jobs: - windows-latest arch: - x64 + exclude: + - os: windows-latest + version: '1.9' steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 From 0c82b677290c6ef8c1d08f6e190d959132a583ec Mon Sep 17 00:00:00 2001 From: Elias Carvalho Date: Tue, 26 Mar 2024 08:38:49 -0300 Subject: [PATCH 7/7] Add comment with explanation --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 37384f2..9a4ada5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -21,6 +21,7 @@ jobs: - windows-latest arch: - x64 + # tests are not working on Windows with Julia 1.9 exclude: - os: windows-latest version: '1.9'