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

Geojsonsf #118

Merged
merged 74 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
7e6cb29
Start experimenting with geojsonsf
ateucher Sep 25, 2018
2ec628f
Merge branch 'master' into geojsonsf
ateucher May 15, 2019
5045b7f
Merge branch 'master' into geojsonsf
ateucher May 15, 2019
ed284c9
Merge branch 'master' into geojsonsf
ateucher May 15, 2019
4c11dda
Fix tests
ateucher May 15, 2019
0967782
Merge branch 'master' into geojsonsf
ateucher May 16, 2019
1bc18c0
Merge branch 'master' into geojsonsf
ateucher Apr 8, 2020
2ce29ee
Fix test
ateucher Apr 8, 2020
9969555
Remove geo_list methods
ateucher Apr 8, 2020
a50e322
Change sp examples to sf
ateucher Apr 9, 2020
5968474
Add geojsonsf, move geojsonio to Suggests
ateucher Apr 9, 2020
b019c2d
document
ateucher Apr 9, 2020
ffaf1c1
Remove test that just tests mapshaper
ateucher Apr 9, 2020
405afd4
Use rgdal directly to write sp to tempfile (no geojsonio)
ateucher Apr 9, 2020
a1f5dec
Define and use expect_equivalent_json to test geojson strings
ateucher Apr 9, 2020
debf580
Fix tests and examples
ateucher Apr 9, 2020
05112c8
Document
ateucher Apr 9, 2020
59eb7ce
Make sure sf_to_GeoJSON always returns an FC
ateucher Apr 9, 2020
b30637b
No longer need to install Rcpp from source
ateucher Apr 9, 2020
f0255e9
Add test helper to ignore df column order
ateucher Apr 14, 2020
20b2da3
Clean up scratch folder
ateucher Apr 15, 2020
e421256
Update DESCRIPTION
ateucher Apr 15, 2020
aa4ee1f
use checkout@v2
ateucher Apr 15, 2020
b3be24a
Simpler example
ateucher Apr 16, 2020
46a28f8
change all proj -> crs
ateucher Apr 16, 2020
c3b3940
Error in clip_erase when non-identical crs
ateucher Apr 16, 2020
7a173f8
Methods for json rather than geo_json; also use jsonify::validate_jso…
ateucher Apr 19, 2020
10dc7f6
Update min geojsonsf version and add Remotes to DESCRIPTION
ateucher Apr 19, 2020
9357bf1
Don't support POSIXlt
ateucher Apr 19, 2020
fe23833
Merge branch 'master' into geojsonsf
ateucher May 9, 2020
6412875
set test encoding
ateucher May 9, 2020
659de08
Merge master into geojsonsf
ateucher Feb 26, 2022
c2fcd35
remove last geojson method
ateucher Feb 26, 2022
55954d5
silence rgdal CRS warnings; remove geojsonio refs
ateucher Feb 26, 2022
712dd2e
document
ateucher Feb 26, 2022
945cfaf
Update NEWS
ateucher Feb 26, 2022
964dc70
namespace methods::slot
ateucher Feb 26, 2022
a4bb590
test encoding with sf and sp
ateucher Feb 28, 2022
28b097b
Suppress crs assignment warning
ateucher Feb 28, 2022
2638d7b
Add test for #91
ateucher Feb 28, 2022
6f95237
Temporarily use geojsonsf branch with encoding fix
ateucher Mar 2, 2022
2b292dd
update encoding test for names and values
ateucher Mar 2, 2022
0b83f70
Use PR for geojsonsf remote (windows encoding)
ateucher Mar 3, 2022
a913579
Actions: Use ubuntu-gis-unstable ppa
ateucher Mar 3, 2022
ccfd869
Tweaks to GH Actions
ateucher Mar 3, 2022
0a2aafc
Update CI
ateucher Mar 3, 2022
7aed3d7
Remove docker-based CI workflow
ateucher Mar 3, 2022
cc0c0a6
CI: don't install spatial sysreqs since installing binaries from rspm
ateucher Mar 3, 2022
85d23c2
Udpate imports versions, remove remote from geojsonsf
ateucher Mar 4, 2022
9d938bc
Try new minimal CI workflow
ateucher Mar 5, 2022
57cc202
Use v2 actions
ateucher Mar 5, 2022
3f09c57
Add old linux to test old v8
ateucher Mar 5, 2022
0d97334
Update gitignore
ateucher Mar 5, 2022
e3c6507
CI: Change old Ubuntu from 16.04 to 18.04
ateucher Mar 6, 2022
cf7a90d
Edit R-CMD-check badge, render README
ateucher Mar 10, 2022
47d7875
Merge remote-tracking branch 'origin/master' into geojsonsf
ateucher Mar 10, 2022
16d184f
Merge branch 'geojsonsf' of https://github.com/ateucher/rmapshaper in…
ateucher Mar 10, 2022
9f272b3
documentation in apply_mapshaper_commands fixes #121
dblodgett-usgs Mar 12, 2022
0dbd125
Merge pull request #123 from dblodgett-usgs/geojsonsf
ateucher Apr 12, 2022
361deb1
Merge master
ateucher May 11, 2022
db32794
Simplify cmd arg construction by setting NULL defaults
ateucher May 17, 2022
99d252a
Use ... to pass common args to apply_mapshaper_commands
ateucher May 18, 2022
9ad1915
Add quiet parameter. Closes #125
ateucher May 18, 2022
5e678d1
Add global sys_mem option
ateucher May 18, 2022
d81c21d
document
ateucher May 18, 2022
767363b
Use ... in clip & erase for common args
ateucher May 18, 2022
214ac9d
documentation
ateucher May 18, 2022
709da25
Add node mapshaper to CI
ateucher May 18, 2022
0de0990
typo
ateucher May 18, 2022
f5bcdc6
Remove usages of rgdal and rgeos. Closes #129
ateucher Apr 4, 2023
4438f55
render readme and document
ateucher Apr 4, 2023
18498f8
Update GH actions
ateucher Apr 4, 2023
48e490a
Tweak news, build readme
ateucher Apr 4, 2023
e17a216
sp -> sf
ateucher Apr 4, 2023
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
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
29 changes: 0 additions & 29 deletions .github/workflows/R-CMD-check-docker.yaml

This file was deleted.

131 changes: 34 additions & 97 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,123 +1,60 @@
on: [push, pull_request]
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
#
# NOTE: This workflow is overkill for most R packages and
# check-standard.yaml is likely a better choice.
# usethis::use_github_action("check-standard") will install it.
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }} ${{ matrix.config.v8 }})
name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- { os: windows-latest, r: 'release', args: "--no-manual"}
- { os: macOS-latest, r: 'release', args: "--no-manual"}
- { os: macOS-latest, r: 'release', args: "--no-manual", no_node: true}
- { os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", v8: "libnode-dev", args: "--no-manual"}
- { os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", v8: "libnode-dev"}
- { os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", v8: "libv8-dev"}
- { os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", v8: "libnode-dev", args: "--no-manual"}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
CRAN: ${{ matrix.config.cran }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
cache-version: v3
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-node@v1
if: matrix.config.no_node == false
- uses: actions/setup-node@v3
with:
node-version: '16'

- name: install mapshaper node lib
if: matrix.config.no_node == false
- name: Install mapshaper
run: npm install -g mapshaper

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@master

- uses: r-lib/actions/setup-tinytex@master
if: contains(matrix.config.args, 'no-manual') == false

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), "depends.Rds", version = 2)
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r-${{ matrix.config.r }}-

- name: install macOS system dependencies
if: runner.os == 'macOS'
continue-on-error: true
run: |
brew install pkg-config gdal openssl udunits v8 protobuf
extra-packages: any::rcmdcheck
needs: check

- name: add modern cran/v8 ppa
# default libv8-dev on Xenial (16) and Bionic (18) is old libv8-3.14.5.
# To test on new, add the cran/v8 ppa and install current libnode-dev,
# To test on old, install libv8-dev from existing default ppa
if: runner.os == 'Linux' && contains(matrix.config.v8, 'libnode-dev') == true
run: |
sudo add-apt-repository -y ppa:cran/v8
sudo apt-get -y update

- name: Install remotes package
run: Rscript -e "install.packages('remotes')"

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo add-apt-repository -y ppa:cran/v8
sudo -s eval "$sysreqs"
# install spatial dependencies
sudo apt update
sudo apt install \
libudunits2-dev \
libgdal-dev \
libgeos-dev \
libproj-dev \
${{ matrix.config.v8 }}

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran('rcmdcheck')
shell: Rscript {0}

- name: Check
env:
TMPDIR: ${{ runner.temp }}
run: |
rcmdcheck::rcmdcheck(args = "${{ matrix.config.args }}", error_on = 'warning', check_dir = 'check')
shell: Rscript {0}


- name: Upload check results
if: failure()
uses: actions/upload-artifact@master
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check

- name: Test coverage
if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
continue-on-error: true
run: |
Rscript -e 'remotes::install_github("r-lib/covr@gh-actions")'
Rscript -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")'
upload-snapshots: true
50 changes: 50 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: test-coverage

jobs:
test-coverage:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
22 changes: 9 additions & 13 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,29 @@ Description: Edit and simplify 'geojson', 'Spatial', and 'sf'
by Matthew Bloch <https://github.com/mbloch/mapshaper/> to perform
topologically-aware polygon simplification, as well as other
operations such as clipping, erasing, dissolving, and converting
'multi-part' to 'single-part' geometries. It relies on the
'geojsonio' package for working with 'geojson' objects, the 'sf'
package for working with 'sf' objects, and the 'sp' and 'rgdal'
packages for working with 'Spatial' objects.
'multi-part' to 'single-part' geometries.
License: MIT + file LICENSE
URL: https://github.com/ateucher/rmapshaper
BugReports: https://github.com/ateucher/rmapshaper/issues
Imports:
geojsonio (>= 0.9.4),
geojsonlint (>= 0.4.0),
jsonlite (>= 1.7.0),
methods,
readr (>= 1.4.0),
sf (>= 0.9-0),
geojsonsf (>= 2.0.2),
jsonify (>= 1.2.0),
readr (>= 2.1.0),
sf (>= 1.0.0),
sp (>= 1.4-0),
V8 (>= 3.4.2)
V8 (>= 4.0.0)
Suggests:
geojsonio,
knitr,
magrittr,
rgdal,
rgeos,
rmarkdown,
testthat (>= 2.1.0),
jsonlite,
covr,
units
VignetteBuilder:
knitr
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
RoxygenNote: 7.2.3
34 changes: 11 additions & 23 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,74 +1,63 @@
# Generated by roxygen2: do not edit by hand

S3method(drop_null_geometries,character)
S3method(drop_null_geometries,geo_json)
S3method(drop_null_geometries,geo_list)
S3method(drop_null_geometries,json)
S3method(ms_clip,SpatialLines)
S3method(ms_clip,SpatialPoints)
S3method(ms_clip,SpatialPolygons)
S3method(ms_clip,character)
S3method(ms_clip,geo_json)
S3method(ms_clip,geo_list)
S3method(ms_clip,json)
S3method(ms_clip,sf)
S3method(ms_clip,sfc)
S3method(ms_dissolve,SpatialPoints)
S3method(ms_dissolve,SpatialPolygons)
S3method(ms_dissolve,character)
S3method(ms_dissolve,geo_json)
S3method(ms_dissolve,geo_list)
S3method(ms_dissolve,json)
S3method(ms_dissolve,sf)
S3method(ms_dissolve,sfc)
S3method(ms_erase,SpatialLines)
S3method(ms_erase,SpatialPoints)
S3method(ms_erase,SpatialPolygons)
S3method(ms_erase,character)
S3method(ms_erase,geo_json)
S3method(ms_erase,geo_list)
S3method(ms_erase,json)
S3method(ms_erase,sf)
S3method(ms_erase,sfc)
S3method(ms_explode,SpatialLines)
S3method(ms_explode,SpatialPolygons)
S3method(ms_explode,character)
S3method(ms_explode,geo_json)
S3method(ms_explode,geo_list)
S3method(ms_explode,json)
S3method(ms_explode,sf)
S3method(ms_explode,sfc)
S3method(ms_filter_fields,SpatialLinesDataFrame)
S3method(ms_filter_fields,SpatialPointsDataFrame)
S3method(ms_filter_fields,SpatialPolygonsDataFrame)
S3method(ms_filter_fields,character)
S3method(ms_filter_fields,geo_json)
S3method(ms_filter_fields,geo_list)
S3method(ms_filter_fields,json)
S3method(ms_filter_fields,sf)
S3method(ms_filter_islands,SpatialPolygons)
S3method(ms_filter_islands,character)
S3method(ms_filter_islands,geo_json)
S3method(ms_filter_islands,geo_list)
S3method(ms_filter_islands,json)
S3method(ms_filter_islands,sf)
S3method(ms_filter_islands,sfc)
S3method(ms_innerlines,SpatialPolygons)
S3method(ms_innerlines,character)
S3method(ms_innerlines,geo_json)
S3method(ms_innerlines,geo_list)
S3method(ms_innerlines,json)
S3method(ms_innerlines,sf)
S3method(ms_innerlines,sfc)
S3method(ms_lines,SpatialPolygons)
S3method(ms_lines,character)
S3method(ms_lines,geo_json)
S3method(ms_lines,geo_list)
S3method(ms_lines,json)
S3method(ms_lines,sf)
S3method(ms_lines,sfc)
S3method(ms_points,SpatialPolygons)
S3method(ms_points,character)
S3method(ms_points,geo_json)
S3method(ms_points,geo_list)
S3method(ms_points,json)
S3method(ms_points,sf)
S3method(ms_points,sfc)
S3method(ms_simplify,SpatialLines)
S3method(ms_simplify,SpatialPolygons)
S3method(ms_simplify,character)
S3method(ms_simplify,geo_json)
S3method(ms_simplify,geo_list)
S3method(ms_simplify,json)
S3method(ms_simplify,sf)
S3method(ms_simplify,sfc)
export(apply_mapshaper_commands)
Expand All @@ -85,7 +74,6 @@ export(ms_lines)
export(ms_points)
export(ms_simplify)
importFrom(V8,v8)
importFrom(geojsonlint,geojson_validate)
importFrom(methods,.hasSlot)
importFrom(methods,as)
importFrom(methods,is)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# rmapshaper (development version)

* Switched to using the `geojsonsf` package instead of `geojsonio` for object conversion (#118).
* Dropped support for `geojson_list` objects. This was a rarely-used class from the `geojsonio` package (#118)
* Arguments `force_FC`, `sys`, and `sys_mem` are now passed to `apply_mapshaper_commands` via `...` rather than explicitly, so they are now documented in the `...` section of each function. This may break some existing code if you were passing values to these arguments by position rather than by name, especially using `force_FC` in `ms_simplify` as it was not at the end of the argument list. It may also change the class of the return value for some input classes and functions (such as `ms_lines` and `ms_innerlines`) as `force_FC` will inherit the default `TRUE` for all functions.
* Added `quiet` option to silence mapshaper console messages when using `sys = TRUE` (#125)
* Added ability to globally set the system memory when using the system mapshaper via `options("mapshaper.sys_mem"=X)`, where `X` is the amount of memory in GB.

# rmapshaper 0.4.6

* Fixed a long-standing issue where `units` columns in `sf` objects would cause failures; all numeric columns of class `"units"` are now converted to numeric before running through mapshaper commands. (#116, thanks @Robinlovelace)
Expand Down
Loading