Full Code of edzer/sfr for AI

main 72ad7d000b93 cached
340 files
2.2 MB
592.9k tokens
383 symbols
1 requests
Download .txt
Showing preview only (2,368K chars total). Download the full file or copy to clipboard to get everything.
Repository: edzer/sfr
Branch: main
Commit: 72ad7d000b93
Files: 340
Total size: 2.2 MB

Directory structure:
gitextract_91i9k_8r/

├── .Rbuildignore
├── .gitattributes
├── .github/
│   ├── .gitignore
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── other_issue.md
│   └── workflows/
│       ├── R-CMD-check.yaml
│       ├── pkgdown.yaml
│       ├── rhub.yaml
│       ├── test-coverage.yaml
│       └── tic-db.yml
├── .gitignore
├── CONDUCT.md
├── DESCRIPTION
├── LICENSE
├── NAMESPACE
├── NEWS.md
├── PROPOSAL.md
├── R/
│   ├── RcppExports.R
│   ├── aggregate.R
│   ├── agr.R
│   ├── arith.R
│   ├── bbox.R
│   ├── bind.R
│   ├── break_antimeridian.R
│   ├── cast_sfc.R
│   ├── cast_sfg.R
│   ├── collection_extract.R
│   ├── crop.R
│   ├── crs.R
│   ├── datasets.R
│   ├── db.R
│   ├── defunct.R
│   ├── gdal_utils.R
│   ├── geom-measures.R
│   ├── geom-predicates.R
│   ├── geom-transformers.R
│   ├── geos-overlayng.R
│   ├── graticule.R
│   ├── grid.R
│   ├── import-standalone-s3-register.R
│   ├── init.R
│   ├── jitter.R
│   ├── join.R
│   ├── m_range.R
│   ├── make_grid.R
│   ├── maps.R
│   ├── nearest.R
│   ├── normalize.R
│   ├── plot.R
│   ├── proj.R
│   ├── read.R
│   ├── s2.R
│   ├── sample.R
│   ├── sf-package.R
│   ├── sf.R
│   ├── sfc.R
│   ├── sfg.R
│   ├── sgbp.R
│   ├── shift_longitude.R
│   ├── sp.R
│   ├── spatstat.R
│   ├── stars.R
│   ├── terra.R
│   ├── tidyverse-vctrs.R
│   ├── tidyverse.R
│   ├── transform.R
│   ├── valid.R
│   ├── wkb.R
│   ├── wkt.R
│   └── z_range.R
├── README.md
├── _pkgdown.yml
├── cleanup
├── codecov.yml
├── configure
├── configure.ac
├── demo/
│   ├── 00Index
│   ├── affine.R
│   ├── basic.R
│   ├── ggplot.R
│   ├── meuse_sf.R
│   ├── nc.R
│   └── twitter.R
├── inst/
│   ├── CITATION
│   ├── csv/
│   │   └── pt.csv
│   ├── docker/
│   │   ├── README.md
│   │   ├── alma/
│   │   │   ├── Dockerfile
│   │   │   ├── README.md
│   │   │   ├── build_command
│   │   │   └── vito.repo
│   │   ├── arrow/
│   │   │   └── Dockerfile
│   │   ├── base/
│   │   │   └── Dockerfile
│   │   ├── bionic/
│   │   │   └── Dockerfile
│   │   ├── cran/
│   │   │   └── Dockerfile
│   │   ├── custom/
│   │   │   └── Dockerfile
│   │   ├── devel/
│   │   │   └── Dockerfile
│   │   ├── fedora/
│   │   │   └── Dockerfile
│   │   ├── gdal/
│   │   │   └── Dockerfile
│   │   ├── gdal304/
│   │   │   └── Dockerfile
│   │   ├── geos/
│   │   │   └── Dockerfile
│   │   ├── lowest/
│   │   │   └── Dockerfile
│   │   └── parquet/
│   │       └── Dockerfile
│   ├── gml/
│   │   └── fmi_test.gml
│   ├── gpkg/
│   │   ├── b_pump.gpkg
│   │   ├── buildings.gpkg
│   │   ├── grd_addr.gpkg
│   │   ├── nc.gpkg
│   │   ├── nospatial.gpkg
│   │   └── tl.gpkg
│   ├── include/
│   │   ├── sf.h
│   │   └── sf_RcppExports.h
│   ├── nc/
│   │   ├── cropped.nc
│   │   └── zarr.py
│   ├── osm/
│   │   └── overpass.osm
│   ├── shape/
│   │   ├── olinda1.dbf
│   │   ├── olinda1.prj
│   │   ├── olinda1.shp
│   │   ├── olinda1.shx
│   │   ├── storms_xyz.dbf
│   │   ├── storms_xyz.shp
│   │   ├── storms_xyz.shx
│   │   ├── storms_xyz_feature.dbf
│   │   ├── storms_xyz_feature.shp
│   │   ├── storms_xyz_feature.shx
│   │   ├── storms_xyzm.dbf
│   │   ├── storms_xyzm.shp
│   │   ├── storms_xyzm.shx
│   │   ├── storms_xyzm_feature.dbf
│   │   ├── storms_xyzm_feature.shp
│   │   └── storms_xyzm_feature.shx
│   └── tif/
│       └── geomatrix.tif
├── man/
│   ├── Ops.Rd
│   ├── aggregate.sf.Rd
│   ├── bind.Rd
│   ├── coerce-methods.Rd
│   ├── dbDataType.Rd
│   ├── dbWriteTable.Rd
│   ├── db_drivers.Rd
│   ├── dot-stop_geos.Rd
│   ├── extension_map.Rd
│   ├── gdal.Rd
│   ├── gdal_addo.Rd
│   ├── gdal_compressors.Rd
│   ├── gdal_utils.Rd
│   ├── geos_binary_ops.Rd
│   ├── geos_binary_pred.Rd
│   ├── geos_combine.Rd
│   ├── geos_measures.Rd
│   ├── geos_query.Rd
│   ├── geos_unary.Rd
│   ├── interpolate_aw.Rd
│   ├── is_driver_available.Rd
│   ├── is_driver_can.Rd
│   ├── is_geometry_column.Rd
│   ├── merge.sf.Rd
│   ├── nc.Rd
│   ├── plot.Rd
│   ├── prefix_map.Rd
│   ├── proj_tools.Rd
│   ├── rawToHex.Rd
│   ├── s2.Rd
│   ├── sf-defunct.Rd
│   ├── sf-package.Rd
│   ├── sf.Rd
│   ├── sf_extSoftVersion.Rd
│   ├── sf_project.Rd
│   ├── sfc.Rd
│   ├── sgbp.Rd
│   ├── st.Rd
│   ├── st_agr.Rd
│   ├── st_as_binary.Rd
│   ├── st_as_grob.Rd
│   ├── st_as_sf.Rd
│   ├── st_as_sfc.Rd
│   ├── st_as_text.Rd
│   ├── st_bbox.Rd
│   ├── st_break_antimeridian.Rd
│   ├── st_cast.Rd
│   ├── st_cast_sfc_default.Rd
│   ├── st_collection_extract.Rd
│   ├── st_coordinates.Rd
│   ├── st_crop.Rd
│   ├── st_crs.Rd
│   ├── st_drivers.Rd
│   ├── st_geometry.Rd
│   ├── st_geometry_type.Rd
│   ├── st_graticule.Rd
│   ├── st_is.Rd
│   ├── st_is_full.Rd
│   ├── st_is_longlat.Rd
│   ├── st_jitter.Rd
│   ├── st_join.Rd
│   ├── st_layers.Rd
│   ├── st_line_project_point.Rd
│   ├── st_line_sample.Rd
│   ├── st_m_range.Rd
│   ├── st_make_grid.Rd
│   ├── st_nearest_feature.Rd
│   ├── st_nearest_points.Rd
│   ├── st_normalize.Rd
│   ├── st_precision.Rd
│   ├── st_read.Rd
│   ├── st_relate.Rd
│   ├── st_sample.Rd
│   ├── st_shift_longitude.Rd
│   ├── st_transform.Rd
│   ├── st_viewport.Rd
│   ├── st_write.Rd
│   ├── st_z_range.Rd
│   ├── st_zm.Rd
│   ├── stars.Rd
│   ├── summary.sfc.Rd
│   ├── tibble.Rd
│   ├── tidyverse.Rd
│   ├── transform.sf.Rd
│   └── valid.Rd
├── sf.Rproj
├── src/
│   ├── Makevars.in
│   ├── Makevars.ucrt
│   ├── Makevars.win
│   ├── RcppExports.cpp
│   ├── bbox.cpp
│   ├── bbox.h
│   ├── gdal.cpp
│   ├── gdal.h
│   ├── gdal_geom.cpp
│   ├── gdal_read.cpp
│   ├── gdal_read.h
│   ├── gdal_read_stream.cpp
│   ├── gdal_sf_pkg.h
│   ├── gdal_utils.cpp
│   ├── gdal_write.cpp
│   ├── geos.cpp
│   ├── hex.cpp
│   ├── hex.h
│   ├── mdim.cpp
│   ├── ops.cpp
│   ├── polygonize.cpp
│   ├── proj.cpp
│   ├── proj_info.cpp
│   ├── raster2sf.cpp
│   ├── sfc-sfg.cpp
│   ├── signed_area.cpp
│   ├── stars.cpp
│   ├── wkb.cpp
│   ├── wkb.h
│   ├── zm_range.cpp
│   └── zm_range.h
├── tests/
│   ├── aggregate.R
│   ├── aggregate.Rout.save
│   ├── bgmap.rda
│   ├── cast.R
│   ├── cast.Rout.save
│   ├── crs.R
│   ├── crs.Rout.save
│   ├── dist.R
│   ├── dist.Rout.save
│   ├── dplyr.R
│   ├── dplyr.Rout.save
│   ├── empty.R
│   ├── empty.Rout.save
│   ├── full.R
│   ├── full.Rout.save
│   ├── gdal_geom.R
│   ├── gdal_geom.Rout.save
│   ├── geos.R
│   ├── geos.Rout.save
│   ├── graticule.R
│   ├── graticule.Rout.save
│   ├── grid.R
│   ├── grid.Rout.save
│   ├── maps.R
│   ├── maps.Rout.save
│   ├── plot.R
│   ├── plot.Rout.save
│   ├── read.R
│   ├── read.Rout.save
│   ├── roundtrip.R
│   ├── roundtrip.Rout.save
│   ├── s2.R
│   ├── s2.Rout.save
│   ├── sample.R
│   ├── sample.Rout.save
│   ├── sfc.R
│   ├── sfc.Rout.save
│   ├── sfg.R
│   ├── sfg.Rout.save
│   ├── spatstat.R
│   ├── spatstat.Rout.save
│   ├── stars.R
│   ├── stars.Rout.save
│   ├── test-by-element.R
│   ├── test-by-element.Rout.save
│   ├── testthat/
│   │   ├── test-aw.R
│   │   ├── test-bbox.R
│   │   ├── test-collection_extract.R
│   │   ├── test-crs.R
│   │   ├── test-gdal.R
│   │   ├── test-geos.R
│   │   ├── test-grid.R
│   │   ├── test-normalize.R
│   │   ├── test-plot.R
│   │   ├── test-postgis_ODBC.R
│   │   ├── test-postgis_RPostgreSQL.R
│   │   ├── test-postgis_RPostgres.R
│   │   ├── test-proj.R
│   │   ├── test-read.R
│   │   ├── test-s2.R
│   │   ├── test-sample.R
│   │   ├── test-sf.R
│   │   ├── test-sfc.R
│   │   ├── test-sfg.R
│   │   ├── test-shift_longitude.R
│   │   ├── test-sp.R
│   │   ├── test-st_cast.R
│   │   ├── test-tidyverse-vctrs.R
│   │   ├── test-tidyverse.R
│   │   ├── test-tm.R
│   │   ├── test-valid.R
│   │   ├── test-wkb.R
│   │   ├── test-wkt.R
│   │   ├── test-write.R
│   │   └── test-zm_range.R
│   ├── testthat.R
│   ├── units.R
│   ├── units.Rout.save
│   ├── wkb.R
│   └── wkb.Rout.save
├── tic.R
├── tools/
│   └── winlibs.R
├── vignettes/
│   ├── sf.fig
│   ├── sf1.Rmd
│   ├── sf2.Rmd
│   ├── sf3.Rmd
│   ├── sf4.Rmd
│   ├── sf5.Rmd
│   ├── sf6.Rmd
│   ├── sf7.Rmd
│   └── sf_fig.drawio
└── vignettes.awk

================================================
FILE CONTENTS
================================================

================================================
FILE: .Rbuildignore
================================================
.travis.yml
PROPOSAL.md
config.log
config.status
TODO
^windows
^appveyor\.yml$
^.*\.Rproj$
^\.Rproj\.user$
blog
README.md
CONDUCT.md
rdev
^codecov\.yml$
hub
tic.R
NOTES
^\.ccache$
^\.github$
^tic\.R$
vignettes.awk
^\.gitattributes$
_pkgdown.yml
docs
pkgdown
changes0.txt
changes1.txt
changes2.txt
changes3.txt
changes.txt
aware.patch


================================================
FILE: .gitattributes
================================================
* text=auto
data/* binary
src/* text=lf
R/* text=lf

# Force the following filetypes to have unix eols, so Windows does not break them
configure.ac text eol=lf


================================================
FILE: .github/.gitignore
================================================
*.html


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Standard bug report template
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
It is easier for developers to help if they can reproduce the problem.   
Could you please provide a minimal reproducible example?

**If reporting a change from previous versions**

Please read https://cran.r-project.org/web/packages/sf/news/news.html first.

**Additional context**
Add any other context about the problem here.

<details>
Paste the output of your `sessionInfo()` and `sf::sf_extSoftVersion()`
</details>


================================================
FILE: .github/ISSUE_TEMPLATE/other_issue.md
================================================
---
name: Other issue
about: Blank template for other issue types
title: ''
labels: ''
assignees: ''

---




================================================
FILE: .github/workflows/R-CMD-check.yaml
================================================
# 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]
  schedule:
    - cron: "0 4 * * *"

name: R-CMD-check

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

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

    strategy:
      fail-fast: false
      matrix:
        config:
          - {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'}
          - {os: ubuntu-latest,   r: 'oldrel-2'}

    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
      R_KEEP_PKG_SOURCE: yes

    steps:
      - uses: actions/checkout@v6

      - 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

      - name: Install macOS system dependencies
        if: runner.os == 'macos'
        run: brew install gdal proj

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

      - uses: r-lib/actions/check-r-package@v2
        with:
          upload-snapshots: true


================================================
FILE: .github/workflows/pkgdown.yaml
================================================
# 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]
  release:
    types: [published]
  workflow_dispatch:

name: pkgdown

permissions: read-all

jobs:
  pkgdown:
    runs-on: ubuntu-latest
    # Only restrict concurrency for non-PR jobs
    concurrency:
      group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v6

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

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

      - uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: any::pkgdown, local::.
          needs: website

      - name: Build site
        run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
        shell: Rscript {0}

      - name: Deploy to GitHub pages 🚀
        if: github.event_name != 'pull_request'
        uses: JamesIves/github-pages-deploy-action@v4.8.0
        with:
          clean: false
          branch: gh-pages
          folder: docs


================================================
FILE: .github/workflows/rhub.yaml
================================================
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
  workflow_dispatch:
    inputs:
      config:
        description: 'A comma separated list of R-hub platforms to use.'
        type: string
        default: 'linux,windows,macos'
      name:
        description: 'Run name. You can leave this empty now.'
        type: string
      id:
        description: 'Unique ID. You can leave this empty now.'
        type: string

jobs:

  setup:
    runs-on: ubuntu-latest
    outputs:
      containers: ${{ steps.rhub-setup.outputs.containers }}
      platforms: ${{ steps.rhub-setup.outputs.platforms }}

    steps:
    # NO NEED TO CHECKOUT HERE
    - uses: r-hub/actions/setup@v1
      with:
        config: ${{ github.event.inputs.config }}
      id: rhub-setup

  linux-containers:
    needs: setup
    if: ${{ needs.setup.outputs.containers != '[]' }}
    runs-on: ubuntu-latest
    name: ${{ matrix.config.label }}
    strategy:
      fail-fast: false
      matrix:
        config: ${{ fromJson(needs.setup.outputs.containers) }}
    container:
      image: ${{ matrix.config.container }}

    steps:
      - uses: r-hub/actions/checkout@v1
      - uses: r-hub/actions/platform-info@v1
        with:
          token: ${{ secrets.RHUB_TOKEN }}
          job-config: ${{ matrix.config.job-config }}
      - uses: r-hub/actions/setup-deps@v1
        with:
          token: ${{ secrets.RHUB_TOKEN }}
          job-config: ${{ matrix.config.job-config }}
      - uses: r-hub/actions/run-check@v1
        with:
          token: ${{ secrets.RHUB_TOKEN }}
          job-config: ${{ matrix.config.job-config }}

  other-platforms:
    needs: setup
    if: ${{ needs.setup.outputs.platforms != '[]' }}
    runs-on: ${{ matrix.config.os }}
    name: ${{ matrix.config.label }}
    strategy:
      fail-fast: false
      matrix:
        config: ${{ fromJson(needs.setup.outputs.platforms) }}

    steps:
      - uses: r-hub/actions/checkout@v1
      - uses: r-hub/actions/setup-r@v1
        with:
          job-config: ${{ matrix.config.job-config }}
          token: ${{ secrets.RHUB_TOKEN }}
      - uses: r-hub/actions/platform-info@v1
        with:
          token: ${{ secrets.RHUB_TOKEN }}
          job-config: ${{ matrix.config.job-config }}
      - uses: r-hub/actions/setup-deps@v1
        with:
          job-config: ${{ matrix.config.job-config }}
          token: ${{ secrets.RHUB_TOKEN }}
      - uses: r-hub/actions/run-check@v1
        with:
          job-config: ${{ matrix.config.job-config }}
          token: ${{ secrets.RHUB_TOKEN }}


================================================
FILE: .github/workflows/test-coverage.yaml
================================================
# 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@v4

      - 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(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "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@v4
        with:
          name: coverage-test-failures
          path: ${{ runner.temp }}/package


================================================
FILE: .github/workflows/tic-db.yml
================================================
## tic GitHub Actions template: linux
## revision date: 2021-06-27
# [Custom header]
on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:
  # for now, CRON jobs only run on the default branch of the repo (i.e. usually on master)
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron: "0 4 * * *"

name: tic-db

jobs:
  all:
    runs-on: ${{ matrix.config.os }}

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

    strategy:
      fail-fast: false
      matrix:
        config:
          # use a different tic template type if you do not want to build on all listed platforms
          - { os: ubuntu-latest, r: "release" }

    services:
      postgres:
        image: kartoza/postgis
        ports:
        - 5432:5432

    env:
      # otherwise remotes::fun() errors cause the build to fail. Example: Unavailability of binaries
      R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
      CRAN: ${{ matrix.config.cran }}
      # make sure to run `tic::use_ghactions_deploy()` to set up deployment
      TIC_DEPLOY_KEY: ${{ secrets.TIC_DEPLOY_KEY }}
      # prevent rgl issues because no X11 display is available
      RGL_USE_NULL: true
      # if you use bookdown or blogdown, replace "PKGDOWN" by the respective
      # capitalized term. This also might need to be done in tic.R
      BUILD_PKGDOWN: ${{ matrix.config.pkgdown }}
      # macOS >= 10.15.4 linking
      SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
      # use GITHUB_TOKEN from GitHub to workaround rate limits in {remotes}
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

    steps:
      - uses: actions/checkout@v4

      - uses: r-lib/actions/setup-r@v2
        with:
          r-version: ${{ matrix.config.r }}
          Ncpus: 4

      # LaTeX. Installation time:
      # Linux: ~ 1 min
      # macOS: ~ 1 min 30s
      # Windows: never finishes
      - uses: r-lib/actions/setup-tinytex@v2
        if: matrix.config.latex == 'true'

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

      # set date/week for use in cache creation
      # https://github.community/t5/GitHub-Actions/How-to-set-and-access-a-Workflow-variable/m-p/42970
      # - cache R packages daily
#     - name: "[Cache] Prepare daily timestamp for cache"
#       if: runner.os != 'Windows'
#       id: date
#       run: echo "::set-output name=date::$(date '+%d-%m')"

#     - name: "[Cache] Cache R packages"
#       if: runner.os != 'Windows'
#       uses: pat-s/always-upload-cache@v2
#       with:
#         path: ${{ env.R_LIBS_USER }}
#         key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}
#         restore-keys: ${{ runner.os }}-r-${{ matrix.config.r }}-${{steps.date.outputs.date}}

      - name: "[Stage] [Linux] Install required system libs"
        if: runner.os == 'Linux'
        run: sudo apt install libcurl4-openssl-dev libgit2-dev

      # for some strange Windows reason this step and the next one need to be decoupled
      - name: "[Stage] Prepare"
        run: |
          Rscript -e "if (!requireNamespace('remotes')) install.packages('remotes', type = 'source')"
          Rscript -e "if (getRversion() < '3.2' && !requireNamespace('curl')) install.packages('curl', type = 'source')"

      - name: "[Custom block] [Linux] Install spatial libraries"
        if: runner.os == 'Linux'
        run: sudo apt-get install libgdal-dev libproj-dev libgeos-dev libudunits2-dev

      - name: "[Custom block] [macOS] Install spatial libraries"
        if: runner.os == 'macOS'
        run: |
          # conflicts with gfortran from r-lib/actions when linking gcc
          rm '/usr/local/bin/gfortran'
          brew install pkg-config gdal proj geos

      - name: "[Stage] [macOS] Install libgit2"
        if: runner.os == 'macOS'
        run: brew install libgit2

      - name: "[Stage] [macOS] Install system libs for pkgdown"
        if: runner.os == 'macOS' && matrix.config.pkgdown != ''
        run: brew install harfbuzz fribidi

      - name: "[Stage] [Linux] Install system libs for pkgdown"
        if: runner.os == 'Linux' && matrix.config.pkgdown != ''
        run: sudo apt install libharfbuzz-dev libfribidi-dev

      # Try to automatically check for system dependencies and install them
      # Note: this might not catch all required system libs and manual action might be needed
      - name: "[Stage] [Linux] Install linux system dependencies"
        if: runner.os == 'Linux'
        run: |
          while read -r cmd
          do
            eval sudo $cmd
          done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))')

      - name: "[Stage] Install"
        if: matrix.config.os != 'macOS-latest' || matrix.config.r != 'devel'
        run: Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"

      # macOS devel needs its own stage because we need to work with an option to suppress the usage of binaries
      - name: "[Stage] Prepare & Install (macOS-devel)"
        if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'devel'
        run: |
          echo -e 'options(Ncpus = 4, pkgType = "source", repos = structure(c(CRAN = "https://cloud.r-project.org/")))' > $HOME/.Rprofile
          Rscript -e "remotes::install_github('ropensci/tic')" -e "print(tic::dsl_load())" -e "tic::prepare_all_stages()" -e "tic::before_install()" -e "tic::install()"

      - name: "[Stage] Script"
        run: Rscript -e 'tic::script()'

      - name: "[Stage] After Success"
        if: matrix.config.os == 'macOS-latest' && matrix.config.r == 'release'
        run: Rscript -e "tic::after_success()"

      - name: "[Stage] Upload R CMD check artifacts"
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: ${{ runner.os }}-r${{ matrix.config.r }}-results
          path: check


================================================
FILE: .gitignore
================================================
.Rproj.user
.Rhistory
.RData
.Ruserdata

src/*.o
src/*.so
src/*.dll
src/Makevars
config.log
config.status

windows/
inst/gdal/
inst/proj/

nc.shp
nc.prj
nc.dbf
nc.shx
docs/
tests/testthat/Rplots.pdf


================================================
FILE: CONDUCT.md
================================================
# Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who 
contribute through reporting issues, posting feature requests, updating documentation,
submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for
everyone, regardless of level of experience, gender, gender identity and expression,
sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or
imagery, derogatory comments or personal attacks, trolling, public or private harassment,
insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments,
commits, code, wiki edits, issues, and other contributions that are not aligned to this 
Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed 
from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by 
opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the Contributor Covenant 
(http:contributor-covenant.org), version 1.0.0, available at 
http://contributor-covenant.org/version/1/0/0/


================================================
FILE: DESCRIPTION
================================================
Package: sf
Version: 1.1-1
Title: Simple Features for R
Authors@R:
    c(person(given = "Edzer",
             family = "Pebesma",
             role = c("aut", "cre"),
             email = "edzer.pebesma@uni-muenster.de",
             comment = c(ORCID = "0000-0001-8049-7069")),
      person(given = "Roger",
             family = "Bivand",
             role = "ctb",
             comment = c(ORCID = "0000-0003-2392-6140")),
      person(given = "Etienne",
             family = "Racine",
             role = "ctb"),
      person(given = "Michael",
             family = "Sumner",
             role = "ctb"),
      person(given = "Ian",
             family = "Cook",
             role = "ctb"),
      person(given = "Tim",
             family = "Keitt",
             role = "ctb"),
      person(given = "Robin",
             family = "Lovelace",
             role = "ctb"),
      person(given = "Hadley",
             family = "Wickham",
             role = "ctb"),
      person(given = "Jeroen",
             family = "Ooms",
             role = "ctb",
             comment = c(ORCID = "0000-0002-4035-0289")),
      person(given = "Kirill",
             family = "M\u00fcller",
             role = "ctb"),
      person(given = "Thomas Lin",
             family = "Pedersen",
             role = "ctb"),
      person(given = "Dan",
             family = "Baston",
             role = "ctb"),
      person(given = "Dewey",
             family = "Dunnington",
             role = "ctb",
             comment = c(ORCID = "0000-0002-9415-4582")),
      person(given = "Alexandre",
             family = "Courtiol",
             role = "ctb",
             comment = c(ORCID = "0000-0003-0637-2959"))
			 )
Description: Support for simple feature access, a standardized way to
    encode and analyze spatial vector data. Binds to 'GDAL' 
	<doi:10.5281/zenodo.5884351> for reading and writing data, to 'GEOS'
    <doi:10.5281/zenodo.11396894> for geometrical operations,
    and to 'PROJ' <doi:10.5281/zenodo.5884394> for projection
    conversions and datum transformations. Uses by default the 's2'
    package for geometry operations on geodetic (long/lat degree)
	coordinates.
License: GPL-2 | MIT + file LICENSE
URL: https://r-spatial.github.io/sf/, https://github.com/r-spatial/sf
BugReports: https://github.com/r-spatial/sf/issues
Depends:
    methods,
    R (>= 4.1.0)
Imports:
    classInt (>= 0.4-1),
    DBI (>= 0.8),
    graphics,
    grDevices,
    grid,
    s2 (>= 1.1.0),
    stats,
    tools,
    units (>= 0.7-0),
    utils
Suggests:
    blob,
    nanoarrow,
    covr,
    dplyr (>= 1.0.0),
    ggplot2,
    knitr,
    lwgeom (>= 0.2-14),
    maps,
    mapview,
    Matrix,
    microbenchmark,
    odbc,
    pbapply,
    pillar,
    pool,
    raster,
    rlang,
    rmarkdown,
    RPostgres (>= 1.1.0),
    RPostgreSQL,
    RSQLite,
    sp (>= 1.2-4),
    spatstat (>= 2.0-1),
    spatstat.geom, 
    spatstat.random, 
    spatstat.linnet, 
    spatstat.utils,
    stars (>= 0.6-0),
    terra,
    testthat (>= 3.0.0),
    tibble (>= 1.4.1),
    tidyr (>= 1.2.0),
    tidyselect (>= 1.0.0),
    tmap (>= 2.0),
    vctrs,
    wk (>= 0.9.0)
LinkingTo: 
    Rcpp
VignetteBuilder: 
    knitr
Encoding: UTF-8
Config/testthat/edition: 2
Config/needs/coverage: XML
Config/roxygen2/markdown: TRUE
Config/roxygen2/version: 8.0.0
SystemRequirements: GDAL (>= 2.0.1), GEOS (>= 3.4.0),
    PROJ (>= 4.8.0), sqlite3
Collate: 
    'RcppExports.R'
    'init.R'
    'import-standalone-s3-register.R'
    'crs.R'
    'bbox.R'
    'read.R'
    'db.R'
    'sfc.R'
    'sfg.R'
    'sf.R'
    'bind.R'
    'wkb.R'
    'wkt.R'
    'plot.R'
    'geom-measures.R'
    'geom-predicates.R'
    'geom-transformers.R'
    'transform.R'
    'proj.R'
    'sp.R'
    'grid.R'
    'arith.R'
    'tidyverse.R'
    'tidyverse-vctrs.R'
    'cast_sfg.R'
    'cast_sfc.R'
    'graticule.R'
    'datasets.R'
    'aggregate.R'
    'agr.R'
    'maps.R'
    'join.R'
    'sample.R'
    'valid.R'
    'collection_extract.R'
    'jitter.R'
    'sgbp.R'
    'spatstat.R'
    'stars.R'
    'crop.R'
    'gdal_utils.R'
    'nearest.R'
    'normalize.R'
    'sf-package.R'
    'defunct.R'
    'z_range.R'
    'm_range.R'
    'shift_longitude.R'
    'make_grid.R'
    's2.R'
    'terra.R'
    'geos-overlayng.R'
    'break_antimeridian.R'


================================================
FILE: LICENSE
================================================
YEAR: 2016-2024
COPYRIGHT HOLDER: Edzer Pebesma


================================================
FILE: NAMESPACE
================================================
# Generated by roxygen2: do not edit by hand

S3method("$",bbox)
S3method("$",crs)
S3method("$",m_range)
S3method("$",z_range)
S3method("$<-",sf)
S3method("[",sf)
S3method("[",sfc)
S3method("[<-",sf)
S3method("[<-",sfc)
S3method("[[<-",sf)
S3method("st_agr<-",sf)
S3method("st_crs<-",bbox)
S3method("st_crs<-",sf)
S3method("st_crs<-",sfc)
S3method("st_geometry<-",data.frame)
S3method("st_geometry<-",sf)
S3method(Ops,crs)
S3method(Ops,sfc)
S3method(Ops,sfg)
S3method(Ops,sgbp)
S3method(aggregate,sf)
S3method(as.data.frame,sf)
S3method(as.data.frame,sfc)
S3method(as.data.frame,sgbp)
S3method(as.matrix,sfg)
S3method(as.matrix,sgbp)
S3method(c,sfc)
S3method(c,sfg)
S3method(cbind,sf)
S3method(dim,sgbp)
S3method(duplicated,sf)
S3method(format,bbox)
S3method(format,crs)
S3method(format,sfc)
S3method(format,sfg)
S3method(head,sfg)
S3method(identify,sf)
S3method(identify,sfc)
S3method(is.na,bbox)
S3method(is.na,crs)
S3method(is.na,m_range)
S3method(is.na,z_range)
S3method(is_geometry_column,PqConnection)
S3method(is_geometry_column,default)
S3method(merge,sf)
S3method(plot,sf)
S3method(plot,sfc_CIRCULARSTRING)
S3method(plot,sfc_GEOMETRY)
S3method(plot,sfc_GEOMETRYCOLLECTION)
S3method(plot,sfc_LINESTRING)
S3method(plot,sfc_MULTILINESTRING)
S3method(plot,sfc_MULTIPOINT)
S3method(plot,sfc_MULTIPOLYGON)
S3method(plot,sfc_POINT)
S3method(plot,sfc_POLYGON)
S3method(plot,sfg)
S3method(points,sf)
S3method(points,sfc)
S3method(print,bbox)
S3method(print,crs)
S3method(print,m_range)
S3method(print,proj_pipelines)
S3method(print,sf)
S3method(print,sf_layers)
S3method(print,sfc)
S3method(print,sfg)
S3method(print,sgbp)
S3method(print,z_range)
S3method(rbind,sf)
S3method(rep,sfc)
S3method(st_agr,character)
S3method(st_agr,default)
S3method(st_agr,factor)
S3method(st_agr,sf)
S3method(st_area,sf)
S3method(st_area,sfc)
S3method(st_area,sfg)
S3method(st_as_binary,sfc)
S3method(st_as_binary,sfg)
S3method(st_as_grob,CIRCULARSTRING)
S3method(st_as_grob,COMPOUNDCURVE)
S3method(st_as_grob,CURVEPOLYGON)
S3method(st_as_grob,GEOMETRYCOLLECTION)
S3method(st_as_grob,LINESTRING)
S3method(st_as_grob,MULTILINESTRING)
S3method(st_as_grob,MULTIPOINT)
S3method(st_as_grob,MULTIPOLYGON)
S3method(st_as_grob,MULTISURFACE)
S3method(st_as_grob,POINT)
S3method(st_as_grob,POLYGON)
S3method(st_as_grob,sfc)
S3method(st_as_grob,sfc_CIRCULARSTRING)
S3method(st_as_grob,sfc_LINESTRING)
S3method(st_as_grob,sfc_MULTILINESTRING)
S3method(st_as_grob,sfc_MULTIPOINT)
S3method(st_as_grob,sfc_MULTIPOLYGON)
S3method(st_as_grob,sfc_POINT)
S3method(st_as_grob,sfc_POLYGON)
S3method(st_as_s2,sf)
S3method(st_as_s2,sfc)
S3method(st_as_sf,SpatVector)
S3method(st_as_sf,Spatial)
S3method(st_as_sf,data.frame)
S3method(st_as_sf,lpp)
S3method(st_as_sf,map)
S3method(st_as_sf,owin)
S3method(st_as_sf,ppp)
S3method(st_as_sf,ppplist)
S3method(st_as_sf,psp)
S3method(st_as_sf,s2_geography)
S3method(st_as_sf,sf)
S3method(st_as_sf,sfc)
S3method(st_as_sfc,SpatialLines)
S3method(st_as_sfc,SpatialMultiPoints)
S3method(st_as_sfc,SpatialPixels)
S3method(st_as_sfc,SpatialPoints)
S3method(st_as_sfc,SpatialPolygons)
S3method(st_as_sfc,WKB)
S3method(st_as_sfc,bbox)
S3method(st_as_sfc,blob)
S3method(st_as_sfc,character)
S3method(st_as_sfc,dimensions)
S3method(st_as_sfc,factor)
S3method(st_as_sfc,list)
S3method(st_as_sfc,map)
S3method(st_as_sfc,owin)
S3method(st_as_sfc,pq_geometry)
S3method(st_as_sfc,psp)
S3method(st_as_sfc,raw)
S3method(st_as_sfc,s2_geography)
S3method(st_as_sfc,sf)
S3method(st_as_sfc,tess)
S3method(st_as_text,crs)
S3method(st_as_text,sfc)
S3method(st_as_text,sfg)
S3method(st_bbox,CIRCULARSTRING)
S3method(st_bbox,COMPOUNDCURVE)
S3method(st_bbox,CURVEPOLYGON)
S3method(st_bbox,Extent)
S3method(st_bbox,GEOMETRYCOLLECTION)
S3method(st_bbox,LINESTRING)
S3method(st_bbox,MULTICURVE)
S3method(st_bbox,MULTILINESTRING)
S3method(st_bbox,MULTIPOINT)
S3method(st_bbox,MULTIPOLYGON)
S3method(st_bbox,MULTISURFACE)
S3method(st_bbox,POINT)
S3method(st_bbox,POLYGON)
S3method(st_bbox,POLYHEDRALSURFACE)
S3method(st_bbox,Raster)
S3method(st_bbox,SpatExtent)
S3method(st_bbox,SpatRaster)
S3method(st_bbox,SpatVector)
S3method(st_bbox,Spatial)
S3method(st_bbox,TIN)
S3method(st_bbox,TRIANGLE)
S3method(st_bbox,bbox)
S3method(st_bbox,numeric)
S3method(st_bbox,sf)
S3method(st_bbox,sfc)
S3method(st_boundary,sf)
S3method(st_boundary,sfc)
S3method(st_boundary,sfg)
S3method(st_break_antimeridian,sf)
S3method(st_break_antimeridian,sfc)
S3method(st_buffer,sf)
S3method(st_buffer,sfc)
S3method(st_buffer,sfg)
S3method(st_cast,CIRCULARSTRING)
S3method(st_cast,COMPOUNDCURVE)
S3method(st_cast,CURVE)
S3method(st_cast,GEOMETRYCOLLECTION)
S3method(st_cast,LINESTRING)
S3method(st_cast,MULTICURVE)
S3method(st_cast,MULTILINESTRING)
S3method(st_cast,MULTIPOINT)
S3method(st_cast,MULTIPOLYGON)
S3method(st_cast,MULTISURFACE)
S3method(st_cast,POINT)
S3method(st_cast,POLYGON)
S3method(st_cast,sf)
S3method(st_cast,sfc)
S3method(st_cast,sfc_CIRCULARSTRING)
S3method(st_centroid,sf)
S3method(st_centroid,sfc)
S3method(st_centroid,sfg)
S3method(st_collection_extract,sf)
S3method(st_collection_extract,sfc)
S3method(st_collection_extract,sfg)
S3method(st_concave_hull,sf)
S3method(st_concave_hull,sfc)
S3method(st_concave_hull,sfg)
S3method(st_convex_hull,sf)
S3method(st_convex_hull,sfc)
S3method(st_convex_hull,sfg)
S3method(st_coordinates,sf)
S3method(st_coordinates,sfc)
S3method(st_coordinates,sfg)
S3method(st_crop,sf)
S3method(st_crop,sfc)
S3method(st_crs,CRS)
S3method(st_crs,Raster)
S3method(st_crs,SpatRaster)
S3method(st_crs,SpatVector)
S3method(st_crs,Spatial)
S3method(st_crs,bbox)
S3method(st_crs,character)
S3method(st_crs,crs)
S3method(st_crs,default)
S3method(st_crs,numeric)
S3method(st_crs,sf)
S3method(st_crs,sfc)
S3method(st_difference,sf)
S3method(st_difference,sfc)
S3method(st_difference,sfg)
S3method(st_drop_geometry,default)
S3method(st_drop_geometry,sf)
S3method(st_exterior_ring,sf)
S3method(st_exterior_ring,sfc)
S3method(st_exterior_ring,sfg)
S3method(st_filter,sf)
S3method(st_geometry,sf)
S3method(st_geometry,sfc)
S3method(st_geometry,sfg)
S3method(st_inscribed_circle,sf)
S3method(st_inscribed_circle,sfc)
S3method(st_inscribed_circle,sfg)
S3method(st_interpolate_aw,sf)
S3method(st_intersection,sf)
S3method(st_intersection,sfc)
S3method(st_intersection,sfg)
S3method(st_intersects,sf)
S3method(st_intersects,sfc)
S3method(st_intersects,sfg)
S3method(st_is,sf)
S3method(st_is,sfc)
S3method(st_is,sfg)
S3method(st_is_full,bbox)
S3method(st_is_full,sf)
S3method(st_is_full,sfc)
S3method(st_is_full,sfg)
S3method(st_is_valid,sf)
S3method(st_is_valid,sfc)
S3method(st_is_valid,sfg)
S3method(st_join,sf)
S3method(st_line_merge,sf)
S3method(st_line_merge,sfc)
S3method(st_line_merge,sfg)
S3method(st_m_range,CIRCULARSTRING)
S3method(st_m_range,COMPOUNDCURVE)
S3method(st_m_range,CURVEPOLYGON)
S3method(st_m_range,GEOMETRYCOLLECTION)
S3method(st_m_range,LINESTRING)
S3method(st_m_range,MULTICURVE)
S3method(st_m_range,MULTILINESTRING)
S3method(st_m_range,MULTIPOINT)
S3method(st_m_range,MULTIPOLYGON)
S3method(st_m_range,MULTISURFACE)
S3method(st_m_range,POINT)
S3method(st_m_range,POLYGON)
S3method(st_m_range,POLYHEDRALSURFACE)
S3method(st_m_range,TIN)
S3method(st_m_range,TRIANGLE)
S3method(st_m_range,m_range)
S3method(st_m_range,numeric)
S3method(st_m_range,sf)
S3method(st_m_range,sfc)
S3method(st_make_valid,sf)
S3method(st_make_valid,sfc)
S3method(st_make_valid,sfg)
S3method(st_minimum_bounding_circle,sf)
S3method(st_minimum_bounding_circle,sfc)
S3method(st_minimum_bounding_circle,sfg)
S3method(st_minimum_rotated_rectangle,sf)
S3method(st_minimum_rotated_rectangle,sfc)
S3method(st_minimum_rotated_rectangle,sfg)
S3method(st_nearest_points,sf)
S3method(st_nearest_points,sfc)
S3method(st_nearest_points,sfg)
S3method(st_node,sf)
S3method(st_node,sfc)
S3method(st_node,sfg)
S3method(st_normalize,sf)
S3method(st_normalize,sfc)
S3method(st_normalize,sfg)
S3method(st_point_on_surface,sf)
S3method(st_point_on_surface,sfc)
S3method(st_point_on_surface,sfg)
S3method(st_polygonize,sf)
S3method(st_polygonize,sfc)
S3method(st_polygonize,sfg)
S3method(st_precision,sf)
S3method(st_precision,sfc)
S3method(st_read,DBIObject)
S3method(st_read,Pool)
S3method(st_read,PostgreSQLConnection)
S3method(st_read,character)
S3method(st_read,default)
S3method(st_reverse,sf)
S3method(st_reverse,sfc)
S3method(st_reverse,sfg)
S3method(st_sample,bbox)
S3method(st_sample,sf)
S3method(st_sample,sfc)
S3method(st_sample,sfg)
S3method(st_segmentize,sf)
S3method(st_segmentize,sfc)
S3method(st_segmentize,sfg)
S3method(st_set_precision,sf)
S3method(st_set_precision,sfc)
S3method(st_shift_longitude,sf)
S3method(st_shift_longitude,sfc)
S3method(st_simplify,sf)
S3method(st_simplify,sfc)
S3method(st_simplify,sfg)
S3method(st_snap,sf)
S3method(st_snap,sfc)
S3method(st_snap,sfg)
S3method(st_sym_difference,sf)
S3method(st_sym_difference,sfc)
S3method(st_sym_difference,sfg)
S3method(st_transform,bbox)
S3method(st_transform,sf)
S3method(st_transform,sfc)
S3method(st_transform,sfg)
S3method(st_triangulate,sf)
S3method(st_triangulate,sfc)
S3method(st_triangulate,sfg)
S3method(st_triangulate_constrained,sf)
S3method(st_triangulate_constrained,sfc)
S3method(st_triangulate_constrained,sfg)
S3method(st_union,sf)
S3method(st_union,sfc)
S3method(st_union,sfg)
S3method(st_voronoi,sf)
S3method(st_voronoi,sfc)
S3method(st_voronoi,sfg)
S3method(st_wrap_dateline,sf)
S3method(st_wrap_dateline,sfc)
S3method(st_wrap_dateline,sfg)
S3method(st_write,data.frame)
S3method(st_write,sf)
S3method(st_write,sfc)
S3method(st_z_range,CIRCULARSTRING)
S3method(st_z_range,COMPOUNDCURVE)
S3method(st_z_range,CURVEPOLYGON)
S3method(st_z_range,GEOMETRYCOLLECTION)
S3method(st_z_range,LINESTRING)
S3method(st_z_range,MULTICURVE)
S3method(st_z_range,MULTILINESTRING)
S3method(st_z_range,MULTIPOINT)
S3method(st_z_range,MULTIPOLYGON)
S3method(st_z_range,MULTISURFACE)
S3method(st_z_range,POINT)
S3method(st_z_range,POLYGON)
S3method(st_z_range,POLYHEDRALSURFACE)
S3method(st_z_range,TIN)
S3method(st_z_range,TRIANGLE)
S3method(st_z_range,numeric)
S3method(st_z_range,sf)
S3method(st_z_range,sfc)
S3method(st_z_range,z_range)
S3method(st_zm,list)
S3method(st_zm,matrix)
S3method(st_zm,sf)
S3method(st_zm,sfc)
S3method(st_zm,sfg)
S3method(str,sfc)
S3method(summary,sfc)
S3method(t,sgbp)
S3method(text,sf)
S3method(text,sfc)
S3method(transform,sf)
S3method(unique,sfc)
S3method(xtfrm,sfc)
export("st_agr<-")
export("st_crs<-")
export("st_geometry<-")
export("st_precision<-")
export(.degAxis)
export(.get_layout)
export(.image_scale)
export(.image_scale_factor)
export(.stop_geos)
export(FULL_bbox_)
export(NA_agr_)
export(NA_bbox_)
export(NA_crs_)
export(NA_m_range_)
export(NA_z_range_)
export(as_Spatial)
export(gdal_addo)
export(gdal_compressors)
export(gdal_create)
export(gdal_crs)
export(gdal_extract)
export(gdal_inv_geotransform)
export(gdal_metadata)
export(gdal_polygonize)
export(gdal_rasterize)
export(gdal_read)
export(gdal_read_mdim)
export(gdal_subdatasets)
export(gdal_utils)
export(gdal_write)
export(gdal_write_mdim)
export(get_key_pos)
export(plot_sf)
export(rawToHex)
export(read_sf)
export(sf.colors)
export(sf_add_proj_units)
export(sf_extSoftVersion)
export(sf_proj_info)
export(sf_proj_network)
export(sf_proj_pipelines)
export(sf_proj_search_paths)
export(sf_project)
export(sf_use_s2)
export(st_agr)
export(st_area)
export(st_as_binary)
export(st_as_grob)
export(st_as_s2)
export(st_as_sf)
export(st_as_sfc)
export(st_as_text)
export(st_axis_order)
export(st_bbox)
export(st_bind_cols)
export(st_boundary)
export(st_break_antimeridian)
export(st_buffer)
export(st_can_transform)
export(st_cast)
export(st_centroid)
export(st_collection_extract)
export(st_combine)
export(st_concave_hull)
export(st_contains)
export(st_contains_properly)
export(st_convex_hull)
export(st_coordinates)
export(st_covered_by)
export(st_covers)
export(st_crop)
export(st_crosses)
export(st_crs)
export(st_delete)
export(st_difference)
export(st_dimension)
export(st_disjoint)
export(st_distance)
export(st_drivers)
export(st_drop_geometry)
export(st_equals)
export(st_equals_exact)
export(st_exterior_ring)
export(st_filter)
export(st_geometry)
export(st_geometry_type)
export(st_geometrycollection)
export(st_graticule)
export(st_inscribed_circle)
export(st_interpolate_aw)
export(st_intersection)
export(st_intersects)
export(st_is)
export(st_is_empty)
export(st_is_full)
export(st_is_longlat)
export(st_is_simple)
export(st_is_valid)
export(st_is_within_distance)
export(st_jitter)
export(st_join)
export(st_layers)
export(st_length)
export(st_line_interpolate)
export(st_line_merge)
export(st_line_project)
export(st_line_sample)
export(st_linestring)
export(st_m_range)
export(st_make_grid)
export(st_make_valid)
export(st_minimum_bounding_circle)
export(st_minimum_rotated_rectangle)
export(st_multilinestring)
export(st_multipoint)
export(st_multipolygon)
export(st_nearest_feature)
export(st_nearest_points)
export(st_node)
export(st_normalize)
export(st_overlaps)
export(st_perimeter)
export(st_point)
export(st_point_on_surface)
export(st_polygon)
export(st_polygonize)
export(st_precision)
export(st_read)
export(st_read_db)
export(st_relate)
export(st_reverse)
export(st_sample)
export(st_segmentize)
export(st_set_agr)
export(st_set_crs)
export(st_set_geometry)
export(st_set_precision)
export(st_sf)
export(st_sfc)
export(st_shift_longitude)
export(st_simplify)
export(st_snap)
export(st_sym_difference)
export(st_touches)
export(st_transform)
export(st_triangulate)
export(st_triangulate_constrained)
export(st_union)
export(st_viewport)
export(st_voronoi)
export(st_within)
export(st_wrap_dateline)
export(st_write)
export(st_write_db)
export(st_z_range)
export(st_zm)
export(write_sf)
exportMethods(dbDataType)
exportMethods(dbWriteTable)
import(graphics)
importClassesFrom(DBI,DBIObject)
importFrom(DBI,dbConnect)
importFrom(DBI,dbDisconnect)
importFrom(DBI,dbExecute)
importFrom(DBI,dbGetQuery)
importFrom(DBI,dbReadTable)
importFrom(DBI,dbSendQuery)
importFrom(DBI,dbWriteTable)
importFrom(classInt,classIntervals)
importFrom(grDevices,cm)
importFrom(grDevices,dev.size)
importFrom(grDevices,rgb)
importFrom(grid,convertHeight)
importFrom(grid,convertUnit)
importFrom(grid,convertWidth)
importFrom(grid,current.viewport)
importFrom(grid,gList)
importFrom(grid,gpar)
importFrom(grid,linesGrob)
importFrom(grid,nullGrob)
importFrom(grid,pathGrob)
importFrom(grid,pointsGrob)
importFrom(grid,polylineGrob)
importFrom(grid,unit)
importFrom(grid,viewport)
importFrom(methods,"slot<-")
importFrom(methods,as)
importFrom(methods,new)
importFrom(methods,slot)
importFrom(methods,slotNames)
importFrom(stats,aggregate)
importFrom(stats,dist)
importFrom(stats,na.omit)
importFrom(stats,rbinom)
importFrom(stats,runif)
importFrom(stats,setNames)
importFrom(tools,file_ext)
importFrom(tools,file_path_sans_ext)
importFrom(units,as_units)
importFrom(units,drop_units)
importFrom(units,make_unit_label)
importFrom(units,set_units)
importFrom(utils,compareVersion)
importFrom(utils,globalVariables)
importFrom(utils,head)
importFrom(utils,object.size)
importFrom(utils,packageVersion)
importFrom(utils,str)
importFrom(utils,tail)
importMethodsFrom(DBI,dbDataType)
importMethodsFrom(DBI,dbExistsTable)
importMethodsFrom(DBI,dbWriteTable)
useDynLib(sf, .registration=TRUE)


================================================
FILE: NEWS.md
================================================
# version 1.1-1

* use RAII in functions calling GEOS for handling context, based on how terra does this; #2604

* `st_graticule()` simplifies output lines; #1364

* `dplyr::count()` drops geometries if `.drop_geom = TRUE` is set; #2596

* better handle graticules crossing the antemeridian; #2561

* add the option `by_element = TRUE` to binary geometry predicates, measures and transformers; #2594 and #2595 by @rariariari w. help from Claude

* add `MULTISURFACE` and `CURVEPOLYGON` to vctrs methods; #2589 #2601

* add argument `include_non_intersected` to `st_interpolate_aw()`

* add argument `weights`, for dasymetric mapping, to `st_interpolate_aw()` (experimental)

* replace magrittr pipe `%>%` with base pipe `|>`, and hence require R >= 4.1.0

# version 1.1-0

* `gdal_compressors()` queries GDAL compressor and decompressor capabilities

* `st_cast.sfc()` deals with zero-length objects; #2584

* rewrite/migrate `vctrs` methods for `sf` and `sfc`; #2568, #2584, w. help from @DavisVaughan

* `st_agr()` and `st_agr<-()` better handle multiple geometry columns

* for an `sfc` object `x`, `x[0]` retains the class of `x`; #2568

* When sampling a degenerate (zero length) line, a warning is raised rather than a message; #2575

# version 1.0-24

* `gdal_write()` handles drivers that only have a `CreateCopy()` option; https://github.com/r-spatial/stars/issues/762 

* if `datum` is missing in a call to `st_graticule()`, a graticule by default will try to use the geographic coordinate reference system of arguments `x` or `crs`; when nothing is found there it falls back to `OGC:CRS84` (WGS84).

* the figure margins parameter `mar` can be specified in a call to `plot.sf()`; #2558

* fix class label setting in `[.sf()`; #2557

# version 1.0-23

* allow tests reading blosc compressed Zarr files to fail

* `st_as_sf.data.frame()` sets `z_range` and `m_range` if needed; https://github.com/geoarrow/geoarrow-r/issues/75

# version 1.0-22

* `st_combine()` on `POINT` geometries ignores empty points; #2551

* handle empty points better in `st_point()`, `st_as_sf.data.frame()` and `st_distance()`; https://github.com/r-spatial/s2/issues/289

* for unprojected lines, `st_line_interpolate()` requires distance values with degree units; #2542

* `unique.sfc()` added; #2546

* for geodetic coordinates, `st_perimeter()` uses ellipsoidal computation if `sf_use_s2()` is `FALSE`; #2541

* `st_as_sf.owin()` and `st_as_sfc.owin()` no longer ignore `crs` argument; #2532

* clarify approximation errors in `st_buffer()` and how they differ for the GEOS or S2 backends, with examples by David Kaplan @dmkaplan2000; #2528

# version 1.0-21

* `st_crs(..., parameters = TRUE)` returns base geographic CRS as `gcs_crs`; #2524

* loading `sf` no longer initializes the RNG state; see https://github.com/r-quantities/units/issues/409

* fix `st_sample()` on geodetic coordinates; #2515

* use `compareVersion()` consistently to compare GDAL versions; #2512

# version 1.0-20

* `st_buffer()` on geodetic coordinates with negative buffer distance now automatically switches to using GEOS, while giving a warning; #1987

* `st_interpolate_aw()` fixes bug when a GEOMETRYCOLLECTION contains multiple POLYGON structures; found by @mtennekes

* `st_buffer()` for geodetic coordinates allows `max_dist` and `min_level` 
   to be specified by feature; #2488 and https://github.com/r-spatial/s2/pull/264

* `distinct.sf()` allows for comparing exact equality of geometries when `exact = TRUE`; #2484

* `st_minimum_bounding_circle()` returns geometries representing the smallest circle that contains the input; #2473

# version 1.0-19

* fix type checks in C++ GDAL area and length computation functions, anticipating GDAL 3.10.0; #2466, #2468, #2469 by @rsbivand and @rouault

* improve test on empty geometries, which changed in 1.0-18; #2463

* `gdal_utils()` `ogrinfo` has an argument `read_only` which, when `TRUE` (or `options` includes `"-ro"`), opens a datasource in read-only mode (#2460; `sf` did this before 1.0-17); by default a datasource is opened in update (read-write) mode (since sf 1.0-17; #2420)

* the `sf` -> `ppp` conversion `as.ppp.sf()` accepts a data.frame of marks instead of just 1 column #2450, by @agila5

* add flag for preservation of point order in `st_voronoi` #1371 for GEOS >= 3.12

# version 1.0-18

* support  `POLYGON FULL` simple feature geometry, representing the entire Earth surface, as used by `s2geometry`; see also https://r-spatial.org/r/2024/10/11/polygonfull.html for a longer introduction; #2441

* `st_sfc()` has an argument `oriented` which, when set to `TRUE`, adds an attribute `oriented=TRUE` to an `sfc` object, indicating that this object should not be reoriented in conversion to `s2_geography` (avoiding using the global option `s2_oriented`); `st_as_sfc.bbox()` sets this to `TRUE`; #2441

* fix build failure with GDAL < 3.4.0 #2436

* `st_simplify()` now accepts feature-wise tolerance values when `s2` is switched on #2442

# version 1.0-17

* add `st_transform()` method for `bbox` objects; this uses OGRCoordinateTransformation::TransformBounds(), densifying first and antemeridian proof; #2415

* `st_filter.sf()` correctly scopes `x` and `y` arguments using !! operator; #2416

* `[.sfc` and `[<-.sfc` use matrix/array type subsetting for `sfc` objects that have a `dim` attribute

* add `st_exterior_ring()` to extract exterior rings (remove holes); #2406

* add `text.sf()`, `text.sfc()`, `points.sf()`, `points.sfc()` to annotate base plots at geometry centroids; #2399

* `st_sf()` no longer strips `tbl` or `tbl_df` class labels; #2378

* `st_layers()` returns an object of class `c("sf_layers", "data.frame")`, with a dedicated `print` method.

* when `dim` is not `XYZM`, `sf_as_sf.data.frame()` interprets a length 4 `coords` argument to specify the corners of a rectangular polygon; #2357

* `st_interpolate_aw()` gains an `na.rm` argument, for removing features with `NA` attributes before interpolating; #830

* `merge.sf()` no longer renames geometry column; #2334

# version 1.0-16

* `st_join()` no longer renames the geometry column; #2327

* `st_sample()` works when unprojected polygon geometry crosses the antemeridian; #2331

* clean up and modernization of S3 registration of methods and tests; #2285, #2288, #2316, #2341, #2342, by @olivroy

* `[.sfc` works when setting argument `op`; #2320

* `st_sample()` for polygons is sensitive to setting `oriented = TRUE` to prevent wrongly correcting ring directions; #2308

* add support for the GDAL `footprint` utility (requiring GDAL >= 3.8.0) to `gdal_utils`; #2305, by @goergen95

* existing environment variables `PROJ_LIB` and `PROJ_DATA` are (again) ignored on `sf` binary CRAN installations (win + macos), effectively by overwriting them during the R session and restoring them on exit; this does not happen if environment variable `R_SF_USE_PROJ_DATA` is set to `true`. #2298

* add `st_line_project()` to find how far a point is when projected on a line; #2291

* add `st_line_interpolate()` to obtain a point at a certain distance along a line; #2291

# version 1.0-15

* add `st_perimeter()` generic to cover both geographic and projected coordinates; #268, #2279, by @JosiahParry

* add `st_sample()` method for `bbox`, with special provisions for ellipsoidal coordinates; #2283

* documentation clean-up by @olivroy; #2266, #2285

* `st_convex_hull()` uses `s2::s2_convex_hull()` for geodetic coordinates; #2250

* add `directed` argument to `st_line_merge()`; #2264

* `st_union.sfc()` given `x` and `y` works consistently across geodetic and projected objects; #2262

* `st_union.sf()` given `x` and `y` unions pairwise if `by_feature = TRUE`; #2259

* `st_read()` work around issue with GPKG driver if `wkt_filter` is set; #2248

* `st_read()` uses GDAL's stream reading when `use_stream = TRUE`; #2238 by @paleolimbot

* `st_transform()` responds to in-session changes to `sf_proj_network()`; #2166

* `plot.sf()`: `key.width` is sensitive to pointsize graphics parameter `par("ps")`; keys with factor levels suggest a proper size if they won't fit.

* `plot.sf()`: `key.pos` can hold a second value in [0, 1] determining the relative position of the key in the available space 

* `[<-.sf` fixes the `agr` attribute when it is broken; #2211

* if the env. variable `ADD_SF_NAMESPACE` is set to `true`, `sf` objects get a new attribute, `.sf_namespace`, which forces loading the `sf` namespace when it has not been loaded so far, e.g. for proper printing or plotting of an `sf` object; #2212 by Mike Mahoney

* `distinct.sf()` is type-safe for `sf` objects with zero rows; #2204

* `summarise.sf()` raises an error if `.by` is given but no `across()` on the geometry; #2207

* `st_write()` matches fields on name first, than on position; this matters for formats that have pre-defined names, such as GPX; #2202 

# version 1.0-14

* fix `plot.sf()` when using a key for multiple factor variables; #2196, #2195

* fix use of `as.numeric_version` in a test, for upcoming change in r-devel

* code tidy-ing: fix many lintr suggestions, thanks to Michael Chirico (#2181 - #2191)

# version 1.0-13

* `gdal_utils()` adds `"ogrinfo"` utility (requires GDAL >= 3.7.0); #2160

* `st_as_sf()` catches errors when setting invalid crs values, raised by Jon Skøien

* add `rename_with.sf()` method; #1472

* use GEOS' overlayNG routines for (GEOS) Intersection, Difference, Union and SymDifference; #2143

* added `duplicated.sf()`; #2138, #2140, thanks to @bart1

* `select.sf()` allows selecting the same column twice under different names; #1886

* `st_as_sf.ppplist()` is deprecated; #1926

* `st_cast()` handles empty geometries; #1961

* don't repeat longlat messages in `summarise.sf()`; #1519

* fix random sampling on the sphere; #2133

# version 1.0-12

* update NAMESPACE to `useDynLib(sf, .registration=TRUE)`; #2127 thanks to @eddelbuettel

* fix call in `gdal_addo()`; #2124

* fix issues that came up with older GDAL version, use `GDAL_VERSION_NUM` consistently; #2123 #2121 #2119

# version 1.0-11

* `st_make_grid()` also accepts area units for `cellsize`, for square and hexagonal grids; #1505

* add `st_concave_hull()`, for concave hulls, if GEOS >= 3.11.0; #1964

* add `st_triangulate_constrained()`, for constrained Delaunay triangulation, if GEOS >= 3.10.0; #1964

* clean up the retrieval of length or angle units from WKT representations; https://lists.osgeo.org/pipermail/gdal-dev/2023-March/056994.html

* conversion to GEOS uses the `GEOS_PREC_VALID_OUTPUT` flag, which makes sure that the "[o]utput is always valid. Collapsed geometry elements (including both polygons and lines) are removed."

# version 1.0-10

* `gdal_utils()` has a `config_options` argument to set further GDAL options, just like `st_write()`; #2003

* fix slow writing of logical vectors in `st_write()`; #1409; #1689

* `st_drivers()` has an argument `regex` to filter on driver (long) name; #2090

* drop C++11 as a system requirement

* `c.sfc()` (and, consequently, `dplyr::bind_rows()`) gives an error if components have different CRS; #1884

* data imported from `maps` are associated with the Clark 1866 ellipsoid; #2080

* fix importing legacy `SpatialPolygon` objects without comments; #2063, #2069, https://github.com/rstudio/leaflet/issues/833

* `st_read()` no longer errors on mixes of `XY` and `XYZ` geometries; #2046 #1592

* in `plot.sf()`, when numeric `breaks` are given a legend key is always plotted; #2065

* `st_crs()$axes` returns a `data.frame` with axes properties (name, orientation, conversion factor) when GDAL >= 3.0.0

* clean up unit handling for geometry measures (length, area, distance) and crs; 

* `st_crs(x)$ud_unit` returns `NULL` if units are unknown; #2049

* `st_write()` substitutes an `NA` crs with `ENGCRS["Undefined Cartesian SRS with unknown unit"]`; #2049, #2054

* `st_can_transform()` checks whether a transformation between two crs exists; see https://github.com/dieghernan/tidyterra/issues/64; #2049

* the matrix returned by `st_coordinates()` has no row names, to reduce output size

# version 1.0-9

* adjust for changes how R-devel handles `POSIXlt`; #2028

* add `st_break_antimeridian()`; #1983, #1991 by Roger Bivand

* add `Fibonacci` as a spatial sampling type in `st_sample()`

* use the global `options("sf_use_s2")` to determine whether to use s2, rather than a value in a local environment; #1977

* fix utils `mdiminfo` and `mdimtranslate` in `gdal_utils()` 

* extend arguments of `gdal_read_mdim()` needed by `stars::read_mdim()` if `stars` >= 0.5-7; add `gdal_write_mdim()`

* add `drop_na()` method for `sf` objects; #1975

# version 1.0-8

* `st_drop_geometry.default()` returns `x` unmodified;

* `sf_project()` accepts 3- or 4-column matrices, containing z and t values;

* optimization for `st_sfc()` by @paleolimbot; #1938, #1925

* `[<-.sfc()` recomputes the bounding box; `st_sfc()` gets parameter `compute_bbox`; #1965

* add new algorithm and drop option to `st_make_valid()` when using GEOS and GEOS >= 3.10.1; #1655

* add `st_minimum_rotated_rectangle()`, available when GEOS >= 3.9.0; #1953

* fix `st_sample()` with `type = "hexagonal"` for corner case (n=1), add a `progress` argument for a progress bar; #1945

* add package `pbapply` to Suggests; #1945

* add pdf driver to windows build; #1942

* clarify `pipeline` argument in `st_transform()` when axis order is ambiguous; #1934

* handle argument `xpd` in calls to `plot.sfc_POLYGON()` and `plot.sfc_MULTIPOLYGON()`

* add `pivot_wider()` method, by Henning Teickner; #1915

* add `gdal_addo()` to add or remove overviews from raster images; #1921

* `st_layers()` returns `crs` of each layer in a `crs` list of `crs` objects

* restore `st_graticule()` behaviour to pre-sf 1.0-0; https://github.com/tidyverse/ggplot2/issues/4571

* `gdal_metadata()` sets metadata item names properly

* `st_read()` gains an argument `optional` passed on to `as.data.frame` to avoid changing column names; #1916

* GPX files are autodetected by `st_read()`; #1917

* unnecessary coordinate names are not returned in `st_sample()`, making the output size smaller; #1879

# version 1.0-7

* `st_drop_geometry()` is a generic; #1914

* `st_crs(x)$ud_unit` returns the unit of the coordinate reference system of `x`

* geometric predicates return `sgbp` objects omitting self-intersections etc. by passing `remove_self = TRUE` and unique symmetric relationship by passing `retain_unique = TRUE` (to `...` if needed); this simplifies identifying (and removing) duplicated geometries; duplicates are identified by e.g. by `st_equals(x, retain_unique = TRUE) |> unlist() |> unique()`; #1893

* fix compile issue against GDAL < 2.5.0 introduced in 1.0-6; #1899

# version 1.0-6

* adapt to new `spatstat.random` package; #1892

* `st_geometry<-()` also allows to rename a geometry column in an `sf` object; #1890

* for `sf` objects, the `st_as_sfc()` method is an alias for `st_geometry()`; #1882

* `st_make_grid()` speeded up; #1579 thanks to Krzysztof Dyba

* remove direct and indirect dependencies on `rgeos` and `rgdal`; #1869

* use `stats::dist` rather than GEOS for symmetric point-point Euclidian distance computation; #1874

# version 1.0-5

* package startup message reports status of `sf_use_s2()`; #1782

* `sf_use_s2()` uses `message()` to report a change; #1782

* `st_sample()` using regular sampling for ellipsoidal coordinates "works" as if coordinates were Cartesian; #1837

# version 1.0-4

* new function `st_delete()` deletes a data source, or layer(s) within a data source; #1828

* fix memory leak in `WKT1_ESRI` retrieval; #1690

# version 1.0-3

* cope with how GEOS >= 3.10.0 handles illegal geometries (e.g., non-closed rings); #1807

* `crs` objects have a `$srid` method to extract the SRID (as authority "name:code"); #1804

* `st_as_grob()` methods for `sfc_*` objects correctly handle empty geometries; #1789 with help from Hiroaki Yutani

* when writing objects with `NA` as CRS to GeoPackage, assign "Unknown Cartesian CRS" first - this is in line with using Cartesian geometry operations for objects with `NA` as CRS; #1776

* add coerce method from `sgbp` to `sparseMatrix`; #1750

* fix `st_cast()` for `GEOMETRYCOLLECTIONS` containing empty geometries; #1767

* fix `st_is_valid()` for bogus polygons and projected coordinates; #1666, #1760; #1761

# version 1.0-2

* `st_read()` and `st_write()` using GDAL handle binary attributes (OFTBinary fields) ; #1721

* a `pivot_longer` method is added for `sf` objects (the `data.frame` method works, but raises a warning)

* `rbind.sf` preserves primary geometry column; #1717

* `configure` constrains using `--static` to `Darwin` platform; #1702, #1712, #1713

* old-style `crs` objects created with sf < 0.9-0 generate a message, and will cause a warning in the future.

* when `st_crs()` is called with a WKT2 as text input, its `input` field will be replaced with the CRS name (if it has one).

* GEOS (>= 3.9.0) operations use `GEOSGeom_setPrecision_r` to set precision of geometries; #1535

* `st_read()` with specified `query` ignores argument `layers`, and warns if it is given; #1444

# version 1.0-1

* fix regression in `st_intersection()`: when using s2 attributes were assigned wrongly; #1704

* `crs` (sf) to `CRS` (sp) conversion no longer needs validation by `rgdal`; https://github.com/edzer/sp/issues/107

* retrieve ESRI's WKT version of CRS by `st_crs(id)$WKT1_ESRI`; #1690 

# version 1.0-0

* add `s2` to Imports:

* add Dewey Dunnington to contributors

* `sf_use_s2()` prints a message when using s2 has been switched to on or off.

* use `s2` spherical geometry as default when coordinates are ellipsoidal. This can
  be switched off (defaulting to planar geometry, using GEOS, as in sf < 1.0-0) 
  by setting environment variable `_SF_USE_S2` to `false` before package `sf` 
  is loaded, or by `sf_use_s2(FALSE)`; #1649

* `st_nearest_feature()` with missing `y` returns nearest features in the remaining set of `x`; https://github.com/r-spatial/s2/issues/111

* `st_write()` gains an argument `config_options` to set GDAL config options; #1618

* fix regression in `sf_project(..., keep = TRUE)`; #1635

# version 0.9-8

* add `st_as_sf()` method for terra's `SpatVector` class; #1567

* `distinct.sf()` works by default on all variables, and keeps active geometry active; #1613

* improve (fix?) polygonize/contour code; #1608

* `sf_proj_network()` reports whether PROJ uses network (CDN) grids, can switch it on or off, and can set the CDN url.

* `st_write()` returns obj, invisibly; #1597

* fix regression in n-ary `st_intersection()`, #1595, introduced at #1549

* `st_inscribed_circle()` computes the maximum inscribed circle for polygons (requires GEOS >= 3.9.0)

* allow to `st_cast()` from COMPOUNDCURVE, MULTISURFACE or CURVEPOLYGON to GEOMETRYCOLLECTION, and back; #1573

* Fixed a bug in `st_as_grob()` when plotting a mix of MULTI and non-MULTI geometries of the same base type

# version 0.9-7

* n-ary `st_intersection()` skips failing geometries, rather than returning an error; #1549

* use `s2_centroid()` for geographical coordinates if `sf_use_s2()` is `TRUE`.

* `st_as_text()` method for `crs` objects can return projjson (if GDAL >= 3.1.0 and PROJ > 6.2.0)

* `st_transform()` no longer warns on conversions like `"+proj=ob_tran +o_proj=longlat +o_lat_p=45 +o_lon_p=30"`

* `st_as_wkb()` takes `srid` from `wkt` field of `crs` when `input` field doesn't contain it; #1490

* `plot.sf()` adds `key.pos=0` option to run the logic behind the key without plotting it; #1487

* fix bug in `select.sf()` when selected variables were renamed; #1483

* `st_as_sf.stars(..., merge = TRUE)` now works if CRS is `NA`; #1389

* add (dynamically loaded) `as_wkb()` methods for `sf`, `sfc` and `sfg`, making `st_as_s2()` unnecessary

* `st_as_s2()` transforms non-longlat objects to EPSG:4326 first

# version 0.9-6

* `gdal_utils()` print (GDAL-style) progress bar if `quiet = FALSE` (except for `info` and `mdiminfo`)

* fix `CPL_gdal_warper` for multi bands; https://github.com/r-spatial/stars/issues/320

* `sf_proj_search_paths()` retrieves and sets the proj search path (if GDAL > 3.0.3)

* when loading sf, `sf_use_s2()` is set to `FALSE` unless environment variable `_SF_USE_S2` equals `true` (this changes to `TRUE` in sf 1.0-0)

* resolve GDAL/PROJ version vulnerabilities in CRS-crs conversion; #1479

* `st_sample()` gains an argument, `by_polygon`, to more clevery sample `MULTIPOLYGON` geometries; #1480

* `st_sample()` accepts non-integer sample sizes, with a (suppressable) warning and handles values of sizes that would round to zero; #1480

* `gdal_utils()` adds utils `mdiminfo` and `mdimtranslate` (requires GDAL >= 3.1)

* `st_union()` gains an argument `is_coverage`, which, when set to `TRUE`, leads to much faster unioning in case features form a coverage (polygons don't overlap); #1462 by Don Baston

* fix `gdal_utils("translate")` locking input file; #1452

* `st_make_grid()` no longer selects cells intersecting with `x`; #1447

* use `s2::s2_dwithin_matrix()` in `st_is_within_distance()`; #1367

# version 0.9-5

* Only when package `s2` >= 1.0.1 is available: support for spherical geometry operators (predicates, transformers, measures, nearest point/feature) for geographic coordinates in package `s2` is now by default switched off, and can be switched on by `sf_use_s2(TRUE)`; see https://www.r-spatial.org/r/2020/06/17/s2.html and vignette sf7. It is planned to be switched on by default in sf 1.0-0.

* drop Z and/or M coordinate in `st_as_s2()`, with message

* geometry predicates and transformers gain an ... argument to pass `s2::s2_options()`

* `dplyr::select()` now ensures the geometry column sticks to the back rather than the front of the data frame; #1425

* `dplyr::rename()` now preserves the active geometry column even when it is renamed; #1431

* proj units query adjusted to PROJ 7.1.0 release; #1434

# version 0.9-4

* empty geom generators take care of XYZ etc dim; #1400

* `write_sf()` and `read_sf()` no longer warn when reading tables without geometries

* `st_write()` writes non-spatial tables when given a plain `data.frame` or `tbl_df`; #1345

* the default for `stringsAsFactors` in `st_read` and `st_sf` is `FALSE` for R version >= 4.1.0

* the sf method for `dplyr::select()` supports renaming the geometry column; #1415

# version 0.9-3

* `st_is_valid()` is a generic

* Windows CRAN binaries use GDAL 3.0.4, PROJ 6.3.1 and GEOS 3.8.0, thanks to Jeroen Ooms' rwinlib work; #1275

* `plot.sf()` gains an `extent` argument to set the extent (xlim, ylim) of the plot; `extent` must be an object with an `st_bbox()` method, such as an `sf` or a `stars` object; #1193

# version 0.9-2

* `st_axis_order(TRUE)` gives and error if GDAL has version < 2.5.0

* loading PROJ units `link`, `us_in`, `ind_yd`, `ind_ft`, and `ind_ch` into the udunits database is no longer done at package load time, but when function `sf_add_proj_units()` is called.

* fix line sampling for small densities; #1365

* `sf_project()` handles `crs` objects when PROJ version is below 6 using proj.4 string representations.

* avoid using `isFALSE` in `st_write()`; #1342

* fix regression in `gdal_utils("translate", ...)`; #1339

# version 0.9-1

* fix an invalid read bug in `st_m_range()`; #1332

* `st_crs(4326) == st_crs("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")` returns `TRUE` for GDAL >= 3.0, irrespective authority compliance of axis order; see #1331 and https://github.com/ropensci/scrubr/issues/34

* `sf_project()` has a parameter `authority_compliant` to return coordinates in "visualisation order"; when `TRUE` it returns coordinates in authority compliant axis order (e.g. EPSG:4326 latitude longitude); default is `st_axis_order()`.

* fix test for Solaris and certain GDAL/PROJ versions

* fix error reading category table through GDAL; https://github.com/r-spatial/stars/issues/245

# version 0.9-0

* see r-spatial blog post: https://www.r-spatial.org/r/2020/03/17/wkt.html

* modify `crs` objects to reflect our post-proj4string world (#1146; #1225): crs objects contain two fields, `input` with the user input (if any), and `wkt` with a well-known-text  (or WKT2) representation of the coordinate reference system. `crs` objects have a `$` method to dynamically retrieve the `epsg` (integer) or `proj4string` representation, using e.g. `x$epsg`.

* support for PostGIS 3 using WKT and the new-style `crs` objects; #1234, #1303, #1308 by @etiennebr

* `st_write_db()` and `st_read_db()` are defunct. Use `st_write` and `st_read` instead.

* `st_write()` uses `append`, replacing (and deprecating) argument `update`; `st_write` fails when a layer already exists and `append` has not been set explicitly to `TRUE` (append) or `FALSE` (overwrite); #1266

* `st_proj_info()` was renamed into `sf_proj_info`; `sf_proj_info` can get and set the PROJ data search path and use of CDN; #1277

* adapt to new `dplyr` version; https://github.com/tidyverse/dplyr/issues/4917

* `st_sample()` is a generic

* write `stars` rasters with wkt info, rather than proj4strings

* when GEOS >= 3.8.0, `st_make_valid` is provided by `sf` rather than by `lwgeom` #989

* allow for single-sided buffers for linear geometries; #1001

* add `st_reverse()` methods to reverse points in a linestring (requires GEOS >= 3.7.0); #1246

* `st_make_grid()` returns grid cells or points that intersect with the target geometry, not its bounding box; #1260

* allow for PROJ >= 7; #1254

* `st_geometry_type()` accepts `by_geometry` argument; #1264

# version 0.8-1

* `st_as_sf.map()` no longer requires `maptools` and `sp`; dropped dependency on maptools.

* work around a bug in 6.0.0 <= PROJ < 6.3.1: replace `+init=epsg:XXXX ...` strings with the `XXXX` EPSG integer, to work around a bug in PROJ; see https://github.com/OSGeo/PROJ/pull/1875 and links therein. If `...` arguments are present, raise a warning that these are ignored. 

* `st_as_sf.map()` no longer requires `maptools` and `sp`; drop dependency on maptools.

* conversion between `spatstat` classes `owin`, `ppp` and `psp` and `sf` classes no longer use `maptools`; #1204

* `gdal_utils()` processes open options `-oo` and `-doo` properly; https://github.com/ITSLeeds/geofabric/issues/12

* `st_sample()` directly interfaces `spatstat` sampling methods, e.g. `type = "Thomas"` calls `spatstat::rThomas` after converting input arguments (window) and converts returned `ppp` object to `sf`'s `POINT` geometries; #1204 with help from Ege Rubak and Jakub Nowosad

* `sf_project()` gains an option `keep = TRUE` to return `Inf` values for points not projectable; #1228

* support `vctrs` methods for geometry list columns; this makes `unnest` work again (#1172); #1196 by Lionel Henry

* `st_as_sf.pq_geometry()` converts binary geom columns from RPostgres::dbGetQuery; #1195

* `st_cast()` can convert `MULTICURVE` to `MULTILINESTRING`; #1194

* `st_read()` gains a parameter `wkt_filter` for spatially filtering the features to be read; #1192

* `st_area()` and `st_length()` handle `+to_meter` argument in PROJ strings; #1170

* add `st_filter()` generic for filtering on spatial features only; #1148

* a new UBSAN error in `wkb_read()` was resolved; #1154, #1152

* new method `st_shift_longitude()` to re-center data for a Pacific view. #1218

* output of `st_as_text()` with `MULTIPOINT` has nested parentheses around points. E.g., `MULTIPOINT ((0 0), (1 1))` instead of `MULTIPOINT (0 0, 1 1)`; #1219, #1221

# version 0.8-0

* fix tests for PROJ 6.2.0 not accepting +units=

* fixes for tidyr 1.0-0 release; attempt to port `nest.sf()` and `unnest.sf()`; #1068, #1145

* `gdal_utils()` better closes connections after use; #1143

* `st_write()` gains a `drivers` options, to limit the drivers attempted; #1142

* rather than replacing, `st_write()` and `write_sf()` append to an existing layer if `update=TRUE`; #1126

* improve plotting of `POSIXct` and `Date` attributes (`Date` requiring classInt >= 0.4-2)

* `NULL` geometries read by GDAL are returned as empty geometries; #1119

* `gdal_utils('rasterize', ...)` accepts non-existing destinations, defined by e.g. resolution and extent options (see #1116 for an example), and overwrites if needed (see #1136 for an example)

* add Dan Baston as contributor; #1120 and many others

* in addition to `NULL`, `st_sfc()` also converts `NA` values into empty geometries; #1114.

* `st_join()` is a generic

# version 0.7-7

* `plot()` handles `POSIXct` values in legend

* constructor functions like `st_linestring()` check and break on `NA` coordinates; #1101, #1102

# version 0.7-6

* have examples of `st_write` write only to the temporary R session directory

# version 0.7-5

* `as(x, "Spatial")` gives a proper error message on empty geometries; #1093

* `st_cast()` takes care of empty polygons; #1094

* `st_nearest_*` functions warn in case they are used with geographic coordinates; #1081

* `st_union()` no longer segfaults on zero row `sf` objects; #1077

* `st_transform()` no longer breaks on zero row `sf` objects; #1075

* when PROJ >= 6.1.0 is available and sf comes with datum files (as is the case with statically linked Windows and OSX CRAN binaries), `PROJ_LIB` is no longer temporarily overwritten, but the PROJ C api is used to set the datum path; #1074, suggested by Jeroen Ooms

* sf compiles against GDAL 3.x and PROJ 6.1.0, using the new `proj.h` interface; #1070

* `st_distance()` returns `NA` for empty geometries, rather than 0; #1055

# version 0.7-4

* add example on how voronoi polygons can be tied back to the points they contain; #1030

* `st_difference(x, y)`, with `x` an `sfc` with zero feature geometries, returns `x`; #1024

* don't reset (base) plot device when `add = TRUE`

* `==` and `!=` return `NA` when one of the operands is an empty geometry; #1013

* `st_intersects()` is a generic

* drop requiring `proj_api.h` in favor of `proj.h`, this enables compatibility to PROJ 6.0.0 and GDAL 2.5.0-dev; #988

* fix regression in binary predicates introduced in #855; #999 reported by Barry Rowlingson

* fix bug in `gdal_utils` util `warper` on certain GDAL/OS combinations; https://github.com/r-spatial/stars/issues/117

* `c.sfc()` ignores the type (class) of empty `sfc` objects when choosing the result type; #985, #982

* rename the default value for `distance` to `"Euclidean"`, rather than  `"distance"` in `st_distance()`

# version 0.7-3

* add argument `exact` to `st_sample()`, defaulting to `FALSE`; #896

* fixed n-ary `st_difference()` for cases where geometries are entirely contained in others; #975, by Jonathan Marshall

* faster `Ops.sfc()`, added `st_normalize()`; #973 by Thomas Lin Pedersen

* new grob constructor for sfc objects; #971 by Thomas Lin Pedersen; add Thomas as contributor

* add `group_split()` and `group_map()` methods for `sf` objects (experimental); #969

* make `st_interpolate_aw()` a generic;

* argument `col` for `plot` of `GEOMETRY` `sfc`'s is `NA` (open) for (multi) polygon geometries

# version 0.7-2

* feature IDs are no longer returned as names on the geometry list column, but optionally returned by `st_read` as attribute column; #812

* when plotting multiple attributes, plot.sf adds a (single, common) key if `key.pos` is set

* precision can be specified in distance units; #901

* support log-scale in color legend by setting `logz` to `TRUE` in `plot.sf`

* `st_intersects()` etc. will prepare `y` when `y` is polygons and `x` is points; #885 by Dan Baston

* `st_write()` (and `write_sf()`) returns its first argument, invisibly; #889

# version 0.7-1

* fix bug that broke n-ary `st_intersection()` on platforms using clang; #867

# version 0.7-0

* adds several interfaces to GDAL functions, meant to be used by package `stars`

* `st_read()` receives a `query` argument that can run queries against OGR datasets; #834, by Barry Rowlingson and Michael Sumner

* `read_sf()` no longer first creates tibbles from `data.frame`s, but creates them directly; #853, db propagation by Etienne Racine

* check difference between compile-time and run-time GEOS versions; #844

* all GEOS routines are (more) robust against memory leaks, by using unique pointers; #822, #845, by Dan Baston

* `st_buffer()` receives the buffer styles `endCapStyle`, `joinStyle` and `mitreLimit`; #833, #842 by Michael Sumner

# version 0.6-4

* `st_area()` is a generic; https://github.com/r-spatial/stars/issues/32

* `st_write()` resolves `~` correctly; #456

* read and write feature IDs as sfc list column names; #812

* `st_centroid()` works for empty geometries, returning an empty point #769

* add `st_nearest_points()`, to obtain the (`LINESTRING` connecting the) two nearest points for pairs of geometries; #788

* add hexagonal tiling to `st_make_grid()`

* add regular and hexagonal sampling to `st_sample()`

* fixes for PROJ 5.0.1; #545

* fixes for GDAL 2.3.0; #759

* `st_sample()` supports regular sampling of `LINESTRING`; #725 by @statnmap 

* Support reading and writing of database `Pool` objects; #756

* fix plotting of `sf` objects without attributes; #755

* add reference to the [R Journal article](https://journal.r-project.org/articles/RJ-2018-009/index.html) in CITATION

# version 0.6-3

* move dependency `RPostgreSQL` from Imports: back to Suggests:

* `st_centroid.sf()` and `st_point_on_surface.sf` also warn if attributes are not constant over geometries.

* `summarise()` allows the user to define geometries for summaries; #714, by Kirill Mueller

* `plot.sf()` emits a warning if `col` does not have length 1 or `nrow(x)`, and requires `pal` (rather than `col`) to set a palette for factors.

* `plot.sf()` provides control over legend keys using `key.length` and `key.width`, decrease default key length; #731

* `sgbp` objects receive an `as.data.frame` method; #715

# version 0.6-2

* GDAL read/write supports logical variables; #722

* add `st_crop()` to simplify cropping objects with a rectangular area; #720

* fix bug in `[<-` when columns are added to an `sf` object; #718

* use dynamic registration of S3 methods, similar to how hms does this; #710 by Kirill Mueller

* (partially) address writing GPKG to network drive, writing to temp file first; #628

* add Kirill Mueller as contributor

* `st_make_grid()` is faster; #708, by Dan Baston

* `st_read()` and `st_write()` are generic, with methods for directly reading from and writing to database connections; `st_read_db` and `st_write_db` are deprecated; #558, thanks to Etienne Racine @etiennebr

* Package `RPostgreSQL` moved from Suggests to Imports

* restore compatibility with GDAL 2.0.x versions (which won't have `gdal_utils`); #686

* `read_sf()` can also read tables without geometry; #684, by Andy Teucher

# version 0.6-1

* method `distinct()` works; #669, #672

* `+`, `-`, `*` and `/` for pairs of geometries (`sfg`, `sfc`) return geometric union, difference, intersection and symmetric difference, respectively.

* `st_cast()` from `MULTIPOLYGON` to `MULTILINESTRING` should work properly; #660

* all Rcpp interfaces needed by package `stars` have been moved into `sf`; pkg `stars` is R-only, and only `sf` needs linking to GDAL.

* `gdal_utils()` interfaces the 9 gdal utils using the C++ API

* improve resetting (base) plots; add `reset = FALSE` in a call to `plot` to enable adding to plots that have a legend

* `st_read()` returns a `data.frame` when a table contains no geometries, rather than giving an error; it does emit a warning in this case. See https://stat.ethz.ch/pipermail/r-sig-geo/2018-February/026344.html

* move `pillar` from `Imports:` to `Suggests:`

* update to the new rwinlib distribution of gdal (adds JPG2000); #639

* speed up computation of centroids for largest polygon; #623

* add `st_as_sfc.raw` method

* Bugfix: binary operations (`st_intersection`, `st_difference`, etc) no longer fail when operating on data frames of class `"tbl_df"` with common column names; #644

# version 0.6-0

* add `pillar` to Imports: to provide method for printing WKT geometries in tibbles

* `st_as_text`, and subsequently `format` and `print`, use argument `digits` (or `options(digits = n)`) to control the number of digits used for printing coordinates; default is `options("digits")`, which is typically 7.

* `st_is_within_distance` works with geographic coordinates

* `st_cast` from `MULTIPOLYGON` to `MULTILINESTRING` no longer changes the number of features/feature geometries, but conversion from `MULTIPOLYGON` to `LINESTRING` (typically) does; #596

* `st_distance` for long/lat geographic coordinates uses `lwgeom`, accepting all geometry types; argument `dist_fun` is deprecated as a consequence, and distance calculations are different from those in sf versions 0.5-5 or earlier; #593

* add package `lwgeom` to Suggests; `st_area`, `st_length`, `st_distance`, `st_segmentize` for long/lat CRS use package `lwgeom` instead of `geosphere`; #593

* `st_length` returns zero for polygon-type geometries; #593

* if present, add units of attribute to default plot title; #591

* add `unnest` method, which depends on `tidyr` > 0.7-2; #570 PR by @karldw

* add `largest` option to `st_join` to get largest intersection match only; #547, by @tiernanmartin

* change default maximum number of feature to print to 10, controllable by `options(sf_max_print)`; #556

* add `Hausdorff` (and `Frechet` for those with GEOS 3.7.0) as options to `st_distance`; add `par` for densified versions

* add `st_snap`, for snapping geometries to other geometries, within a tolerance

* make `st_wrap_dateline` a generic, with methods for `sf`, `sfc` and `sfg`; #541

* `plot.sf` and `st_as_grob` (used by ggplot2) are robust against misspecified ring directions (holes that have the same direction as the exterior rings), by using `rule = "evenodd"`; #540

* functions depending on `liblwgeom` (`st_make_valid`, `st_geohash`, `st_plit`) have been moved to their own package, https://github.com/r-spatial/lwgeom; argument `use_gdal` of `st_transform` has been deprecated, instead one can use `lwgeom::st_transform_proj`; sf no longer tries to link to liblwgeom; #509, #537, #487

* `st_read`, `st_sf` and `st_sfc` gain a parameter `check_ring_dir` (default: `FALSE`) that checks ring directions and corrects to: exterior counter clockwise, holes clockwise, when seen from above.

* get rid of `classInt::classIntervals` warning if number of unique values is smaller than the number of breaks asked for

# version 0.5-5

* have `classInt` in Imports:, to not break other package checks

* add vignettes 5: plotting sf objects and 6: miscellaneous; #324

* add (default) color key to `plot.sf` if single map is plotted, contributed by @hughjonesd; #528 

* `st_as_sfc` can read EWKT; #530

* argument `max.plot` takes its default from `options(sf_max.plot=n)`, if present; #516

* `plot.sf` gets an arguments `pal` to specify a color palette function; #526

* `plot.sf` gets arguments `breaks` and `nbreaks`; add support for `classInt::classIntervals` styles for finding class intervals (using `breaks`)

* add `st_as_sf` methods for `ppp`, `lpp` and `psp` objects from spatstat.

* allow for direct route to proj.4 ignoring GDAL (requiring liblwgeom); #509, #511

* add `print` method for `crs` objects; #517

* `sf_extSoftVersion` reveals whether GDAL was linked to GEOS; #510

* better check input of `st_polygon`; #514

* add `st_node`, similar to `rgeos::gNode`

* support for reading `OFTInteger64List` fields; #508

* sparse geometric binary predicate lists have a class, `sgbp`, and attributes `region.id` and `predicate`; #234, #524

* prevent `st_split` from stopping the R session; #492

* `st_intersection`, `st_union` and so on also print a message when used directly on long/lat coordinates; #496

* add `rep` method for `sfc` objects

* comparing two `crs` objects uses the GDAL function `IsSame`; #180

* add `st_collection_extract`, which, given an object with geometries of type `GEOMETRY` or `GEOMETRYCOLLECTION`, returns an object consisting only of elements of the specified type; by Andy Teucher, #482

* `st_write` exports GeoJSON with UTF-8 encoding on Windows; #444

* move package methods from Imports: to Depends: ; #478

* deal better with precision setting and propagation; #476

* fix bug in `st_layers` in case layers have no geometry; #334

* clarify argument `envelope` in `st_voronoi`; #474

* change aggregate to make it return the same geometry as 'by', padding attributes with NA where needed; #453 

# version 0.5-4

* fix compatibility problems introduced by `tidyr` 0.7-0 using rlang magic

* convert path names to UTF-8 in `st_read`, `st_write` and `st_layers`; #471

* `st_sfc` converts `NULL` values into empty geometries, and correctly identifies empty `POINT`s; #466, #463

* `st_write` abbreviates column names if driver is `ESRI Shapefile`; #464

* add `of_largest_polygon` argument to `st_centroid`, to get the centroid of the largest polygon; #450

* fix use of `st_relate` as join predicate for `st_join`; #454

* fix bug where `st_intersects` with empty second argument would crash; #458

* produce better WKT; #463

* fix bug in `st_cast.sf`; #461, #462

* change `st_read` SRS assignment logic; corrects reading projected geojson with gdal 2.2.0; #449

* `st_intersection` etc. on `tbl` also return `tbl`; #448

* `[.sf` preserves class, e.g. of `tbl`; #448

# version 0.5-3

* support and propagate all Proj.4 +units=xx length units; #446

* allow for arith ops on empty `sfc` objects

* have `st_graticule` return an empty graticule object when argument `datum` is `NA`; 

* export `as_Spatial`, to make it easier for packages to convert `sfc` objects without importing `sf`

* `st_distance` gains a parameter `by_element` to obtain pairwise distances; #437

* add the ability to `aggregate` using a simple feature `by` argument; #429

* make the `op` argument to `[.sf` work

* speed up `st_coordinates` for `POINT` geometries; #433

* fix performance regression for `st_bbox`; #418

* correct bug in `st_union`, `st_difference` and `st_sym_difference` introduced in 0.5-2; #431

* inform gdal about the CRS always through the proj4string, never through the epsg; see #424

* properly deal with kilometre units; #424 (fixed by Karl Dunkle Werner)

* add `st_is_within_distance`, only to return a sparse index matrix; #419

* have `st_graticule` work with world2 (0,360); #421, #422, fixed by Ben Best

* `st_graticule` to return graticules in native crs; https://github.com/tidyverse/ggplot2/issues/2200 (WIP)

* `st_graticule` to support data in `NA_crs_`; https://github.com/tidyverse/ggplot2/issues/2199

* fix bug when joining an sf-tibble with a `tibble`; #414

* read gdal `StringList`, `RealList`, and `IntegerList` fields into a list-column; #416

# version 0.5-2

* made ready for rwinlib/gdal2; #408

* make `[.sf` for selections including `NA` values like `x[c(1,NA,2)]`; #403

* add a `[<-` method for `sfc` objects; automatically replaces `NULL` with an empty geometry; #411

* add `st_point_on_surface()` to return a point that is guaranteed to be on the surface (standard compliance)

* `read_sf` returns an sf-tibble, an object of class `c("sf", "tbl_df", "tbl", "data.frame")`

* work around for `dplyr::filter` not dispatching geometry column subsetting to `sf::[.sfc`

* allow `units` object as `dist` argument to `st_buffer`; these must be convertable to `arc_degree` for geographic, and to a length unit for non-geographic data; #399

* prevent gdal from crashing when trying to `st_transform` an empty geometry; #398

* add `st_as_sfc` method for `bbox`, returning the bbox polygon; #377

* strip file name extension from default layer name in `st_write`; #392

* have `st_sf` replace `NULL` values in an `sfc` list-column with the appropriate empty geometry; #372

* allow setting `ndiscr` through `ggplot2::coords_sf` to improve graticule plotting in `geom_sf`; #396

# version 0.5-1

* add spatial indexes to most binary geometry operations; #394 and http://r-spatial.org/r/2017/06/22/spatial-index.html

* drastically reduce memory footprint of `st_intersection` and similar; #394

* support RSQLite 2.0 by providing an `st_as_sfc` method for list columns of class `blob`

* drop dependency on dbplyr

# version 0.5-0

* better handle empty/NULL geometries in shapefiles; #351

* add `unite_.sf` method

* deprecate `FUN` argument to `st_join`; #376

* improve graticule tic label placement in `ggplot2`; #375 and https://github.com/tidyverse/ggplot2/issues/2119

* improve `configure` logic to deal with libraries installed in custom locations; #335

* fix bug where `geom_sf` wouldn't deal with Z and/or M geoms; #373

* return more conveniently typed empty geoms; #372 

* fix subsetting with `[` of `sf` using `drop = TRUE`, #370

* in addition to `m`, allow `rad` units to `st_segmentize` 

* add example how to `st_read` GeoJSON from a string; #185

* add `separate_.sf` method

* add `st_split` to split geometries (only available if compiled against liblwgeom), #359

* fix bug reading and writing dates (months 1 off): #358

* [.sf and [.sfc also select on i when i is an `sfg` object, and accept a geometric predicate function with optional arguments; #352

* on reading through GDAL, empty (NULL) geometries no longer result in an error; on creation, they no longer automatically give a `GEOMETRY` object; #351

* on plotting with `ggplot2::geom_sf`, empty geometries no longer break; grid functions return `nullGrob()` for them; #351

* arith operations on empty geometries no longer break or give warnings; #351

* have `st_as_sf.data.frame` by default break on `NA` values in coordinates; #342

* have `st_join` accept further arguments, to be passed on to the `join` function (e.g. a pattern for `st_relate`)

* have WKB reader throw an error on (some) malformed inputs, and check for buffer bounds

# version 0.4-3

* back-port `do_union` argument to dplyr <= 0.5.0, using lazyeval

* all strings returned from OGR/GDAL get encoding set to `UTF-8`, making them work on non-UTF-8 platforms; #5

* `$.crs` retrieves proj4string components, such as `st_crs(4326)$datum` in addition to `epsg` and `proj4string`

* let `st_geohash` return geohash for (average) points (only when sf was linked to liblwgeom)

# version 0.4-2

* `summarise.sf` always returns an `sf` object, also for global (non-grouped) summaries.

* `summarise.sf` gains an argument `do_union` which determines whether to union the geometries for which a summary is given, or to `st_combine` them (not resolving boundaries); #331

* rename argument `union` of `aggregate.sf` into `do_union`, for consistency with `summarise`; #331

* add a `nest_` method for `sf` objects

* `st_relate` gets a `pattern` parameter, same as `rgeos::gRelate`; add examples to get rook and queen neighbour lists using this; #234

* support for direct reading of spatialite and sqlite geometry wkb blobs

* build proper support for `cbind` and `rbind` methods for `sf`, which work (as documented) when _all_ arguments are of class `sf`; `dplyr::bind_cols` or `st_sf(data.frame(sf, df))` work for binding `data.frame`s to an `sf` object.

* `st_segmentize()` and `st_line_sample()` accept units arguments

* document problem reading shapefiles from USB drives on OSX; #252

* improve docs of `st_is_valid` and `st_make_valid`; #296

* coercing `sf` to `data.frame` works better; #298

* `st_line_sample` gains argument `sample` to specify the points t.b. sampled; #299 #300 thanks to @joethorley

* add compatibility to upcoming dplyr 0.6.0; #304 #42

* write GDAL fields by name, not by number, fixing a KML problem #308

* `st_write` gains arguments `delete_layer` and `delete_dsn` to allow overwrite capability #307 #274

* `write_sf` defaults to `delete_layer=TRUE`, silently overwriting layers if they're already present

* compatibility with GDAL 2.2beta0; #303; #309

* replace `st_write_db` with a version that is fast for large datasets (#285), thanks to Josh London

* take out more memory leaking examples in tests

* the `aggregate` method for `sf` objects assumes the `by` argument to be identical to that of `stats::aggregate`

* `st_wrap_dateline` wraps (cuts up) geometries crossing the antimeridian, such that they no longer cross it.

# version 0.4-1

* restore 3.3.0 and c++11 requirement

* `st_read` respects time that is read as UTC

* `st_write` writes time always as UTC, since GDAL does not have a mechanism to define local timezones other than "unknown" or "local"

* `st_length` works for POINT and MULTIPOINT (returning 0); POLYGON and MULTIPOLYGON are converted to MULTILINESTRING before computing length, thus giving polygon perimeter (#268)

* `st_write` has `update` depend on driver; for databases, the default is `TRUE`, otherwise `FALSE` (it refers to update of the database, and not to overwriting the table in the database, this will by default not succeed); #274

* `st_read` supports reading objects with multiple geometry columns #257 #255

* support writing (exporting) objects with non-standard columns, such as `units` or `POSIXlt` #264

* catch dependencies on GEOS 3.3.5 (hence no 0.4-0 CRAN binary for MacOSX) #260

# version 0.4-0

* have `st_is_valid` catch corrupt geometries too, returning `NA` in that case (requiring GEOS 3.5.0)

* add `st_make_valid`, only available when sf was linked to `liblwgeom`

* add `st_coordinates` method, returning coordinates matrix with indexes

* remove `unlist.sfg` 

* add `as.matrix.sfg`; have as.matrix.sfg add indexes to coordinates

* add `st_bind_cols` method

* improve handling features that can't be projected 

* support uniform sampling over polygons on the sphere

* add `st_sample`, for sampling points on multipoints, linestrings, or polygons

* add `c` method for `sfc` objects

* import and export `magrittr::%>%`

* support ggplot'ing geometrycollections

* drop C++11 requirement, allowing build for older R versions

* add `st_proj_info`, modelled after `rgdal::projInfo`

* overwriting datasets with `st_write()` is no longer allowed; `update=TRUE` appends to them, permitted the driver supports appending.

* `st_write` gains an argument, `update`, which when `TRUE` will try to append to existing datasets (#204)

* added list of corresponding function for migration from sp, rgdal and rgeos to sf at https://github.com/edzer/sfr/wiki/migrating

* remove deprecated `st_list`

* rename `st_makegrid` to `st_make_grid`, and `st_linemerge` to `st_line_merge`
* add NEWS.md file (#207)

* faster conversion of `data.frame` into `POINT` `sf` object, using `st_as_sf` (Michael Sumner)

* `rbind` method for `sf` objects keeps coordinate reference system

# version 0.3-4, Feb 6, 2017

* add `st_contains_properly` spatial predicate

* GEOS functions (geometry operations) accept XYZ geometries (and ignore Z)

* make `prepared = TRUE` the default for all geometry binary operations

# version 0.3-2, Feb 4, 2017

* add user interrupt checks in all GEOS geometry operations

* make `st_graticule` do something useful for polar projections

* make `st_graticule` return `NA` labels when labels are useless

* add `merge.sf` methods to merge `sf` object and `data.frame` (#193)

* add `st_join` for table joins based on (user-defined) spatial predicates

* add `dplyr`-style non-spatial joins for `sf` objects (`left_join`, `full_join` etc.) (#193)

* allow for multiple non-gathered variables (#196)

* add missing meridian to `st_graticule` (#198)

# version 0.3-1, Jan 31, 2017

* add `merge` method (#193)

* `st_graticule` for laea (#198)

* allow `st_buffer` with feature-dependent buffer distance (#197)

* have `spread` return an `sf` object (#196)

* clarify `overwrite = TRUE` in write docs

* fix `st_as_sf.map` (#194)

* add `prepared` arg to spatial binary predicates, to speed up large intersections

* add `st_voronoi` interface (requires that lib GEOS >= 3.5.0)

* add `st_as_sf` methods for `map` objects (library maps)

* add RStudio project file

* have `st_bbox` return a `bbox` object which has an `st_crs` method

* rename `st_drop_zm` into `st_zm`, for general more handling of Z and M

* allow for 3D coordinates returned, when `+proj=geocent` (#172; #103)

* fix `NA_integer_` handling in shapefiles I/O (#184)

* add and fix `st_agr` API, to set and get attribute-to-geometry relationships

# version 0.2-8, Jan 5, 2017



================================================
FILE: PROPOSAL.md
================================================
# Simple Features for R

Applicant: [Edzer Pebesma](https://github.com/edzer/), [Institute for Geoinformatics](https://www.uni-muenster.de/Geoinformatics/en/), University of Muenster, Germany; [edzer.pebesma@uni-muenster.de](mailto:edzer.pebesma@uni-muenster.de)

Supporting authors: Edzer Pebesma, Roger Bivand, Michael Sumner, Robert Hijmans, Virgilio Gómez-Rubio

[Simple features](https://en.wikipedia.org/wiki/Simple_Features) is an open ([OGC](https://www.ogc.org/standard/sfa/) and [ISO](https://www.iso.org/standard/40114.html)) interface standard for access and manipulation of spatial vector data (points, lines, polygons). It includes a standard [SQL schema](http://www.opengeospatial.org/standards/sfs) that supports storage, retrieval, query and update of feature collections via a SQL interface. All commonly used databases provide this interface. [GeoJSON](https://geojson.org/) is a standard for encoding simple features in JSON, and is used in JavaScript and MongoDB. Well-known-text ([WKT](https://en.wikipedia.org/wiki/Well-known_text)) is a text representation of simple features used often in linked data; well-known-binary ([WKB] (https://en.wikipedia.org/wiki/Well-known_text)) a standard binary representation used in databases. _Simple Feature Access_ defines coordinate reference systems, and makes it easy to move data from longitude-latitude to projections back and forth in a standardized way. 


[GDAL](https://gdal.org/) is an open source C++ library for reading and writing both raster and vector data with more than 225 drivers (supported file formats, data base connectors, web service interfaces). GDAL is used by practically all open source geospatial projects and by many industry products (including ESRI's ArcGIS, ERDAS, and FME). It provides coordinate transformations (built on top of PROJ.4) and geometric operations (e.g. polygon intersections, unions, buffers and distance). Standards for coordinate transformations change over time; such changes are typically adopted directly in GDAL/PROJ.4 but do not easily find their way into R-only packages such as `mapproj`.

Since [2005](https://stat.ethz.ch/pipermail/r-sig-geo/2005-April/000378.html), CRAN has package [sp](https://cran.r-project.org/package=sp) which provides classes and methods for spatial (point, line, polygon and raster) data. The approach `sp` takes is similar to how `xts` and `zoo` handle the time index of time series data: objects store spatial geometries separately from associated attribute data, matching by order. Package [spacetime](https://cran.r-project.org/package=spacetime), on CRAN since 2010, extends both `sp` and `xts` to handle data that varies over both space and time.

Today, 221 CRAN packages depend on, import or link to `sp`, 259 when including _Suggests_; when including recursive dependencies these numbers are 376 and 5040. The implementation of `sp` does not follow simple features, but rather the practice used at the time of release, following how ESRI shapefiles are implemented. The cluster of packages around `sp` is shown in Andrie de Vries' [blog on CRAN's network structure](https://blog.revolutionanalytics.com/2015/07/the-network-structure-of-cran.html) in green.

Off-CRAN package [rgdal2](https://github.com/thk686/rgdal2) is an interface to GDAL 2.0, which uses raw pointers to interface features, but does not import any data in R, using GDAL to handle everything. CRAN Package [wkb](https://cran.r-project.org/package=wkb), contributed by Tibco Software, converts between WKB representations of several simple feature classes and corresponding classes in `sp`, and seems to be needed for Tibco software purposes.

<!---
[second edition](http://www.springer.com/statistics/life+sciences%2C+medicine+%26+health/book/978-1-4614-7617-7))
-->

## The problem

The problems we will solve are:

1. R can currently not represent simple features directly. It can read most simple feature classes in `sp` classes, but uses its own representation for this, and can only write data back without loss of information if it is furnished with ancilliary metadata encoded in a comment attribute to each Polygons object. It does for instance internally not distinguish between `POLYGON` and `MULTIPOLYGON`  nor deal with several simple feature classes, including `TIN` and `GEOMETRYCOLLECTION`, nor handle `CURVE` geometries.
2. The current implementation of lines and vector data in package `sp` is partly ambiguous (both slot `ringDir` or slot `hole` indicate whether a Polygon is a hole but are superceded by the comment attribute), complicated (to which exterior polygon does a hole belong - handled by the comment attribute), and by some considered difficult to work with (S4). The current implementation is hard to maintain because it contains incremental changes from a baseline that predated the industry-standard OGC/ISO ([Simple Feature Interface Specification](https://www.ogc.org/standard/sfa/)).
3. The lack of support for simple features makes current interfaces to open source libraries (GDAL/OGR and PROJ.4: rgdal, GEOS: rgeos) difficult to understand and maintain, even though they work to specification.
4. The current implementation has no [scale model](https://libgeos.org/doxygen/classgeos_1_1geom_1_1PrecisionModel.html#details) for coordinates.
5. It is desirable that other R packages are offered the opportunity to migrate to more up-to-date libraries for coordinate transformations (providing proper support for datum transformation), and to avoid having to make simplifying assumptions (e.g., all spatial data come as longitude/latitude using datum `WGS84`; all web maps use [_web Mercator_](https://en.wikipedia.org/wiki/Web_Mercator)).

Which users will benefit from solving these problems?  It will mainly affect those who use data bases or modern javascript-based web APIs which largely converged on adopting simple features (such as [CartoDB](https://cartodb.com/)), as well as those who need a simpler and more light-weight handling of spatial data in R. It will also reduce the effort for users and developers to understand the way spatial information is represented in R, making it easier to build upon and reuse the R code for this, and lead to a good, sustainable shared R code base.

In the longer run it will affect users of all packages currently reusing `sp` classes, when we manage to migrate `sp` to exclusively use the simple feature classes for representing vector data. Since the recent [2.0](https://gdal.org/index.html) release of GDAL integrates raster and vector data, having an R package that mirrors its classes makes it possible to implement operations in-database (similar to what `DBI`, `RPostgreSQL` and `dplyr` do), making it possible for R to manipulate spatial data that do not fit in memory.

Big Data analysis with R often proceeds by connecting R to a database that holds the data. All commonly used commercial and open source databases store spatial point, line and polygon data in the form of simple features. Representing simple features in R will simplify big data analysis for spatial data.

## The plan

We want to solve the problem by carrying out the following steps (M1 refers to month 1):

1. develop an R package that implements simple features in R, that is simple yet gives users access to the complete data, and includes an S3 representation that extends `data.frame` (M1-3)
2. add to this package a C++ interface to GDAL 2.0, to read and write simple feature data, and to interface other functionality (coordinate transformation, geometry operations) (M3-8)
3. develop and prototypically implement a migration path for sp to become compliant with simple features (M7-12)
4. write user-oriented tutorial vignettes showing how to use it with files, data base connections, web API's, leaflet, ggmap, dplyr and so on (M7-10)
5. write a tutorial vignette for R package writers reusing the package (M10)
6. Collect and process community feed back (M6-12).

Failure modes and recovery plan:

1. Failure mode: S3 classes are too simple to represent simple
features class hierarchy. Recovery plan: try (i) using a list column
with geometry, and nested lists to represent nested structures; (ii) 
use a `WKT` character column; (iii) using a `WKB` blob column

2. Migrating `sp` breaks downstream packages. Recovery plan: involve
Roger Bivand, Barry Rowlingson, Robert Hijmans (`raster`)
and Tim Keitt (`rgdal`/`rgdal2`) how to proceed; be patient and
smooth out problems together with package maintainers.

## How can the ISC help

The following table contains the cost items.

| Item | Cost |
| ---- | ---- |
| employ a student assistant for one year (10 hrs/week) | &euro; 6500  |
| one week visit of Roger Bivand to the Inst. for Geoinformatics | &euro; 1000 |
| present the results at UseR! 2016 | &euro; 1500 |
| Total: | &euro; 9000 (9750 USD) |

The visit of Roger is anticipated halfway the project; further communications will use skype. The project has a planned duration of 12 months.

## Dissemination

Development will take place on github, information will be shared and reactions and contributions invited through [r-sig-geo](https://stat.ethz.ch/mailman/listinfo/r-sig-geo), as well as [StackOverflow](https://stackoverflow.com/) and [GIS StackExchange](https://gis.stackexchange.com/). The project will use an Apache 2.0 license for maximum dissemination (similar to GDAL, which uses X/MIT). The work will be published in 4 blogs (quarterly), announced on r-sig-geo (3300 subscribers), and intermediary results will be presented at [UseR! 2016](https://www.r-project.org/conferences/useR-2016/). The final result will be published in a paper either submitted to [The R Journal](https://journal.r-project.org/) or to the [Journal of Statistical Software](https://www.jstatsoft.org/index); this paper will be available before publication as a package vignette.

## UseR! slides

UseR! 2016 slides are found [here](https://pebesma.staff.ifgi.de/pebesma_sfr.pdf).


================================================
FILE: R/RcppExports.R
================================================
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

CPL_get_bbox <- function(sf, depth = 0L) {
    .Call(`_sf_CPL_get_bbox`, sf, depth)
}

CPL_gdal_init <- function() {
    invisible(.Call(`_sf_CPL_gdal_init`))
}

CPL_gdal_cleanup_all <- function() {
    invisible(.Call(`_sf_CPL_gdal_cleanup_all`))
}

CPL_gdal_version <- function(what = "RELEASE_NAME") {
    .Call(`_sf_CPL_gdal_version`, what)
}

CPL_crs_parameters <- function(crs) {
    .Call(`_sf_CPL_crs_parameters`, crs)
}

CPL_crs_equivalent <- function(crs1, crs2) {
    .Call(`_sf_CPL_crs_equivalent`, crs1, crs2)
}

CPL_crs_from_input <- function(input) {
    .Call(`_sf_CPL_crs_from_input`, input)
}

CPL_roundtrip <- function(sfc) {
    .Call(`_sf_CPL_roundtrip`, sfc)
}

CPL_circularstring_to_linestring <- function(sfc) {
    .Call(`_sf_CPL_circularstring_to_linestring`, sfc)
}

CPL_multisurface_to_multipolygon <- function(sfc) {
    .Call(`_sf_CPL_multisurface_to_multipolygon`, sfc)
}

CPL_compoundcurve_to_linear <- function(sfc) {
    .Call(`_sf_CPL_compoundcurve_to_linear`, sfc)
}

CPL_curve_to_linestring <- function(sfc) {
    .Call(`_sf_CPL_curve_to_linestring`, sfc)
}

CPL_can_transform <- function(src, dst) {
    .Call(`_sf_CPL_can_transform`, src, dst)
}

CPL_transform <- function(sfc, crs, AOI, pipeline, reverse = FALSE, desired_accuracy = -1.0, allow_ballpark = TRUE) {
    .Call(`_sf_CPL_transform`, sfc, crs, AOI, pipeline, reverse, desired_accuracy, allow_ballpark)
}

CPL_transform_bounds <- function(bb, crs_dst, densify_pts = 21L) {
    .Call(`_sf_CPL_transform_bounds`, bb, crs_dst, densify_pts)
}

CPL_wrap_dateline <- function(sfc, opt, quiet = TRUE) {
    .Call(`_sf_CPL_wrap_dateline`, sfc, opt, quiet)
}

CPL_get_gdal_drivers <- function(dummy) {
    .Call(`_sf_CPL_get_gdal_drivers`, dummy)
}

CPL_sfc_from_wkt <- function(wkt) {
    .Call(`_sf_CPL_sfc_from_wkt`, wkt)
}

CPL_gdal_with_geos <- function() {
    .Call(`_sf_CPL_gdal_with_geos`)
}

CPL_axis_order_authority_compliant <- function(authority_compliant) {
    .Call(`_sf_CPL_axis_order_authority_compliant`, authority_compliant)
}

CPL_compressors <- function() {
    .Call(`_sf_CPL_compressors`)
}

CPL_area <- function(sfc) {
    .Call(`_sf_CPL_area`, sfc)
}

CPL_gdal_dimension <- function(sfc, NA_if_empty = TRUE) {
    .Call(`_sf_CPL_gdal_dimension`, sfc, NA_if_empty)
}

CPL_length <- function(sfc) {
    .Call(`_sf_CPL_length`, sfc)
}

CPL_gdal_segmentize <- function(sfc, dfMaxLength = 0.0) {
    .Call(`_sf_CPL_gdal_segmentize`, sfc, dfMaxLength)
}

CPL_gdal_linestring_sample <- function(sfc, distLst) {
    .Call(`_sf_CPL_gdal_linestring_sample`, sfc, distLst)
}

CPL_get_layers <- function(datasource, options, do_count = FALSE) {
    .Call(`_sf_CPL_get_layers`, datasource, options, do_count)
}

CPL_read_ogr <- function(datasource, layer, query, options, quiet, toTypeUser, fid_column_name, drivers, wkt_filter, promote_to_multi = TRUE, int64_as_string = FALSE, dsn_exists = TRUE, dsn_isdb = FALSE, width = 80L) {
    .Call(`_sf_CPL_read_ogr`, datasource, layer, query, options, quiet, toTypeUser, fid_column_name, drivers, wkt_filter, promote_to_multi, int64_as_string, dsn_exists, dsn_isdb, width)
}

CPL_read_gdal_stream <- function(stream_xptr, datasource, layer, query, options, quiet, drivers, wkt_filter, dsn_exists, dsn_isdb, fid_column, width) {
    .Call(`_sf_CPL_read_gdal_stream`, stream_xptr, datasource, layer, query, options, quiet, drivers, wkt_filter, dsn_exists, dsn_isdb, fid_column, width)
}

CPL_gdalinfo <- function(obj, options, oo, co) {
    .Call(`_sf_CPL_gdalinfo`, obj, options, oo, co)
}

CPL_ogrinfo <- function(obj, options, oo, co, read_only = FALSE) {
    .Call(`_sf_CPL_ogrinfo`, obj, options, oo, co, read_only)
}

CPL_gdaladdo <- function(obj, method, overviews, bands, oo, co, clean = FALSE, read_only = FALSE) {
    .Call(`_sf_CPL_gdaladdo`, obj, method, overviews, bands, oo, co, clean, read_only)
}

CPL_gdalwarp <- function(src, dst, options, oo, doo, co, quiet = TRUE, overwrite = FALSE) {
    .Call(`_sf_CPL_gdalwarp`, src, dst, options, oo, doo, co, quiet, overwrite)
}

CPL_gdalrasterize <- function(src, dst, options, oo, doo, co, overwrite = FALSE, quiet = TRUE) {
    .Call(`_sf_CPL_gdalrasterize`, src, dst, options, oo, doo, co, overwrite, quiet)
}

CPL_gdaltranslate <- function(src, dst, options, oo, co, quiet = TRUE) {
    .Call(`_sf_CPL_gdaltranslate`, src, dst, options, oo, co, quiet)
}

CPL_gdalfootprint <- function(src, dst, options, oo, co, quiet = TRUE) {
    .Call(`_sf_CPL_gdalfootprint`, src, dst, options, oo, co, quiet)
}

CPL_gdalvectortranslate <- function(src, dst, options, oo, doo, co, quiet = TRUE) {
    .Call(`_sf_CPL_gdalvectortranslate`, src, dst, options, oo, doo, co, quiet)
}

CPL_gdalbuildvrt <- function(src, dst, options, oo, co, quiet = TRUE) {
    .Call(`_sf_CPL_gdalbuildvrt`, src, dst, options, oo, co, quiet)
}

CPL_gdaldemprocessing <- function(src, dst, options, processing, colorfilename, oo, co, quiet = TRUE) {
    .Call(`_sf_CPL_gdaldemprocessing`, src, dst, options, processing, colorfilename, oo, co, quiet)
}

CPL_gdalnearblack <- function(src, dst, options, oo, doo, co, quiet = TRUE) {
    .Call(`_sf_CPL_gdalnearblack`, src, dst, options, oo, doo, co, quiet)
}

CPL_gdalgrid <- function(src, dst, options, oo, co, quiet = TRUE) {
    .Call(`_sf_CPL_gdalgrid`, src, dst, options, oo, co, quiet)
}

CPL_gdalmdiminfo <- function(obj, options, oo, co) {
    .Call(`_sf_CPL_gdalmdiminfo`, obj, options, oo, co)
}

CPL_gdalmdimtranslate <- function(src, dst, options, oo, co, quiet = TRUE) {
    .Call(`_sf_CPL_gdalmdimtranslate`, src, dst, options, oo, co, quiet)
}

CPL_gdal_warper <- function(infile, outfile, options, oo, doo, co, quiet = TRUE) {
    .Call(`_sf_CPL_gdal_warper`, infile, outfile, options, oo, doo, co, quiet)
}

CPL_write_ogr <- function(obj, dsn, layer, driver, dco, lco, geom, dim, fids, ConfigOptions, quiet, append, delete_dsn = FALSE, delete_layer = FALSE, write_geometries = TRUE, width = 80L) {
    .Call(`_sf_CPL_write_ogr`, obj, dsn, layer, driver, dco, lco, geom, dim, fids, ConfigOptions, quiet, append, delete_dsn, delete_layer, write_geometries, width)
}

CPL_delete_ogr <- function(dsn, layer, driver, quiet = TRUE) {
    .Call(`_sf_CPL_delete_ogr`, dsn, layer, driver, quiet)
}

CPL_geos_binop <- function(sfc0, sfc1, op, par = 0.0, pattern = "", prepared = FALSE) {
    .Call(`_sf_CPL_geos_binop`, sfc0, sfc1, op, par, pattern, prepared)
}

CPL_geos_binop_by_element <- function(sfc0, sfc1, op, par, pattern, prepared) {
    .Call(`_sf_CPL_geos_binop_by_element`, sfc0, sfc1, op, par, pattern, prepared)
}

CPL_geos_is_valid_reason <- function(sfc) {
    .Call(`_sf_CPL_geos_is_valid_reason`, sfc)
}

CPL_geos_make_valid <- function(sfc, method, keep_collapsed) {
    .Call(`_sf_CPL_geos_make_valid`, sfc, method, keep_collapsed)
}

CPL_geos_is_valid <- function(sfc, NA_on_exception = TRUE) {
    .Call(`_sf_CPL_geos_is_valid`, sfc, NA_on_exception)
}

CPL_geos_is_simple <- function(sfc) {
    .Call(`_sf_CPL_geos_is_simple`, sfc)
}

CPL_geos_is_empty <- function(sfc) {
    .Call(`_sf_CPL_geos_is_empty`, sfc)
}

CPL_geos_normalize <- function(sfc) {
    .Call(`_sf_CPL_geos_normalize`, sfc)
}

CPL_geos_union <- function(sfc, by_feature = FALSE, is_coverage = FALSE) {
    .Call(`_sf_CPL_geos_union`, sfc, by_feature, is_coverage)
}

CPL_geos_snap <- function(sfc0, sfc1, tolerance) {
    .Call(`_sf_CPL_geos_snap`, sfc0, sfc1, tolerance)
}

CPL_geos_op <- function(op, sfc, bufferDist, nQuadSegs, dTolerance, preserveTopology, bOnlyEdges = 1L, endCapStyle = 0L, joinStyle = 0L, mitreLimit = 1L, singleside = 0L) {
    .Call(`_sf_CPL_geos_op`, op, sfc, bufferDist, nQuadSegs, dTolerance, preserveTopology, bOnlyEdges, endCapStyle, joinStyle, mitreLimit, singleside)
}

CPL_geos_voronoi <- function(sfc, env, dTolerance = 0.0, bOnlyEdges = 1L) {
    .Call(`_sf_CPL_geos_voronoi`, sfc, env, dTolerance, bOnlyEdges)
}

CPL_geos_op2 <- function(op, sfcx, sfcy) {
    .Call(`_sf_CPL_geos_op2`, op, sfcx, sfcy)
}

CPL_geos_dist_by_element <- function(sfc0, sfc1, which, par) {
    .Call(`_sf_CPL_geos_dist_by_element`, sfc0, sfc1, which, par)
}

CPL_geos_version <- function(runtime = FALSE, capi = FALSE) {
    .Call(`_sf_CPL_geos_version`, runtime, capi)
}

CPL_geos_op2_by_element <- function(op, sfcx, sfcy) {
    .Call(`_sf_CPL_geos_op2_by_element`, op, sfcx, sfcy)
}

CPL_geos_dist <- function(sfc0, sfc1, which, par) {
    .Call(`_sf_CPL_geos_dist`, sfc0, sfc1, which, par)
}

CPL_geos_nearest_feature <- function(sfc0, sfc1) {
    .Call(`_sf_CPL_geos_nearest_feature`, sfc0, sfc1)
}

CPL_geos_nearest_points <- function(sfc0, sfc1, pairwise) {
    .Call(`_sf_CPL_geos_nearest_points`, sfc0, sfc1, pairwise)
}

CPL_transpose_sparse_incidence <- function(m, n) {
    .Call(`_sf_CPL_transpose_sparse_incidence`, m, n)
}

CPL_nary_difference <- function(sfc) {
    .Call(`_sf_CPL_nary_difference`, sfc)
}

CPL_nary_intersection <- function(sfc) {
    .Call(`_sf_CPL_nary_intersection`, sfc)
}

CPL_line_project <- function(lines, points, normalized) {
    .Call(`_sf_CPL_line_project`, lines, points, normalized)
}

CPL_line_interpolate <- function(lines, dists, normalized) {
    .Call(`_sf_CPL_line_interpolate`, lines, dists, normalized)
}

CPL_hex_to_raw <- function(cx) {
    .Call(`_sf_CPL_hex_to_raw`, cx)
}

CPL_raw_to_hex <- function(raw) {
    .Call(`_sf_CPL_raw_to_hex`, raw)
}

CPL_read_mdim <- function(file, array_names, oo, offset, count, step, proxy = FALSE, debug = FALSE) {
    .Call(`_sf_CPL_read_mdim`, file, array_names, oo, offset, count, step, proxy, debug)
}

CPL_write_mdim <- function(name, driver, dimensions, variables, wkt, xy, RootGroupOptions, CreationOptions, as_float = TRUE) {
    .Call(`_sf_CPL_write_mdim`, name, driver, dimensions, variables, wkt, xy, RootGroupOptions, CreationOptions, as_float)
}

opp_sfc <- function(geom, value, mult, crs) {
    .Call(`_sf_opp_sfc`, geom, value, mult, crs)
}

normalize_sfc <- function(geom, min, range, crs) {
    .Call(`_sf_normalize_sfc`, geom, min, range, crs)
}

CPL_polygonize <- function(raster, mask_name, raster_driver, vector_driver, vector_dsn, options, iPixValField, contour_options, use_contours = FALSE, use_integer = TRUE) {
    .Call(`_sf_CPL_polygonize`, raster, mask_name, raster_driver, vector_driver, vector_dsn, options, iPixValField, contour_options, use_contours, use_integer)
}

CPL_rasterize <- function(raster, raster_driver, sfc, values, options, NA_value) {
    .Call(`_sf_CPL_rasterize`, raster, raster_driver, sfc, values, options, NA_value)
}

CPL_proj_h <- function(b = FALSE) {
    .Call(`_sf_CPL_proj_h`, b)
}

CPL_get_pipelines <- function(crs, authority, AOI, Use, grid_availability, accuracy = -1.0, strict_containment = FALSE, axis_order_auth_compl = FALSE) {
    .Call(`_sf_CPL_get_pipelines`, crs, authority, AOI, Use, grid_availability, accuracy, strict_containment, axis_order_auth_compl)
}

CPL_get_data_dir <- function(from_proj = FALSE) {
    .Call(`_sf_CPL_get_data_dir`, from_proj)
}

CPL_is_network_enabled <- function(b = FALSE) {
    .Call(`_sf_CPL_is_network_enabled`, b)
}

CPL_enable_network <- function(url, enable = TRUE) {
    .Call(`_sf_CPL_enable_network`, url, enable)
}

CPL_set_data_dir <- function(data_dir, with_proj) {
    .Call(`_sf_CPL_set_data_dir`, data_dir, with_proj)
}

CPL_use_proj4_init_rules <- function(v) {
    .Call(`_sf_CPL_use_proj4_init_rules`, v)
}

CPL_proj_version <- function(b = FALSE) {
    .Call(`_sf_CPL_proj_version`, b)
}

CPL_proj_is_valid <- function(proj4string) {
    .Call(`_sf_CPL_proj_is_valid`, proj4string)
}

CPL_have_datum_files <- function(foo) {
    .Call(`_sf_CPL_have_datum_files`, foo)
}

CPL_proj_direct <- function(from_to, pts, keep, warn = TRUE, authority_compliant = FALSE) {
    .Call(`_sf_CPL_proj_direct`, from_to, pts, keep, warn, authority_compliant)
}

CPL_proj_info <- function(type) {
    .Call(`_sf_CPL_proj_info`, type)
}

CPL_xy2sfc <- function(cc, dim, to_points, which, cc_has_NAs) {
    .Call(`_sf_CPL_xy2sfc`, cc, dim, to_points, which, cc_has_NAs)
}

sfc_is_null <- function(sfc) {
    .Call(`_sf_sfc_is_null`, sfc)
}

sfc_unique_sfg_dims_and_types <- function(sfc) {
    .Call(`_sf_sfc_unique_sfg_dims_and_types`, sfc)
}

sfc_is_empty <- function(sfc) {
    .Call(`_sf_sfc_is_empty`, sfc)
}

sfc_is_full <- function(sfc) {
    .Call(`_sf_sfc_is_full`, sfc)
}

points_cpp <- function(pts, gdim = "XY") {
    .Call(`_sf_points_cpp`, pts, gdim)
}

CPL_signed_area <- function(pts) {
    .Call(`_sf_CPL_signed_area`, pts)
}

CPL_get_metadata <- function(obj, domain_item, options) {
    .Call(`_sf_CPL_get_metadata`, obj, domain_item, options)
}

CPL_get_crs <- function(obj, options) {
    .Call(`_sf_CPL_get_crs`, obj, options)
}

CPL_inv_geotransform <- function(gt_r) {
    .Call(`_sf_CPL_inv_geotransform`, gt_r)
}

CPL_read_gdal <- function(fname, options, driver, read_data, NA_value, RasterIO_parameters, max_cells) {
    .Call(`_sf_CPL_read_gdal`, fname, options, driver, read_data, NA_value, RasterIO_parameters, max_cells)
}

CPL_write_gdal <- function(x, fname, driver, options, Type, dims, from, gt, p4s, na_val, scale_offset, create = TRUE, only_create = FALSE) {
    invisible(.Call(`_sf_CPL_write_gdal`, x, fname, driver, options, Type, dims, from, gt, p4s, na_val, scale_offset, create, only_create))
}

CPL_extract <- function(input, xy, interpolate) {
    .Call(`_sf_CPL_extract`, input, xy, interpolate)
}

CPL_create <- function(file, nxy, value, wkt, xlim, ylim) {
    invisible(.Call(`_sf_CPL_create`, file, nxy, value, wkt, xlim, ylim))
}

CPL_read_wkb <- function(wkb_list, EWKB = FALSE, spatialite = FALSE) {
    .Call(`_sf_CPL_read_wkb`, wkb_list, EWKB, spatialite)
}

CPL_write_wkb <- function(sfc, EWKB = FALSE) {
    .Call(`_sf_CPL_write_wkb`, sfc, EWKB)
}

CPL_get_z_range <- function(sf, depth) {
    .Call(`_sf_CPL_get_z_range`, sf, depth)
}

CPL_get_m_range <- function(sf, depth) {
    .Call(`_sf_CPL_get_m_range`, sf, depth)
}

# Register entry points for exported C++ functions
methods::setLoadAction(function(ns) {
    .Call(`_sf_RcppExport_registerCCallable`)
})


================================================
FILE: R/aggregate.R
================================================
#' aggregate an \code{sf} object
#'
#' aggregate an \code{sf} object, possibly union-ing geometries
#' 
#' @note Does not work using the formula notation involving \code{~} defined in \link[stats]{aggregate}.
#' 
#' @param x object of class \link{sf}
#' @param by either a list of grouping vectors with length equal to \code{nrow(x)} (see \link[stats]{aggregate}), or an object of class \code{sf} or \code{sfc} with geometries that are used to generate groupings, using the binary predicate specified by the argument \code{join}
#' @param FUN function passed on to \link[stats]{aggregate}, in case \code{ids} was specified and attributes need to be grouped
#' @param ... arguments passed on to \code{FUN}
#' @param do_union logical; should grouped geometries be unioned using \link{st_union}? See details.
#' @param simplify logical; see \link[stats]{aggregate}
#' @param join logical spatial predicate function to use if \code{by} is a simple features object or geometry; see \link{st_join}
#' @return an \code{sf} object with aggregated attributes and geometries; additional grouping variables having the names of \code{names(ids)} or are named \code{Group.i} for \code{ids[[i]]}; see \link[stats]{aggregate}.
#' @details In case \code{do_union} is \code{FALSE}, \code{aggregate} will simply combine geometries using \link{c.sfg}. When polygons sharing a boundary are combined, this leads to geometries that are invalid; see \url{https://github.com/r-spatial/sf/issues/681}.
#' @aliases aggregate
#' @examples
#' m1 = cbind(c(0, 0, 1, 0), c(0, 1, 1, 0))
#' m2 = cbind(c(0, 1, 1, 0), c(0, 0, 1, 0))
#' pol = st_sfc(st_polygon(list(m1)), st_polygon(list(m2)))
#' set.seed(1985)
#' d = data.frame(matrix(runif(15), ncol = 3))
#' p = st_as_sf(x = d, coords = 1:2)
#' plot(pol)
#' plot(p, add = TRUE)
#' (p_ag1 = aggregate(p, pol, mean))
#' plot(p_ag1) # geometry same as pol
#' # works when x overlaps multiple objects in 'by':
#' p_buff = st_buffer(p, 0.2)
#' plot(p_buff, add = TRUE)
#' (p_ag2 = aggregate(p_buff, pol, mean)) # increased mean of second
#' # with non-matching features
#' m3 = cbind(c(0, 0, -0.1, 0), c(0, 0.1, 0.1, 0))
#' pol = st_sfc(st_polygon(list(m3)), st_polygon(list(m1)), st_polygon(list(m2)))
#' (p_ag3 = aggregate(p, pol, mean))
#' plot(p_ag3)
#' # In case we need to pass an argument to the join function:
#' (p_ag4 = aggregate(p, pol, mean, 
#'      join = function(x, y) st_is_within_distance(x, y, dist = 0.3)))
#' @export
aggregate.sf = function(x, by, FUN, ..., do_union = TRUE, simplify = TRUE,
		join = st_intersects) {

	if (inherits(by, "sf") || inherits(by, "sfc")) {
		if (inherits(by, "sfc"))
			by = st_sf(by)
		i = join(st_geometry(by), st_geometry(x))
		st_geometry(x) = NULL
		# dispatch to stats::aggregate:
		a = aggregate(x[unlist(i), , drop = FALSE],
			list(rep(seq_len(nrow(by)), lengths(i))), FUN, ...)
		nrow_diff = nrow(by) - nrow(a)

		if (is.matrix(a[[2]])) # https://github.com/r-spatial/sf/issues/2375
			a = data.frame(a[1], as.data.frame(a[[2]]))

		if(nrow_diff > 0) {
			a_na = a[rep(NA, nrow(by)),] # 'top-up' missing rows
			a_na[a$Group.1,] = a
			a = a_na
		}
		a$Group.1 = NULL # remove
		row.names(a) = row.names(by)
		st_set_geometry(a, st_geometry(by))
	} else {
		crs = st_crs(x)
		lst = lapply(split(st_geometry(x), by), function(y) do.call(c, y))
		geom = do.call(st_sfc, lst[!sapply(lst, is.null)])

		if (do_union)
			geom = st_union(st_set_precision(geom, st_precision(x)), by_feature = TRUE)

		st_geometry(x) = NULL
		x = aggregate(x, by, FUN, ..., simplify = simplify)
		st_geometry(x) = geom # coerces to sf
		st_crs(x) = crs

		# now set agr:
		geoms = which(vapply(x, function(vr) inherits(vr, "sfc"), TRUE))
		agr_names = names(x)[-geoms]
		agr = rep("aggregate", length(agr_names))
		names(agr) = agr_names
		# which ones are identity variables?
		n = if (!is.null(names(by)))
			names(by)
		else
			paste0("Group.", seq_along(by))
		agr[n] = "identity"
		st_set_agr(x, agr)
	}
}

#' Area-weighted interpolation or dasymetric mapping of polygon data
#'
#' Area-weighted interpolation or dasymetric mapping of polygon data
#' @name interpolate_aw
#' @param x object of class \code{sf}, for which we want to aggregate attributes
#' @param to object of class \code{sf} or \code{sfc}, with the target geometries
#' @param extensive logical; if TRUE, the attribute variables are assumed to be spatially extensive (like population) and the sum is preserved, otherwise, spatially intensive (like population density) and the mean is preserved.
#' @param na.rm logical; if `TRUE` remove features with `NA` attributes from `x` before interpolating
#' @param ... ignored
#' @param keep_NA logical; if \code{TRUE}, return all features in \code{to}, if \code{FALSE} return only those with non-NA values (but with \code{row.names} the index corresponding to the feature in \code{to})
#' @param include_non_intersected logical; for the case when `extensive=FALSE`, when set to `TRUE` divide by the target areas (including non-intersected areas), 
#' when `FALSE` divide by the sum of the source areas.
#' @param weights character; name of column in `to` that indicates (extensive) weights, to be used instead of areas, for redistributing attributes in `x`; currently only works for `extensive=TRUE`.
#' @details if `extensive` is `TRUE` and `na.rm` is set to `TRUE`, geometries with `NA` are effectively treated as having zero attribute values. Dasymetric mapping is obtained when `weights` are specified.
#' @examples
#' # example Area-weighted interpolation:
#' nc = st_read(system.file("shape/nc.shp", package="sf"))
#' g = st_make_grid(nc, n = c(10, 5))
#' a1 = st_interpolate_aw(nc["BIR74"], g, extensive = FALSE)
#' sum(a1$BIR74) / sum(nc$BIR74) # not close to one: property is assumed spatially intensive
#' a2 = st_interpolate_aw(nc["BIR74"], g, extensive = TRUE)
#' # verify mass preservation (pycnophylactic) property:
#' sum(a2$BIR74) / sum(nc$BIR74)
#' a1$intensive = a1$BIR74
#' a1$extensive = a2$BIR74
#' \donttest{plot(a1[c("intensive", "extensive")], key.pos = 4)}
#' 
#' # example Dasymetric mapping:
#' # load nr of addresses per 10 km grid cell, to proxy population -> birth density:
#' grd.addr = system.file("gpkg/grd_addr.gpkg", package="sf") |> read_sf()
#' xgrd.addr = grd.addr # copy for plotting
#' xgrd.addr$ones[grd.addr$ones==0] = 1 # so that logz shows finite values
#' \donttest{plot(xgrd.addr, logz=TRUE, main = "nr of addresses per cell") # log scale}
#' nc = st_transform(nc, st_crs(grd.addr))
#' # avoid "assumes attributes are constant or uniform over areas" warnings:
#' st_agr(nc) = c(BIR74 = "constant", BIR79 = "constant")
#' st_agr(grd.addr) = c(ones = "constant")
#' # dasymetric mapping
#' bir.grd = st_interpolate_aw(nc[c("BIR74","BIR79")], extensive = TRUE, grd.addr, weights = "ones")
#' xbir.grd = bir.grd # copy for plotting
#' xbir.grd$BIR74[xbir.grd$BIR74 == 0] = 1 # so that logz shows finite values
#' \donttest{plot(xbir.grd["BIR74"], logz = TRUE, main = "redistributed birth counts, 1974-")}
#' # verify sums:
#' apply(as.data.frame(bir.grd)[1:2], 2, sum)
#' apply(as.data.frame(nc)[c("BIR74", "BIR79")], 2, sum)
#' # compare county-wise:
#' st_agr(bir.grd) = c(BIR74 = "constant")
#' aw = st_interpolate_aw(bir.grd["BIR74"], st_geometry(nc), extensive = TRUE)
#' plot(nc$BIR74, aw$BIR74, log = 'xy', xlab = 'county-value', ylab = 'area-w interpolated')
#' abline(0,1)
#' @export
st_interpolate_aw = function(x, to, extensive, ...) UseMethod("st_interpolate_aw")

#' @export
#' @name interpolate_aw
st_interpolate_aw.sf = function(x, to, extensive, ..., keep_NA = FALSE, na.rm = FALSE,
		include_non_intersected = FALSE, weights = character(0)) {

	if (!inherits(to, "sf") && !inherits(to, "sfc")) {
		to <- try(st_as_sf(to))
		if (inherits(to, "try-error"))
			stop("st_interpolate_aw requires geometries in argument to")
	}
	if (isTRUE(na.rm))
		x = x[! apply(is.na(x), 1, any),]

	if (length(weights)) {
		stopifnot(length(weights) == 1, is.character(weights), inherits(to, "sf"), weights %in% names(to))
		return(dasymetric(x, to[weights], extensive, keep_NA, include_non_intersected))
	}

	if (! all_constant(x))
		warning("st_interpolate_aw assumes attributes are constant or uniform over areas of x")
	i = st_intersection(st_geometry(x), st_geometry(to), dimensions = "polygon")
	idx = attr(i, "idx")

	# https://stackoverflow.com/questions/57767022/how-do-you-use-st-interpolate-aw-with-polygon-layers-that-legitimately-include-p
	gc = which(st_is(i, "GEOMETRYCOLLECTION"))
	# i[gc] = st_collection_extract(i[gc], "POLYGON") ## breaks if there are several POLYGONs in a GC
	i[gc] = do.call(c, lapply(i[gc], function(x) st_sfc(st_union(st_collection_extract(x, "POLYGON")))))
	two_d = which(st_dimension(i) == 2)
	i[two_d] = st_cast(i[two_d], "MULTIPOLYGON")

	x_st = st_set_geometry(x, NULL)[idx[,1],, drop=FALSE]   # create st table, remove geom
	if (any(!sapply(x_st, is.numeric)))
		stop("x contains non-numeric column(s)")
	area_i = try(st_area(i), silent = TRUE)
	if (inherits(area_i, "try-error"))
		area_i <- st_area(st_make_valid(i)) # work-around for https://github.com/r-spatial/sf/issues/1810
	x_st$...area_st = unclass(area_i)

	x_st = if (extensive) {
			# compute area_s:
			x_st$...area_s = unclass(st_area(x))[idx[,1]]
			lapply(x_st, function(v) v * x_st$...area_st / x_st$...area_s)
		} else {
			# compute target area:
			target = if (include_non_intersected)
						setNames(as.numeric(st_area(to)), seq_len(NROW(to))) # use all of "to"
					else
						sapply(split(area_i, idx[, 2]), sum) # sum "to" parts intersecting "x"
			df = data.frame(area = target, idx = as.integer(names(target)))
			x_st$...area_t = merge(data.frame(idx = idx[,2]), df)$area
			lapply(x_st, function(v) v * x_st$...area_st / x_st$...area_t)
		}
	x_st = aggregate(x_st, list(idx[,2]), sum)
	df = if (keep_NA) {
			ix = rep(NA_integer_, length(to))
			ix[x_st$Group.1] = seq_along(x_st$Group.1)
			st_sf(x_st[ix,], geometry = st_geometry(to))
		} else
			st_sf(x_st, geometry = st_geometry(to)[x_st$Group.1], row.names = x_st$Group.1)
	# clean up:
	df$...area_t = df$...area_st = df$...area_s = df$Group.1 = NULL
	st_set_agr(df, "aggregate")
}

dasymetric = function(x, to, extensive, keep_NA, include_non_intersected) {
	stopifnot(isTRUE(extensive), !keep_NA, !include_non_intersected) # later...
	stopifnot(length(to) == 2)
	if (!inherits(to[[2]], "sfc"))
		to = to[2:1] # swap: geom last
	i = st_intersection(st_geometry(x), st_geometry(to), dimensions = "polygon")
	idx = attr(i, "idx")
	st_geometry(x) = NULL
	stopifnot(!("...x_s" %in% names(x))) # avoid overwrite
	x = x[idx[,1], , drop=FALSE] # x attributes corresponding to each area of i
	i = st_set_geometry(x[idx[,1], , drop = FALSE], i) # add geometry

	# https://stackoverflow.com/questions/57767022/how-do-you-use-st-interpolate-aw-with-polygon-layers-that-legitimately-include-p
	# i[gc] = st_collection_extract(i[gc], "POLYGON") ## breaks if there are several POLYGONs in a GC
	gc = which(st_is(i, "GEOMETRYCOLLECTION"))
	if (length(gc)) {
		g = st_geometry(i)
		g[gc] = do.call(c, lapply(g[gc,], function(x) st_sfc(st_union(st_collection_extract(x, "POLYGON")))))
		st_geometry(i) = g
	}
	two_d = which(st_dimension(i) == 2)
	if (any(two_d)) {
		g = st_geometry(i)
		g[two_d] = st_cast(g[two_d], "MULTIPOLYGON")
		st_geometry(i) = g
	}

	x$...x_st = st_interpolate_aw(to, i, extensive = extensive)[[1]] # distribute weights over the intersection geometries
	# split according to source regions:
	# first copy over idx[,2], as split() will rearrange records
	x$...idx2 = idx[,2]
	spl = split(x, idx[,1])
	# reconstruct idx2:
	idx2 = do.call(c, lapply(spl, function(x) x$...idx2))
	# for each of the source regions, compute weighted sum
	spl = lapply(spl, function(u) {
			w = if ((s <- sum(u$...x_st)) == 0)
					NA_real_
				else
					u$...x_st / s
			u$...x_st = u$...idx2 = NULL # remove
			as.data.frame(lapply(u, function(v) v * w))
		})
	x = do.call(rbind, spl)
	# sum over the target regions:
	# x = aggregate(x, list(idx[,2]), sum)
	x = aggregate(x, list(idx2), sum)
	df = if (keep_NA) {
			ix = rep(NA_integer_, length(to))
			ix[x$Group.1] = seq_along(x$Group.1)
			st_sf(x[ix,], geometry = st_geometry(to))
		} else
			st_sf(x, geometry = st_geometry(to)[x$Group.1], row.names = x$Group.1)
	# clean up:
	df$Group.1 = NULL
	st_set_agr(df, "aggregate")
}


================================================
FILE: R/agr.R
================================================
agr_levels = c("constant", "aggregate", "identity")

#' @name st_agr
#' @details
#' \code{NA_agr_} is the \code{agr} object with a missing value.
#' @export
NA_agr_ = factor(NA, levels = agr_levels)

#' get or set relation_to_geometry attribute of an \code{sf} object
#'
#' get or set relation_to_geometry attribute of an \code{sf} object
#' @name st_agr
#' @param x object of class \code{sf}
#' @param ... ignored
#' @export
st_agr = function(x, ...) UseMethod("st_agr")

#' @export
st_agr.sf = function(x, ...) {
	sfc_s = sapply(x, inherits, "sfc")
	nm = names(x)[!sfc_s]
	ret = attr(x, "agr")[nm]
	if (is.null(names(ret)) || all(is.na(names(ret))))
		structure(rep(NA_agr_, length(nm)), names = nm)
	else
		ret
}

#' @export
st_agr.character = function(x, ...) {
	structure(factor(x, levels = agr_levels), names = names(x))
}

#' @export
st_agr.factor = function(x, ...) {
	stopifnot(all(levels(x) == agr_levels))
	x
}

#' @export
st_agr.default = function(x = NA_character_, ...) {
	if (is.data.frame(x) && !is.null(attr(x, "agr")))
		x = attr(x, "agr")
	structure(st_agr(as.character(x)), names = names(x))
}

#' @name st_agr
#' @param value character, or factor with appropriate levels; if named, names should correspond to the non-geometry list-column columns of \code{x}
#' @export
`st_agr<-` = function(x, value) UseMethod("st_agr<-")

#' @export
`st_agr<-.sf` = function(x, value) {
	stopifnot(is.character(value) || is.factor(value))
	sfc_s = sapply(x, inherits, "sfc")
	# nv = setdiff(names(x), attr(x, "sf_column"))
	nv = names(x)[!sfc_s]
	if (length(value) == 0)
		attr(x, "agr") = setNames(NA_agr_[0], character())
	else if (! is.null(names(value)) && length(value) == 1) { 
		# as in: st_agr(x) = c(Group.1 = "identity"): replace one particular named
		if (!is.null(attr(x, "agr")))
			attr(x, "agr")[names(value)] = st_agr(value)
		else
			attr(x, "agr") = st_agr(value)
	} else {
		value = rep(st_agr(value), length.out = length(nv))
		if (! is.null(names(value)))
			value = value[match(nv, names(value))]
		else
			names(value) = nv
		attr(x, "agr") <- value
	}
 	#print(paste("vars: ", paste(nv, collapse=","), "value(s):", paste(value, collapse = ",")))
 	#print(rlang::trace_back())
#	a = st_agr(x)
#	absent = setdiff(names(x), c(na.omit(names(a)), attr(x, "sf_column")))
#	if (length(absent)) { # repair:
#		a[absent] = NA_agr_
#		names(a[absent]) = absent
#		attr(x, "agr") = a[nv]
#	}
	x
}

#' @name st_agr
#' @export
st_set_agr = function(x, value) { 
	if (!missing(value))
		st_agr(x) = value
	else { # needs repair?
		value = st_agr(x)
		if (any(is.na(names(value))) && length(value) == length(x) - 1) {
			names(value) = setdiff(names(x), attr(x, "sf_column"))
			st_agr(x) = value
		}
	}
	x
}

summarize_agr = function(x) {
	su = summary(st_agr(x))
	su = su[su > 0]
	paste0(names(su), " (", su, ")", collapse = ", ")
}

all_constant = function(x) {
	x = attr(x, "agr")
	!anyNA(x) && all(x %in% c("identity", "constant"))
}


================================================
FILE: R/arith.R
================================================
#' Arithmetic operators for simple feature geometries
#' @name Ops
#'
#' @param e1 object of class \code{sfg} or \code{sfc}
#' @param e2 numeric, or object of class \code{sfg}; in case \code{e1} is of class \code{sfc} also an object of class \code{sfc} is allowed
#'
#' @details in case \code{e2} is numeric, +, -, *, /, %% and %/% add, subtract, multiply, divide, modulo, or integer-divide by \code{e2}. In case \code{e2} is an n x n matrix, * matrix-multiplies and / multiplies by its inverse. If \code{e2} is an \code{sfg} object, |, /, & and %/% result in the geometric union, difference, intersection and symmetric difference respectively, and \code{==} and \code{!=} return geometric (in)equality, using \link{st_equals}. If `e2` is an `sfg` or `sfc` object, for operations `+` and `-` it has to have `POINT` geometries.
#'
#' If \code{e1} is of class \code{sfc}, and \code{e2} is a length 2 numeric, then it is considered a two-dimensional point (and if needed repeated as such) only for operations \code{+} and \code{-}, in other cases the individual numbers are repeated; see commented examples.
#'
#' @details
#' It has been reported (https://github.com/r-spatial/sf/issues/2067) that
#' certain ATLAS versions result in invalid polygons, where the final point
#' in a ring is no longer equal to the first point. In that case, setting
#' the precisions with \link{st_set_precision} may help.
#' @return object of class \code{sfg}
#' @export
#'
#' @examples
#' st_point(c(1,2,3)) + 4
#' st_point(c(1,2,3)) * 3 + 4
#' m = matrix(0, 2, 2)
#' diag(m) = c(1, 3)
#' # affine:
#' st_point(c(1,2)) * m + c(2,5)
#' # world in 0-360 range:
#' if (require(maps, quietly = TRUE)) {
#'  w = st_as_sf(map('world', plot = FALSE, fill = TRUE))
#'  w2 = (st_geometry(w) + c(360,90)) %% c(360) - c(0,90)
#'  w3 = st_wrap_dateline(st_set_crs(w2 - c(180,0), 4326)) + c(180,0)
#'  plot(st_set_crs(w3, 4326), axes = TRUE)
#' }
#' (mp <- st_point(c(1,2)) + st_point(c(3,4))) # MULTIPOINT (1 2, 3 4)
#' mp - st_point(c(3,4)) # POINT (1 2)
#' opar = par(mfrow = c(2,2), mar = c(0, 0, 1, 0))
#' a = st_buffer(st_point(c(0,0)), 2)
#' b = a + c(2, 0)
#' p = function(m) { plot(c(a,b)); plot(eval(parse(text=m)), col=grey(.9), add = TRUE); title(m) }
#' o = lapply(c('a | b', 'a / b', 'a & b', 'a %/% b'), p)
#' par(opar)
#' sfc = st_sfc(st_point(0:1), st_point(2:3))
#' sfc + c(2,3) # added to EACH geometry
#' sfc * c(2,3) # first geometry multiplied by 2, second by 3
Ops.sfg <- function(e1, e2) {

	if (nargs() == 1) {
		switch (.Generic,
			"-" = return(e1 * -1.0),
			"+" = return(e1),
			stop(paste("unary", .Generic, 'not defined for "sfg" objects'))
		)
	}

	prd <- switch(.Generic, "*" = TRUE, "/" = TRUE, FALSE)
	pm  <- switch(.Generic, "+" = , "-" = TRUE, FALSE)
	mod <- switch(.Generic, "%%" = TRUE, "%/%" = TRUE, FALSE)
	set <- switch(.Generic, "&" = TRUE, "|" = TRUE, FALSE)
	lgcl <- switch(.Generic, "==" = TRUE, "!=" = TRUE, FALSE)

	if (!(prd || pm || mod || set || lgcl))
		stop(paste("operation", .Generic, "not supported for sfg objects"))

	e1_empty = st_is_empty(e1)
	e2_empty = inherits(e2, "sfg") && st_is_empty(e2)
	if (lgcl && (e1_empty || e2_empty))
		return(NA)

	if (e1_empty && (.Generic %in% c("*", "+", "-", "%%")))
		return(e1)

	if (inherits(e2, "sfg")) {
		e2 = switch(.Generic,
			"|" = st_union(e1, e2),
			"/" = st_difference(e1, e2),
			"&" = st_intersection(e1, e2),
			"%/%" = st_sym_difference(e1, e2),
			"==" = length(st_equals(e1, e2)[[1]]) != 0,
			"!=" = length(st_equals(e1, e2)[[1]]) == 0,
			unclass(e2))
		if (inherits(e2, "sfg") || is.logical(e2))
			return(e2)
	}

	dims = nchar(class(e1)[1])
	Vec = rep(0, dims)
	Mat = matrix(0, dims, dims)
	diag(Mat) = 1
	if (pm || mod) {
		if (length(e2) == 1)
			Vec = rep(e2, length.out = dims)
		else
			Vec = e2
		if (.Generic == "-")
			Vec = -Vec
	} else if (prd) {
		if (length(e2) == 1 || length(e2) == dims)
			diag(Mat) = e2
		else
			Mat = e2
		if (.Generic == "/")
			Mat = solve(Mat) # inverse
	}

	if_pt = function(x, y) { if(inherits(x, "POINT")) as.vector(y) else y }
	fn = if (prd)
			function(x, Mat, Vec) structure(if_pt(x, x %*% Mat), class = class(x))
		else if (pm)
			function(x, Mat, Vec) structure(if_pt(x, unclass(x) + conform(Vec, x)), class = class(x))
		else # mod:
			function(x, Mat, Vec) structure(if_pt(x, unclass(x) %% conform(Vec, x)), class = class(x))

	if (is.list(e1))
		rapply(e1, fn, how = "replace", Mat = Mat, Vec = Vec)
	else
		fn(e1, Mat, Vec)
}

conform = function(vec, m) {
	if (is.matrix(m))
		t(matrix(vec, ncol(m), nrow(m)))
	else
		vec
}

#' @export
#' @name Ops
#' @examples
#' nc = st_transform(st_read(system.file("gpkg/nc.gpkg", package="sf")), 32119) # nc state plane, m
#' b = st_buffer(st_centroid(st_union(nc)), units::set_units(50, km)) # shoot a hole in nc:
#' plot(st_geometry(nc) / b, col = grey(.9))
Ops.sfc <- function(e1, e2) {

	if (length(e1) == 0) # empty set
		return(e1)

	if (is.numeric(e2) && !is.matrix(e2) && length(e2) <= 2 && .Generic %in% c("+", "-")) {
		if (.Generic == "-")
			e2 <- -e2
		return(opp_sfc(e1, as.numeric(e2), 0L, NA_crs_))
	} else if (.Generic %in% c("*", "/") && is.numeric(e2) && (length(e2) == 1 || (is_only_pos_diag(e2)))) {
		if (is.matrix(e2)) e2 <- diag(e2)
		if (.Generic == "/")
			e2 <- 1 / e2
		return(opp_sfc(e1, as.numeric(e2), 1L, NA_crs_))
	}
	if ((is.matrix(e2) && ncol(e2) == 2) || (is.numeric(e2) && length(e2) == 2))
		e1 = st_zm(e1) # drop z and/or m

	if (!is.list(e2) && ((.Generic %in% c("+", "-") && length(e2) == 2) || is.matrix(e2)))
		e2 = list(e2)

	ret = switch(
		.Generic,
		"&"   =  mapply(function(x, y) { x  & y }, e1, e2, SIMPLIFY = FALSE),
		"|"   =  mapply(function(x, y) { x  | y }, e1, e2, SIMPLIFY = FALSE),
		"%/%" =  mapply(function(x, y) { x %/% y}, e1, e2, SIMPLIFY = FALSE),
		"/"   =  mapply(function(x, y) { x  / y }, e1, e2, SIMPLIFY = FALSE),
		"!="  =  mapply(function(x, y) { x != y }, e1, e2, SIMPLIFY = TRUE),
		"=="  =  mapply(function(x, y) { x == y }, e1, e2, SIMPLIFY = TRUE),
		"*"   =  mapply(function(x, y) { x  * y }, e1, e2, SIMPLIFY = FALSE),
		"+"   =  mapply(function(x, y) { x  + y }, e1, e2, SIMPLIFY = FALSE),
		"-"   =  mapply(function(x, y) { x  - y }, e1, e2, SIMPLIFY = FALSE),
		"%%"  =  mapply(function(x, y) { x %% y }, e1, e2, SIMPLIFY = FALSE),
		stop(paste("operation", .Generic, "not supported")))

	if (!(.Generic %in% c("!=", "=="))) {
		crs = if (.Generic %in% c("&", "|", "%/%", "/") && inherits(e2, c("sfc", "sfg"))) # retain:
			st_crs(e1)
		else # geometry got displaced:
			NA_crs_
		st_sfc(ret, crs = crs, precision = attr(e1, "precision"), recompute_bbox = TRUE) # also check_ring_dir, if polygons? #2377
	} else
		ret
}

is_only_pos_diag <- function(x) {
	is.matrix(x) && all(`diag<-`(x, 0) == 0) && all(diag(x) >= 0) # nocov
}


================================================
FILE: R/bbox.R
================================================

#' @name st_bbox
#' @param x object of class \code{bbox}
#' @export
is.na.bbox = function(x) identical(x, NA_bbox_)

bb_wrap = function(bb) {
	stopifnot(is.numeric(bb), length(bb) == 4)
	structure(as.double(bb), names = c("xmin", "ymin", "xmax", "ymax"), class = "bbox")
}

bbox.Set = function(obj, ...) {
	sel = !sfc_is_empty(obj)
	if (! any(sel))
		NA_bbox_
	else
		bb_wrap(CPL_get_bbox(unclass(obj)[sel], 0))
}
bbox.Mtrx = function(obj, ...) {
	if (length(obj) == 0)
		NA_bbox_
	else
		bb_wrap(CPL_get_bbox(list(obj), 1)) # note the list()
}
bbox.MtrxSet = function(obj, ...) {
	if (length(obj) == 0)
		NA_bbox_
	else
		bb_wrap(CPL_get_bbox(obj, 1))
}
bbox.MtrxSetSet = function(obj, ...) {
	if (length(obj) == 0)
		NA_bbox_
	else
		bb_wrap(CPL_get_bbox(obj, 2))
}
bbox.MtrxSetSetSet = function(obj, ...) {
	if (length(obj) == 0)
		NA_bbox_
	else
		bb_wrap(CPL_get_bbox(obj, 3))
}

#' Return bounding of a simple feature or simple feature set
#'
#' Return bounding of a simple feature or simple feature set
#' @param obj object to compute the bounding box from
#' @param ... for format.bbox, passed on to \link[base]{format} to format individual numbers
#' @export
#' @return a numeric vector of length four, with \code{xmin}, \code{ymin}, \code{xmax}
#' and \code{ymax} values; if \code{obj} is of class \code{sf}, \code{sfc}, \code{Spatial} or \code{Raster}, the object
#' returned has a class \code{bbox}, an attribute \code{crs} and a method to print the
#' bbox and an \code{st_crs} method to retrieve the coordinate reference system
#' corresponding to \code{obj} (and hence the bounding box). \link{st_as_sfc} has a
#' methods for \code{bbox} objects to generate a polygon around the four bounding box points.
#' @name st_bbox
#' @examples
#' a = st_sf(a = 1:2, geom = st_sfc(st_point(0:1), st_point(1:2)), crs = 4326)
#' st_bbox(a)
#' st_as_sfc(st_bbox(a))
st_bbox = function(obj, ...) UseMethod("st_bbox")

#' @export
#' @name st_bbox
st_bbox.POINT = function(obj, ...) bb_wrap(c(obj[1L], obj[2L], obj[1L], obj[2L]))
#' @export
#' @name st_bbox
st_bbox.MULTIPOINT = bbox.Mtrx
#' @export
#' @name st_bbox
st_bbox.LINESTRING = bbox.Mtrx
#' @export
#' @name st_bbox
st_bbox.POLYGON = function(obj, ...) if (st_is_full(obj)) FULL_bbox_ else bbox.MtrxSet(obj)
#' @export
#' @name st_bbox
st_bbox.MULTILINESTRING = bbox.MtrxSet
#' @export
#' @name st_bbox
st_bbox.MULTIPOLYGON = bbox.MtrxSetSet

bbox_list = function(obj, ...) {
	s = vapply(obj, st_bbox, c(0.,0.,0.,0.)) # dispatch on class
	if (length(s) == 0 || all(is.na(s[1L,])))
		NA_bbox_
	else
		bb_wrap(c(min(s[1L,], na.rm = TRUE), min(s[2L,], na.rm = TRUE),
		  max(s[3L,], na.rm = TRUE), max(s[4L,], na.rm = TRUE)))
}

#' @name st_bbox
#' @export
st_bbox.GEOMETRYCOLLECTION = bbox_list

#' @name st_bbox
#' @export
st_bbox.MULTISURFACE = bbox_list

#' @name st_bbox
#' @export
st_bbox.MULTICURVE = bbox_list

#' @name st_bbox
#' @export
st_bbox.CURVEPOLYGON = bbox_list

#' @name st_bbox
#' @export
st_bbox.COMPOUNDCURVE = bbox_list

#' @name st_bbox
#' @export
st_bbox.POLYHEDRALSURFACE = bbox.MtrxSetSet

#' @name st_bbox
#' @export
st_bbox.TIN = bbox.MtrxSetSet

#' @name st_bbox
#' @export
st_bbox.TRIANGLE = bbox.MtrxSet

#' @name st_bbox
#' @export
st_bbox.CIRCULARSTRING = function(obj, ...) {
	# this is of course wrong:
	st_bbox(st_cast(obj, "LINESTRING"))
}

#' @export
print.bbox = function(x, ...) {
	x = structure(x, crs = NULL, class = NULL)
	print(set_units(x, attr(x, "units"), mode = "standard"), ...)
}

compute_bbox = function(obj) {
	switch(class(obj)[1],
		sfc_POINT = bb_wrap(bbox.Set(obj)),
		sfc_MULTIPOINT = bb_wrap(bbox.MtrxSet(obj)),
		sfc_LINESTRING = bb_wrap(bbox.MtrxSet(obj)),
		sfc_POLYGON = if (any(st_is_full(obj))) FULL_bbox_ else bb_wrap(bbox.MtrxSetSet(obj)),
		sfc_MULTILINESTRING = bb_wrap(bbox.MtrxSetSet(obj)),
		sfc_MULTIPOLYGON = bb_wrap(bbox.MtrxSetSetSet(obj)),
		bbox_list(obj)
	)
}

#' @name st_bbox
#' @export
st_bbox.sfc = function(obj, ...) structure(attr(obj, "bbox"), crs = st_crs(obj))

#' @name st_bbox
#' @export
st_bbox.sf = function(obj, ...) st_bbox(st_geometry(obj))

#' @name st_bbox
#' @export
st_bbox.Spatial = function(obj, ...) {
	if (!requireNamespace("sp", quietly = TRUE))
		stop("package sp required, please install it first")
	bb = sp::bbox(obj)
	structure(bb_wrap(c(bb[1,1],bb[2,1],bb[1,2],bb[2,2])),
		crs = st_crs(slot(obj, "proj4string")))
}

#' @name st_bbox
#' @export
st_bbox.Raster = function(obj, ...) {
	if (!requireNamespace("sp", quietly = TRUE))
		stop("package sp required, please install it first")
	if (!requireNamespace("raster", quietly = TRUE))
		stop("package raster required, please install it first")
	bb = sp::bbox(obj)
	structure(bb_wrap(c(bb[1,1],bb[2,1],bb[1,2],bb[2,2])),
		crs = st_crs(sp::proj4string(obj)))
}

#' @name st_bbox
#' @export
st_bbox.Extent = function(obj, ..., crs = NA_crs_) {
	if (!requireNamespace("raster", quietly = TRUE))
		stop("package raster required, please install it first")
	structure(bb_wrap(c(obj@xmin, obj@ymin, obj@xmax, obj@ymax)), crs = st_crs(crs))
}

#' @name st_bbox
#' @param crs object of class \code{crs}, or argument to \link{st_crs}, specifying the CRS of this bounding box.
#' @examples
#' st_bbox(c(xmin = 16.1, xmax = 16.6, ymax = 48.6, ymin = 47.9), crs = st_crs(4326))
#' @export
st_bbox.numeric = function(obj, ..., crs = NA_crs_) {
	structure(bb_wrap(obj[c("xmin", "ymin", "xmax", "ymax")]), crs = st_crs(crs))
}

#' @export
st_bbox.bbox = function(obj, ...) obj


#' @export
"$.bbox" = function(x, name) {
	switch(name,
		xrange =,
		xlim = x[c("xmin", "xmax")],
		yrange =,
		ylim = x[c("ymin", "ymax")],
		xmin = x["xmin"],
		ymin = x["ymin"],
		xmax = x["xmax"],
		ymax = x["ymax"],
		stop("unsupported name")
	)
}

#' @name st_bbox
#' @details \code{NA_bbox_} represents the missing value for a \code{bbox} object
#' @export
NA_bbox_ = structure(rep(NA_real_, 4),
	names = c("xmin", "ymin", "xmax", "ymax"),
	crs = NA_crs_,
	class = "bbox")

#' @name st_bbox
#' @details \code{NA_bbox_} represents the missing value for a \code{bbox} object
#' @export
FULL_bbox_ = structure(c(-180.,-90.,180.,90.),
	names = c("xmin", "ymin", "xmax", "ymax"),
	crs = NA_crs_,
	class = "bbox")

#' @name st_bbox
#' @export
format.bbox = function(x, ...) {
	p1 = paste0("(",paste0(c(format(x[1], ...), format(x[2], ...)), collapse=","),")")
	p2 = paste0("(",paste0(c(format(x[3], ...), format(x[4], ...)), collapse=","),")")
	paste0("(",p1,",",p2,")")
}


================================================
FILE: R/bind.R
================================================
chk_equal_crs = function(dots) {
	if (length(dots) > 1L) {
		crs0 = st_crs(dots[[1]])
		vapply(dots[-1L], function(x) {
				if (st_crs(x) != crs0) 
					stop("arguments have different crs", call. = FALSE)
				TRUE
			}, TRUE)
	}
	NULL
}

#' Bind rows (features) of sf objects
#'
#' Bind rows (features) of sf objects
#' @param ... objects to bind; note that for the rbind and cbind methods, all objects have to be of class \code{sf}; see \link{dotsMethods}
#' @param deparse.level integer; see \link{rbind}
#' @name bind
#' @details both \code{rbind} and \code{cbind} have non-standard method dispatch (see \link[base]{cbind}): the \code{rbind} or \code{cbind} method for \code{sf} objects is only called when all arguments to be binded are of class \code{sf}.
#' @export
#' @examples
#' crs = st_crs(3857)
#' a = st_sf(a=1, geom = st_sfc(st_point(0:1)), crs = crs)
#' b = st_sf(a=1, geom = st_sfc(st_linestring(matrix(1:4,2))), crs = crs)
#' c = st_sf(a=4, geom = st_sfc(st_multilinestring(list(matrix(1:4,2)))), crs = crs)
#' rbind(a,b,c)
#' rbind(a,b)
#' rbind(a,b)
#' rbind(b,c)
rbind.sf = function(..., deparse.level = 1) {
	dots = list(...)
	dots = dots[!sapply(dots, is.null)]
	nr = sapply(dots, NROW)
	sf_column = if (any(nr > 0))
			attr(dots[[ which(nr > 0)[1] ]], "sf_column")
		else
			NULL
	chk_equal_crs(dots)
	ret = st_sf(rbind.data.frame(...), crs = st_crs(dots[[1]]), sf_column_name = sf_column)
	st_geometry(ret) = st_sfc(st_geometry(ret)) # might need to reclass to GEOMETRY
	bb = do.call(rbind, lapply(dots, st_bbox))
	bb = bb_wrap(c(min(bb[,1L], na.rm = TRUE), min(bb[,2L], na.rm = TRUE),
		  max(bb[,3L], na.rm = TRUE), max(bb[,4L], na.rm = TRUE)))
	attr(ret[[ attr(ret, "sf_column") ]], "bbox") = bb
	ret
}

#' Bind columns (variables) of sf objects
#'
#' Bind columns (variables) of sf objects
#' @name bind
#' @param sf_column_name character; specifies active geometry; passed on to \link{st_sf}
#' @return \code{cbind} called with multiple \code{sf} objects warns about multiple geometry columns present when the geometry column to use is not specified by using argument \code{sf_column_name}; see also \link{st_sf}.
#' @export
#' @details If you need to \code{cbind} e.g. a \code{data.frame} to an \code{sf}, use \link{data.frame} directly and use \link{st_sf} on its result, or use \link[dplyr:bind]{bind_cols}; see examples.
#' @examples
#' cbind(a,b,c) # warns
#' if (require(dplyr, quietly = TRUE))
#'   dplyr::bind_cols(a,b)
#' c = st_sf(a=4, geomc = st_sfc(st_multilinestring(list(matrix(1:4,2)))), crs = crs)
#' cbind(a,b,c, sf_column_name = "geomc")
#' df = data.frame(x=3)
#' st_sf(data.frame(c, df))
#' if (require(dplyr, quietly = TRUE))
#'   dplyr::bind_cols(c, df)
cbind.sf = function(..., deparse.level = 1, sf_column_name = NULL) {
	# TODO: handle st_agr?
	st_sf(data.frame(...), sf_column_name = sf_column_name)
}

#' @name bind
#' @export
#' @details \code{st_bind_cols} is deprecated; use \code{cbind} instead.
st_bind_cols = function(...) {
	# nocov start
	.Deprecated("cbind",
				msg = paste0("Use 'cbind' instead when all arguments",
				             " to be binded are of class sf.\n",
				             "If you need to cbind a data.frame to an sf,",
				             " use 'st_sf' or 'dplyr::bind_cols' (see the examples)."))
	cbind.sf(...)
	# nocov end
}


================================================
FILE: R/break_antimeridian.R
================================================

#' Break antimeridian for plotting not centred on Greenwich
#'
#' Longitudes can be broken at the antimeridian of a target central longitude 
#' to permit plotting of (usually world) line or polygon objects centred 
#' on the chosen central longitude. The method may only be used with 
#' non-projected, geographical coordinates and linestring or polygon objects.
#' s2 is turned off internally to permit the use of a rectangular bounding 
#' box. If the input geometries go outside `[-180, 180]` degrees longitude,
#' the protruding geometries will also be split using the same \code{tol=} 
#' values; in this case empty geometries will be dropped first.
#'
#' @param x object of class `sf` or `sfc`
#' @param lon_0 target central longitude (degrees)
#' @param tol half of break width (degrees, default 0.0001)
#' @param ... ignored here
#' @export
#' @name st_break_antimeridian
#' @examples
#' \donttest{
#' if (require("maps", quietly=TRUE)) {
#'  opar = par(mfrow=c(3, 2))
#'  wld = st_as_sf(map(fill=FALSE, interior=FALSE, plot=FALSE), fill=FALSE)
#'  for (lon_0 in c(-170, -90, -10, 10, 90, 170)) {
#'    br = st_break_antimeridian(wld, lon_0 = lon_0)
#'    tr = st_transform(br, paste0("+proj=natearth +lon_0=", lon_0))
#'    plot(st_geometry(tr), main=lon_0)
#'  }
#'  par(opar)
#' }
#' }
st_break_antimeridian = function(x, lon_0=0, tol=0.0001, ...) {
	ll = st_is_longlat(x)
	if (!isTRUE(ll))
		stop("'st_break_antimeridian' requires non-projected geographic coordinates",
			 call. = FALSE)

	UseMethod("st_break_antimeridian")
}

#' @export
#' @name st_break_antimeridian
st_break_antimeridian.sf = function(x, lon_0=0, tol=0.0001, ...) {
	type = st_geometry_type(x)
        if (length(grep("CURVE", type[grep("LINESTRING|POLYGON", type)],
            invert=TRUE)) == 0L) stop("'st_break_antimeridian' requires linestring or polygon objects", call. = FALSE)
	bb0 = st_bbox(x)
        low = bb0[1] < -(180+tol)
	high = bb0[3] > (180+tol)
        if (low || high) {
	    warning("st_break_antimeridian: longitude coordinates outside [-180, 180]")
#	     x_c = st_geometry(x)
#            g = ((x_c + c(360, 90)) %% c(360) - c(0, 90))  - c(180, 0)
#	     st_crs(g) <- st_crs(x)
#            st_geometry(x) = g
            x <- st_within_pm180(x, tol=tol)
            bb0 = st_bbox(x)
        }
        if (lon_0 < 0) {
	    am = lon_0 + 180
            am_w = am - tol
	    am_e = am + tol
            if (am_w > 180) am_w = am_w - 360
        } else {
	    am = lon_0 - 180
            am_w = am - tol
	    am_e = am + tol
            if (am_w < -180) am_w = am_w + 360
	}
        if (lon_0 == 0) {
	    bb1 = bb0
            bb1[1] = am_e
	    bb1[3] = am_w
            bb1 = st_as_sfc(bb1)
        } else {
            bb1w = bb1e = bb0
	    bb1w[3] = am_w # antimeridian of target minus fuzz
	    bb1e[1] = am_e # plus fuzz
	    bb1 = c(st_as_sfc(bb1w), st_as_sfc(bb1e))
	}
        s2_status = sf_use_s2()
	sf_use_s2(FALSE) # avoid s2 because we need a planar bounding box
	on.exit(sf_use_s2(s2_status))
	res = st_intersection(x, bb1)
	st_crs(res) = st_crs(x)
        res
}
#' @export
#' @name st_break_antimeridian
st_break_antimeridian.sfc = function(x, lon_0=0, tol=0.0001, ...) {
# cannot reduce sf to sfc because the length of the returned object is
# not restricted to the row count of the input object
        st_geometry(st_break_antimeridian(st_as_sf(x), lon_0=lon_0, tol=tol))
}

st_within_pm180 <- function(x, tol=0.0001) {
	stopifnot(inherits(x, "sf"))
        xempt = st_is_empty(x)
	if (any(xempt)) x = x[!xempt,]
        xcrs = st_crs(x)
        xnames = names(x)
	xnames = xnames[grep(attr(x, "sf_column"), xnames, invert=TRUE)]
	x$st_within_pm180_ID = as.character(seq_len(nrow(x)))
        s2_status = sf_use_s2()
	sf_use_s2(FALSE) # avoid s2 because we need a planar bounding box
	bb0 = st_bbox(x)
        low = bb0[1] < -(180+tol)
	high = bb0[3] > (180+tol)
        bb1w = bb1e = bb0
	if (low) {
	    am = -180
            am_w = am - tol
	    am_e = am + tol
            if (am_w > 180) am_w = am_w - 360
	    bb1w[3] = am_w # 180 minus fuzz
	    bb1e[1] = am_e # 180 plus fuzz
            xw = st_intersection(x, st_as_sfc(bb1w))
	    xe = st_intersection(x, st_as_sfc(bb1e))
            gw = st_geometry(xw)
            gw = gw + c(360, 0)
	    st_crs(gw) <- xcrs
	    st_geometry(xw) <- gw
	    o = rbind(xw, xe)
	    x = aggregate(o, list(o$st_within_pm180_ID), head, 1)
	    x = x[, xnames]
	    st_crs(x) = xcrs
	}
	bb0 = st_bbox(x)
        bb1w = bb1e = bb0
	if (high) {
	    am = 180
            am_w = am - tol
	    am_e = am + tol
            if (am_w < -180) am_w = am_w + 360
	    bb1w[3] = am_w # 180 minus fuzz
	    bb1e[1] = am_e # 180 plus fuzz
            xw = st_intersection(x, st_as_sfc(bb1w))
	    xe = st_intersection(x, st_as_sfc(bb1e))
            ge = st_geometry(xe)
            ge = ge - c(360, 0)
	    st_crs(ge) <- xcrs
	    st_geometry(xe) <- ge
	    o = rbind(xw, xe)
	    x = aggregate(o, list(o$st_within_pm180_ID), head, 1)
	    x = x[, xnames]
	    st_crs(x) = xcrs
	}
	sf_use_s2(s2_status)
	st_crs(x) = xcrs
        x

}


================================================
FILE: R/cast_sfc.R
================================================
#' Cast geometry to another type: either simplify, or cast explicitly
#'
#' Cast geometry to another type: either simplify, or cast explicitly
#'
#' @param x object of class \code{sfg}, \code{sfc} or \code{sf}
#' @param to character; target type, if missing, simplification is tried; when \code{x} is of type \code{sfg} (i.e., a single geometry) then \code{to} needs to be specified.
#' @return object of class \code{to} if successful, or unmodified object if unsuccessful. If information gets lost while type casting, a warning is raised.
#' @examples
#' s = st_multipoint(rbind(c(1,0)))
#' st_cast(s, "POINT")
#' @export
st_cast <- function(x, to, ...) UseMethod("st_cast")

# see this figure:
# https://cloud.githubusercontent.com/assets/520851/21387553/5f1edcaa-c778-11e6-92d0-2d735e4c8e40.png
# columns start counting at 0:

which_sfc_col = function(cls) {
	stopifnot(!missing(cls))
	switch(cls,
		POINT = 0,
		LINESTRING = 1,
		MULTIPOINT = 1,
		MULTILINESTRING = 2,
		POLYGON = 2,
		MULTIPOLYGON = 3,
		MULTICURVE = 3,
		GEOMETRYCOLLECTION = 4,
		COMPOUNDCURVE = 4,
		MULTISURFACE = 4,
		CURVEPOLYGON = 4,
		GEOMETRY = 5,
		stop(paste("st_cast for", cls, "not supported"))
	)
}

# does this geometry type need closed polygons?
need_close = function(cls) {
	switch(cls,
		POLYGON = TRUE,
		MULTIPOLYGON = TRUE,
		FALSE
	)
}

# add y's attributes to x, return x
add_attributes = function(x, y) {
	attributes(x) = attributes(y)
	x
}

close_polygon_or_multipolygon = function(x, to) {
	to_col = which_sfc_col(to)
	close_mat = function(m) {
		if (any(m[1,] != m[nrow(m),]))
			m = rbind(m, m[1,])
		if (nrow(m) < 4)
			stop("polygons require at least 4 points")
		unclass(m)
	}
	add_attributes(
		if (to_col == 2)
			lapply(x, function(y) add_attributes(lapply(y, close_mat), y))
		else if (to_col == 3)
			lapply(x, function(y) add_attributes(lapply(y, function(z) lapply(z, close_mat)), y))
		else
			stop("invalid to_col value")
	, x)
}

# change the class of sfc x, and all its sfg list elements
# (vertical cast)
reclass = function(x, to, must_close) {
	l = if (length(x)) {
		full_cls = c(class(x[[1]])[1], to, "sfg")
		if (must_close)
			x = close_polygon_or_multipolygon(x, to)
		lapply(x, function(g) structure(g, class = full_cls))
	} else
		list()
	attributes(l) = attributes(x)
	structure(l, class = c(paste0("sfc_", to), "sfc"))
}

# how long is each geometry in the sfc?
get_lengths = function(x) {
	switch(class(x)[1],
		sfc_POINT = rep(1, length(x)),
		sfc_MULTIPOINT = vapply(x, nrow, 0L),
		sfc_LINESTRING = vapply(x, nrow, 0L),
		lengths(x) # list
	)
}

#' Coerce geometry to MULTI* geometry
#'
#' Mixes of POINTS and MULTIPOINTS, LINESTRING and MULTILINESTRING,
#' POLYGON and MULTIPOLYGON are returned as MULTIPOINTS, MULTILINESTRING and MULTIPOLYGONS respectively
#' @param x list of geometries or simple features
#' @details Geometries that are already MULTI* are left unchanged.
#' Features that can't be cast to a single  MULTI* geometry are return as a
#' GEOMETRYCOLLECTION
st_cast_sfc_default = function(x) {

	if (length(x) == 0)
		return(x)

	if (!identical(unique(vapply(x, function(w) class(w)[3L], "")), "sfg"))
		stop("list item(s) not of class sfg") # sanity check

	a <- attributes(x)
	ids = NULL
	cls = unique(vapply(x, function(x) class(x)[2L], ""))
	if (length(cls) > 1) {
		if (all(cls %in% c("POINT", "MULTIPOINT"))) {
			x <- lapply(x, function(x) if (inherits(x, "POINT")) POINT2MULTIPOINT(x) else x)
			class(x) <- c("sfc_MULTIPOINT", "sfc")
		} else if (all(cls %in% c("LINESTRING", "MULTILINESTRING"))) {
			x <- lapply(x, function(x) if (inherits(x, "LINESTRING")) LINESTRING2MULTILINESTRING(x) else x)
			class(x) <- c("sfc_MULTILINESTRING", "sfc")
		} else if (all(cls %in% c("POLYGON", "MULTIPOLYGON"))) {
			x <- lapply(x, function(x) if (inherits(x, "POLYGON")) POLYGON2MULTIPOLYGON(x) else x)
			class(x) <- c("sfc_MULTIPOLYGON", "sfc")
		}
	} else if (cls == "GEOMETRYCOLLECTION" && all(lengths(x))) { # https://github.com/r-spatial/sf/issues/1767
		ids = get_lengths(x)
		x <- do.call(st_sfc, unlist(x, recursive = FALSE))
	}
	attributes(x) <- a
	structure(st_sfc(x), ids = ids)
}

copy_sfc_attributes_from = function(x, ret) {
	structure(ret, precision = attr(x, "precision"),
		bbox = attr(x, "bbox"), crs = attr(x, "crs"), n_empty = attr(x, "n_empty"), 
		z_range = attr(x, "z_range"), m_range = attr(x, "m_range"))
}

empty_sfg <- function(to) {
	switch(to,
		   GEOMETRYCOLLECTION = st_geometrycollection(),
		   MULTIPOLYGON = st_multipolygon(),
		   POLYGON = st_polygon(),
		   MULTILINESTRING = st_multilinestring(),
		   LINESTRING = st_linestring(),
		   MULTIPOINT = st_multipoint(),
		   POINT = st_point()
	   )
}

is_exotic = function(x) {
	stopifnot(length(x) > 0)
	if (inherits(x, c("sfc_MULTICURVE", "sfc_COMPOUNDCURVE", "sfc_CURVEPOLYGON", "sfc_MULTISURFACE"))) # for which GEOS has no st_is_empty()
		TRUE
	else if (inherits(x, "sfc_GEOMETRY")) {
		cls = sapply(x, class)
		any(cls[2,] %in% c("MULTICURVE", "COMPOUNDCURVE", "CURVEPOLYGON", "MULTISURFACE"))
	} else
		FALSE
}

#' @name st_cast
#' @param ids integer vector, denoting how geometries should be grouped (default: no grouping)
#' @param group_or_split logical; if TRUE, group or split geometries; if FALSE, carry out a 1-1 per-geometry conversion.
#' @param ... ignored
#' @export
#' @return In case \code{to} is missing, \code{st_cast.sfc} will coerce combinations of "POINT" and "MULTIPOINT", "LINESTRING" and "MULTILINESTRING", "POLYGON" and "MULTIPOLYGON" into their "MULTI..." form, or in case all geometries are "GEOMETRYCOLLECTION" will return a list of all the contents of the "GEOMETRYCOLLECTION" objects, or else do nothing. In case \code{to} is specified, if \code{to} is "GEOMETRY", geometries are not converted, else, \code{st_cast} will try to coerce all elements into \code{to}; \code{ids} may be specified to group e.g. "POINT" objects into a "MULTIPOINT", if not specified no grouping takes place. If e.g. a "sfc_MULTIPOINT" is cast to a "sfc_POINT", the objects are split, so no information gets lost, unless \code{group_or_split} is \code{FALSE}.
#' @details When converting a GEOMETRYCOLLECTION to COMPOUNDCURVE, MULTISURFACE or CURVEPOLYGON, the user is responsible for the validity of the resulting object: no checks are being carried out by the software.
#' 
#' When converting mixed, GEOMETRY sets, it may help to first convert to the MULTI-type, see examples
#' @examples
#' # https://github.com/r-spatial/sf/issues/1930:
#' pt1 <- st_point(c(0,1))
#' pt23 <- st_multipoint(matrix(c(1,2,3,4), ncol = 2, byrow = TRUE))
#' d <- st_sf(geom = st_sfc(pt1, pt23))
#' st_cast(d, "POINT") # will not convert the entire MULTIPOINT, and warns
#' st_cast(d, "MULTIPOINT") |> st_cast("POINT")
st_cast.sfc = function(x, to, ..., ids = seq_along(x), group_or_split = TRUE) {

	if (missing(to))
		return(st_cast_sfc_default(x))

	if (length(x) == 0) # empty set
		return(structure(x, class = c(paste0("sfc_", to), "sfc")))

	e = rep(FALSE, length(x))
	if (!is_exotic(x)) { # for which GEOS has no st_is_empty()
		e = st_is_empty(x)
		if (all(e)) {
			x[e] = empty_sfg(to)
			return(x) # RETURNS
		}
	}
	if (any(e))
		x = x[!e]
	from_cls = substr(class(x)[1], 5, 100)
	from_col = which_sfc_col(from_cls)
	to_col = which_sfc_col(to)
	ret = if (from_cls == to)
		x # returns x: do nothing
	else if (to == "GEOMETRY") # we can always do that:
		structure(x, class = c("sfc_GEOMETRY", "sfc"))
	else if (from_cls == "GEOMETRY" || !group_or_split)
		st_sfc(lapply(x, st_cast, to = to), crs = st_crs(x), precision = st_precision(x))
	else if (from_col == to_col) # "vertical" conversion: only reclass, possibly close polygons
		reclass(x, to, need_close(to))
	else if (abs(from_col - to_col) > 1) {
		if (to == "POINT")
			st_cast(st_cast(x, "MULTIPOINT"), "POINT")
		else if (to == "MULTIPOINT") {
			ret = lapply(x, function(y) structure(as.matrix(y), class = c(class(y)[1], to, "sfg")))
			ret = copy_sfc_attributes_from(x, ret)
			reclass(ret, to, FALSE)
		} else
			#st_cast(st_cast(x, "MULTILINESTRING"), to)
			stop("use smaller steps for st_cast; first cast to MULTILINESTRING or POLYGON?")
	} else if (from_col < to_col) { # "horizontal", to the right: group
		ret = if (from_col == 0)
				lapply(unname(split(x, ids)), function(y) structure(do.call(rbind, y), 
					class = class(x[[1]])))
			else
				lapply(unname(split(x, ids)), function(y) structure(y, class = class(x[[1]])))
		ret = copy_sfc_attributes_from(x, ret)
		reclass(ret, to, need_close(to))
	} else if (from_col == 3 && to == "MULTILINESTRING") {
		if (from_cls == "MULTICURVE") {
			ret = lapply(x, st_cast, to = "MULTILINESTRING")
		} else {
			ret = lapply(x, unlist, recursive = FALSE) # unlist one level deeper; one MULTIPOLYGON -> one MULTILINESTRING
			if (length(ret))
				class(ret[[1]]) = class(x[[1]]) # got dropped
		}
		ret = copy_sfc_attributes_from(x, ret)
		structure(reclass(ret, to, FALSE))
	} else { # "horizontal", to the left: split
		ret = if (from_col == 1) # LINESTRING or MULTIPOINT to POINT
				unlist(lapply(x, function(m) lapply(seq_len(nrow(m)), function(i) m[i,])), recursive = FALSE)
			else {
				if (to_col == 0 && from_cls == "POLYGON") # POLYGON -> POINT
					lapply(x, function(y) do.call(rbind, y))
				else
					unlist(x, recursive = FALSE)
			}
		ret = lapply(ret, function(y) structure(y, class = class(x[[1]]))) # will be reset by reclass()
		ret = copy_sfc_attributes_from(x, ret)
		# EJP: FIXME:
		structure(reclass(ret, to, need_close(to)), ids = get_lengths(x))
	}
	if (any(e)) {
		crs = st_crs(x)
		x = vector("list", length = length(e))
		x[e] = list(empty_sfg(to))
		x[!e] = ret
		st_set_crs(do.call(st_sfc, x), crs)
	} else
		ret
}

#' @name st_cast
#' @param warn logical; if \code{TRUE}, warn if attributes are assigned to sub-geometries
#' @param do_split logical; if \code{TRUE}, allow splitting of geometries in sub-geometries
#' @export
#' @details the \code{st_cast} method for \code{sf} objects can only split geometries, e.g. cast \code{MULTIPOINT} into multiple \code{POINT} features.  In case of splitting, attributes are repeated and a warning is issued when non-constant attributes are assigned to sub-geometries. To merge feature geometries and attribute values, use \link[sf:aggregate.sf]{aggregate} or \link[sf:tidyverse]{summarise}.
st_cast.sf = function(x, to, ..., warn = TRUE, do_split = TRUE) {
	geom = st_cast(st_geometry(x), to, group_or_split = do_split)
	agr = st_agr(x)
	all_const = all_constant(x)
	sf_column = attr(x, "sf_column") # keep name
	st_geometry(x) = NULL
	# class(x) = setdiff(class(x), "sf")
	ids = attr(geom, "ids")          # e.g. 3 2 4
	if (!is.null(ids)) { # split:
		if (warn && ! all_const)
			warning("repeating attributes for all sub-geometries for which they may not be constant")
		reps = rep(seq_len(length(ids)), ids) # 1 1 1 2 2 3 3 3 3 etc
		agr[agr == "identity"] = "constant" # since we splitted
		x = x[reps,, drop = FALSE]
		stopifnot(nrow(x) == length(geom))
	}
	attr(geom, "ids") = NULL # remove
	x[[sf_column]] = geom
	st_geometry(x) = sf_column
	st_agr(x) = agr
	x
}

#' @name st_cast
#' @export
st_cast.sfc_CIRCULARSTRING <- function(x, to, ...) {
	if (isTRUE(st_is_longlat(x)))
		message_longlat("st_cast")
	stopifnot(to == "LINESTRING")
	st_sfc(CPL_circularstring_to_linestring(st_sfc(x)), crs = st_crs(x)) # should add attributes?
}

#' test equality between the geometry type and a class or set of classes
#'
#' test equality between the geometry type and a class or set of classes
#' @param x object of class \code{sf}, \code{sfc} or \code{sfg}
#' @param type character; class, or set of classes, to test against
#' @examples
#' st_is(st_point(0:1), "POINT")
#' sfc = st_sfc(st_point(0:1), st_linestring(matrix(1:6,,2)))
#' st_is(sfc, "POINT")
#' st_is(sfc, "POLYGON")
#' st_is(sfc, "LINESTRING")
#' st_is(st_sf(a = 1:2, sfc), "LINESTRING")
#' st_is(sfc, c("POINT", "LINESTRING"))
#' @export
st_is = function(x, type) UseMethod("st_is")

#' @export
st_is.sf = function(x, type)
	st_is(st_geometry(x), type)

#' @export
st_is.sfc = function(x, type)
	vapply(x, inherits, type, FUN.VALUE = logical(1))

#' @export
st_is.sfg = function(x, type)
	inherits(x, type)


================================================
FILE: R/cast_sfg.R
================================================
## utility functions, patterns that are either used elsewhere or can be 
##  replaced by other changes 
## 
## worker functions from the internals of c.sfg
##  to unclass the underlying coordinates
Paste0 <- function(lst) lapply(lst, unclass)
##
## drop the tail coordinate of a polygon ring
Tail1 <- function(lst) lapply(lst, head, -1)

ClosePol <- function(mtrx) { 
	stopifnot(is.matrix(mtrx))
	if (!all(mtrx[1,] == mtrx[nrow(mtrx),])) 
		mtrx = rbind(mtrx, mtrx[1,]) 
	if (nrow(mtrx) < 4)
		stop("polygons require at least 4 points")
	mtrx
}

## multi-polygon and polygon constructor, allow unclosed (but don't apply auto-closing)
## note use of local constructor below, not the sf-API one
#st_multipolygon_close <- function(x = list(), dim = "XYZ") {
#	MtrxSetSet(x, dim, type = "MULTIPOLYGON", needClosed = FALSE)
#}

#st_polygon_close <- function(x = list(), dim = "XYZ") {
#	MtrxSet(x, dim, type = "POLYGON", needClosed = FALSE)
#}

# TODO
# FIXME: warn on multi-part loss only if there are multiple parts
# disallow auto-polygon-closure for two-point inputs:  st_cast(st_linestring(cbind(0, 1:2)), "POLYGON")
# -> that should give an error
# check discussions, holes become lines, those lines become overlapping islands, or does polygonize auto-detect nesting
##  and assign holes to islands as sp-comments did?
# test on holes
# warnings on these individual tests as here, or on detection of loss higher up?
# geometrycollection conversions?
# check comments and warnings are consistent in each case below

#' @name st_cast
#' @export
#' @examples 
#' # example(st_read)
#' nc = st_read(system.file("shape/nc.shp", package="sf"))
#' mpl <- st_geometry(nc)[[4]]
#' #st_cast(x) ## error 'argument "to" is missing, with no default'
#' cast_all <- function(xg) {
#'   lapply(c("MULTIPOLYGON", "MULTILINESTRING", "MULTIPOINT", "POLYGON", "LINESTRING", "POINT"), 
#'       function(x) st_cast(xg, x))
#' }
#' st_sfc(cast_all(mpl))
#' ## no closing coordinates should remain for multipoint
#' any(duplicated(unclass(st_cast(mpl, "MULTIPOINT"))))  ## should be FALSE
#' ## number of duplicated coordinates in the linestrings should equal the number of polygon rings 
#' ## (... in this case, won't always be true)
#' sum(duplicated(do.call(rbind, unclass(st_cast(mpl, "MULTILINESTRING"))))
#'      ) == sum(unlist(lapply(mpl, length)))  ## should be TRUE
#' 
#' p1 <- structure(c(0, 1, 3, 2, 1, 0, 0, 0, 2, 4, 4, 0), .Dim = c(6L, 2L))
#' p2 <- structure(c(1, 1, 2, 1, 1, 2, 2, 1), .Dim = c(4L, 2L))
#' st_polygon(list(p1, p2))
st_cast.MULTIPOLYGON <- function(x, to, ...) {
	switch(to, 
		MULTIPOLYGON = x, 
		MULTILINESTRING = st_multilinestring(     unlist(Paste0(x), recursive = FALSE, use.names = FALSE)), 
		MULTIPOINT = st_multipoint(do.call(rbind, Tail1(unlist(Paste0(x), recursive = FALSE, use.names = FALSE)))), 
         ## loss, drop to first part
		POLYGON = {
		 	if (length(x) > 1)
				warning("polygon from first part only")
			st_polygon(x[[1L]])
		}, 
		LINESTRING = {warning("line from first ring only"); st_linestring(x[[1L]][[1L]])}, 
		## loss, drop to first coordinate of first ring of first part
		POINT = {warning("point from first coordinate only"); st_point(x[[1L]][[1L]][1L, , drop = TRUE])},
		GEOMETRYCOLLECTION = st_geometrycollection(list(x))
	)
}

#' @name st_cast
#' @export
#' @examples 
#' mls <- st_cast(st_geometry(nc)[[4]], "MULTILINESTRING")
#' st_sfc(cast_all(mls))
st_cast.MULTILINESTRING <- function(x, to, ...) {
	switch(to, 
		MULTIPOLYGON = st_multipolygon(list(lapply(x, ClosePol))), 
		MULTILINESTRING = x, 
		MULTIPOINT = st_multipoint(do.call(rbind, Paste0(x))), 
		## loss, drop to first line
		#POLYGON = {warning("keeping first linestring only"); st_polygon(x[1L])}, 
		POLYGON = st_polygon(lapply(x, ClosePol)),
		LINESTRING = {
			if (length(x) > 1)
				warning("keeping first linestring only")
			st_linestring(x[[1L]])
		},
		## loss, drop to first coordinate of first line 
		POINT = {
			warning("keeping first coordinate only")
			st_point(x[[1L]][1L, , drop = TRUE])
		},
		GEOMETRYCOLLECTION = st_geometrycollection(list(x))
	)
}

#' @name st_cast
#' @export
#' @examples
#' mpt <- st_cast(st_geometry(nc)[[4]], "MULTIPOINT")
#' st_sfc(cast_all(mpt))
st_cast.MULTIPOINT <- function(x, to, ...) {
  switch(to, 
         ## DANGER: polygon, linestring forms unlikely to be valid
         MULTIPOLYGON = st_multipolygon(list(list(ClosePol(unclass(x))))), 
         MULTILINESTRING = st_multilinestring(list(unclass(x))), 
         MULTIPOINT = x, 
         POLYGON = st_polygon(list(unclass(ClosePol(x)))), 
         LINESTRING = st_linestring(unclass(x)),
         ## loss, drop to first coordinate
         POINT = {
             if (st_is_empty(x)) {
                 row <- NA_integer_
             } else {
	             warning("point from first coordinate only")
                 row <- 1L
             }
             st_point(unclass(x)[row, , drop = TRUE])
         },
		 GEOMETRYCOLLECTION = st_geometrycollection(list(x))
  )
}

#' @name st_cast
#' @export
#' @examples
#' pl <- st_cast(st_geometry(nc)[[4]], "POLYGON")
#' st_sfc(cast_all(pl))
st_cast.POLYGON <- function(x, to, ...) {
  switch(to, 
         MULTIPOLYGON = {
			 if (length(x))
				x = list(lapply(Paste0(x), ClosePol))
			 st_multipolygon(x)
		 },
         MULTILINESTRING = st_multilinestring(unclass(x)), 
         MULTIPOINT = st_multipoint(Tail1(unclass(x))[[1L]]), 
         POLYGON = x, 
         LINESTRING = st_linestring(unclass(x)[[1L]]),
         POINT = {warning("point from first coordinate only"); st_point(unclass(x)[[1L]][1L, , drop = TRUE])},
		 GEOMETRYCOLLECTION = st_geometrycollection(list(x))
  )
}

#' @name st_cast
#' @export
#' @examples
#' ls <- st_cast(st_geometry(nc)[[4]], "LINESTRING")
#' st_sfc(cast_all(ls))
st_cast.LINESTRING <- function(x, to, ...) {
  switch(to, 
         MULTIPOLYGON = st_multipolygon(list(list(ClosePol(unclass(x))))), 
         MULTILINESTRING = st_multilinestring(list(unclass(x))), 
         MULTIPOINT = st_multipoint(unclass(x)), 
         POLYGON = st_polygon(list(unclass(ClosePol(x)))), 
         LINESTRING = x,
         POINT = {warning("point from first coordinate only"); st_point(unclass(x)[1L, , drop = TRUE])},
		 GEOMETRYCOLLECTION = st_geometrycollection(list(x))
  )
}

#' @name st_cast
#' @export
#' @examples
#' pt <- st_cast(st_geometry(nc)[[4]], "POINT")
#' ## st_sfc(cast_all(pt))  ## Error: cannot create MULTIPOLYGON from POINT 
#' st_sfc(lapply(c("POINT", "MULTIPOINT"), function(x) st_cast(pt, x)))
st_cast.POINT <- function(x, to, ...) {
  switch(to, 
         MULTIPOLYGON = stop("cannot create MULTIPOLYGON from POINT"), 
         MULTILINESTRING = stop("cannot create MULTILINESTRING from POINT"), 
         MULTIPOINT = st_multipoint(matrix(unclass(x), nrow = 1L)), 
         POLYGON = stop("cannot create POLYGON from POINT"), 
         LINESTRING = stop("cannot create LINESTRING from POINT"),
         POINT = x,
		 GEOMETRYCOLLECTION = st_geometrycollection(list(x))
  )
}

#' @name st_cast
#' @export
st_cast.GEOMETRYCOLLECTION <- function(x, to, ...) {
  switch(to, 
  	GEOMETRYCOLLECTION = x,
  	{
		if (length(x) > 1)
			warning("only first part of geometrycollection is retained")
		st_cast(x[[1]], to, ...)
	}
  )
}

#' @name st_cast
#' @export
st_cast.CIRCULARSTRING <- function(x, to, ...) {
	if (to != "LINESTRING")
		stop("CIRCULARSTRING can only be converted into LINESTRING")
	CPL_circularstring_to_linestring(structure(list(x), crs = NA_crs_, precision = 0.0, 
		class = c("sfc_CIRCULARSTRING", "sfc")))[[1]]
}

#' @name st_cast
#' @export
st_cast.MULTISURFACE <- function(x, to, ...) {
	if (! missing(to) && to != "MULTIPOLYGON")
		stop("MULTISURFACE can only be converted into MULTIPOLYGON")
	CPL_multisurface_to_multipolygon(structure(list(x), crs = NA_crs_, precision = 0.0, 
		class = c("sfc_MULTISURFACE", "sfc")))[[1]]
}

#' @name st_cast
#' @export
st_cast.COMPOUNDCURVE <- function(x, to, ...) {
	if (! missing(to) && to != "LINESTRING")
		stop("to should be missing or LINESTRING")
	CPL_compoundcurve_to_linear(structure(list(x), crs = NA_crs_, precision = 0.0, 
		class = c("sfc_COMPOUNDCURVE", "sfc")))[[1]]
}

#' @name st_cast
#' @export
st_cast.MULTICURVE <- function(x, to, ...) {
	if (! missing(to) && to != "MULTILINESTRING")
		stop("to should be missing or MULTILINESTRING")
	st_multilinestring(lapply(x, st_cast, to = "LINESTRING"))
}


#' @name st_cast
#' @export
st_cast.CURVE <- function(x, to, ...) { # nocov start
	if (! missing(to) && to != "LINESTRING")
		stop("CURVE can only be converted into LINESTRING")
	CPL_curve_to_linestring(structure(list(x), crs = NA_crs_, precision = 0.0, 
		class = c("sfc_CURVE", "sfc")))[[1]]
} # nocov end

# st_cast.class <- function(x, to) {
#   switch(to, 
#          MULTIPOLYGON = x, 
#          MULTILINESTRING = x, 
#          MULTIPOINT = x, 
#          POLYGON = x, 
#          LINESTRING = x,
#          POINT = x
#   )
# }



================================================
FILE: R/collection_extract.R
================================================
#' Given an object with geometries of type \code{GEOMETRY} or \code{GEOMETRYCOLLECTION},
#' return an object consisting only of elements of the specified type.
#'
#' Similar to ST_CollectionExtract in PostGIS. If there are no sub-geometries
#' of the specified type, an empty geometry is returned.
#'
#' @param x an object of class \code{sf}, \code{sfc} or \code{sfg} that has
#' mixed geometry (\code{GEOMETRY} or \code{GEOMETRYCOLLECTION}).
#' @param type character; one of "POLYGON", "POINT", "LINESTRING"
#' @param warn logical; if \code{TRUE}, warn if attributes are assigned to
#' sub-geometries when casting (see \code{\link{st_cast}})
#'
#' @return An object having the same class as \code{x}, with geometries
#' consisting only of elements of the specified type.
#' For \code{sfg} objects, an \code{sfg} object is returned if there is only
#' one geometry of the specified type, otherwise the geometries are combined
#' into an \code{sfc} object of the relevant type. If any subgeometries in the
#' input are MULTI, then all of the subgeometries in the output will be MULTI.
#'
#' @export
#'
#' @examples
#' pt <- st_point(c(1, 0))
#' ls <- st_linestring(matrix(c(4, 3, 0, 0), ncol = 2))
#' poly1 <- st_polygon(list(matrix(c(5.5, 7, 7, 6, 5.5, 0, 0, -0.5, -0.5, 0), ncol = 2)))
#' poly2 <- st_polygon(list(matrix(c(6.6, 8, 8, 7, 6.6, 1, 1, 1.5, 1.5, 1), ncol = 2)))
#' multipoly <- st_multipolygon(list(poly1, poly2))
#'
#' i <- st_geometrycollection(list(pt, ls, poly1, poly2))
#' j <- st_geometrycollection(list(pt, ls, poly1, poly2, multipoly))
#'
#' st_collection_extract(i, "POLYGON")
#' st_collection_extract(i, "POINT")
#' st_collection_extract(i, "LINESTRING")
#'
#' ## A GEOMETRYCOLLECTION
#' aa <- rbind(st_sf(a=1, geom = st_sfc(i)),
#' 			st_sf(a=2, geom = st_sfc(j)))
#'
#' ## With sf objects
#' st_collection_extract(aa, "POLYGON")
#' st_collection_extract(aa, "LINESTRING")
#' st_collection_extract(aa, "POINT")
#'
#' ## With sfc objects
#' st_collection_extract(st_geometry(aa), "POLYGON")
#' st_collection_extract(st_geometry(aa), "LINESTRING")
#' st_collection_extract(st_geometry(aa), "POINT")
#'
#' ## A GEOMETRY of single types
#' bb <- rbind(
#' 	st_sf(a = 1, geom = st_sfc(pt)),
#' 	st_sf(a = 2, geom = st_sfc(ls)),
#' 	st_sf(a = 3, geom = st_sfc(poly1)),
#' 	st_sf(a = 4, geom = st_sfc(multipoly))
#' )
#'
#' st_collection_extract(bb, "POLYGON")
#'
#' ## A GEOMETRY of mixed single types and GEOMETRYCOLLECTIONS
#' cc <- rbind(aa, bb)
#'
#' st_collection_extract(cc, "POLYGON")
#'
st_collection_extract = function(x, type = c("POLYGON", "POINT", "LINESTRING"), warn = FALSE) {
	UseMethod("st_collection_extract")
}

#' @name st_collection_extract
#'
#' @export
st_collection_extract.sfg = function(x, type = c("POLYGON", "POINT", "LINESTRING"), warn = FALSE) {
	type = match.arg(type)
	types = c(type, paste0("MULTI", type))

	if (inherits(x, types)) {
		warning("x is already of type ", type, ".")
		return(x)
	}

	if (!inherits(x, "GEOMETRYCOLLECTION")) {
		stop("x is of singular geometry type that is different to supplied type: ", type) # nocov
	}

	# Find the geometries of the specified type and extract into a list
	matches = vapply(x, st_is, types, FUN.VALUE = logical(1))
	x_types = x[which(matches)]
	if (length(x_types) == 0L) {
		## return an empty sfg of the specified type
		warning("x contains no geometries of specified type")
		return(typed_empty(paste0("sfc_", type)))
	} else if (length(x_types) == 1L) {
		# Get the contents of the first (only) list element which is an sfg
		return(x_types[[1]])
	} else {
		# turn list into an sfc, and cast it to single type. Will be multi
		# if any are multi
		return(st_cast(st_sfc(x_types), warn = warn))
	}
}

#' @name st_collection_extract
#'
#' @export
st_collection_extract.sfc = function(x, type = c("POLYGON", "POINT", "LINESTRING"), warn = FALSE) {
	type = match.arg(type)
	types = c(type, paste0("MULTI", type))

	if (length(x) == 0)
		return(x)

	# Check it's not already what user is asking for
	if (inherits(st_geometry(x), paste0("sfc_", types))) {
		warning("x is already of type ", type, ".") # nocov
		return(x)                                   # nocov
	}

	if (!inherits(st_geometry(x), c("sfc_GEOMETRY", "sfc_GEOMETRYCOLLECTION"))) {
		stop("x is of singular geometry type that is different to supplied type: ", type)
	}

	# Cast to GEOMETRYCOLLECTION if is GEOMETRY)
	if (inherits(st_geometry(x), "sfc_GEOMETRY")) {
		x = st_cast(x, "GEOMETRYCOLLECTION")
	}

	## Cast GEOMETRYCOLLECTION into all components
	gc_casted = st_cast(x, warn = warn)

	## Keep only components that match input type
	if (inherits(gc_casted, "sf")) {
		gc_types = gc_casted[st_is(gc_casted, types), ]
	} else {
		gc_types = gc_casted[st_is(gc_casted, types)]
	}

	## Cast to specified (MULTI) type

	if (length(st_geometry(gc_types)) == 0L) {
		warning("x contains no geometries of specified type")
		return(gc_types)
	}

	st_cast(gc_types, warn = warn)
}

#' @name st_collection_extract
#'
#' @export
st_collection_extract.sf = st_collection_extract.sfc


================================================
FILE: R/crop.R
================================================

#' crop an sf object to a specific rectangle
#' @param x object of class \code{sf} or \code{sfc}
#' @param y numeric vector with named elements \code{xmin}, \code{ymin}, \code{xmax} and \code{ymax}, or object of class \code{bbox}, or object for which there is an \link{st_bbox} method to convert it to a \code{bbox} object
#' @param ... ignored
#' @details
#' setting arguments \code{xmin}, \code{ymin}, \code{xmax} and \code{ymax} implies that argument \code{y} gets ignored.
#' @export
#' @examples
#' box = c(xmin = 0, ymin = 0, xmax = 1, ymax = 1)
#' pol = st_sfc(st_buffer(st_point(c(.5, .5)), .6))
#' pol_sf = st_sf(a=1, geom=pol)
#' plot(st_crop(pol, box))
#' plot(st_crop(pol_sf, st_bbox(box)))
#' # alternative:
#' plot(st_crop(pol, xmin = 0, ymin = 0, xmax = 1, ymax = 1))
#' @export
st_crop = function(x, y, ...) UseMethod("st_crop")

#' @export
#' @name st_crop
#' @param xmin minimum x extent of cropping area
#' @param ymin minimum y extent of cropping area
#' @param xmax maximum x extent of cropping area
#' @param ymax maximum y extent of cropping area
st_crop.sfc = function(x, y, ..., xmin, ymin, xmax, ymax) {
	if (!missing(xmin) && !missing(ymin) && !missing(xmax) && !missing(ymax))
		y = c(xmin = xmin, ymin = ymin, xmax = xmax, ymax = ymax)
	if (! inherits(y, "bbox"))
		y = st_bbox(y)
	if (is.na(st_crs(y)))
		y = structure(y, crs = st_crs(x))
	st_intersection(x, st_as_sfc(y))
}

#' @export
#' @name st_crop
st_crop.sf = function(x, y, ...) {
	st_crop.sfc(x, y, ...)
}


================================================
FILE: R/crs.R
================================================
#  alternative, but more limiting from sp/R/CRS-methods.R, https://github.com/edzer/sp/pull/31 @hughjonesd
#  (no longer used)
#identicalCRS1 = function(x, y) {
#  args_x <- strsplit(x, " +")[[1]]
#  args_y <- strsplit(y, " +")[[1]]
#  setequal(args_x, args_y)
#}

# this function establishes whether two crs objects are semantically identical. This is
# the case when: (1) they are completely identical (including NA), or (2) GDAL considers
# them equivalent
#' @export
Ops.crs <- function(e1, e2) {
	if (nargs() == 1)
		stop(paste("unary", .Generic, "not defined for \"crs\" objects"), call. = FALSE)

	cmp <- switch(.Generic, "==" =, "!=" = TRUE, FALSE)
	if (!cmp)
		stop(paste("operation", .Generic, "not supported for crs objects"), call. = FALSE)
	if (.Generic == "!=")
		!(e1 == e2)
	else { # "==": check semantic equality
		if (isTRUE(all.equal(e1, e2))) # includes both are NA_crs_
			TRUE
		else if (is.na(e1) || is.na(e2)) # only one of them is NA_crs_
			FALSE
		else
			isTRUE(try(CPL_crs_equivalent(e1, e2), silent = TRUE)) # use GDAL's srs1->IsSame(srs2)
	}
}

#' Retrieve coordinate reference system from object
#'
#' Retrieve coordinate reference system from sf or sfc object
#' @name st_crs
#' @param x numeric, character, or object of class \link{sf} or \link{sfc}
#' @param ... ignored
#' @export
#' @return If \code{x} is numeric, return \code{crs} object for EPSG:\code{x};
#' if \code{x} is character, return \code{crs} object for \code{x};
#' if \code{x} is of class \code{sf} or \code{sfc}, return its \code{crs} object.
#' @details The *crs functions create, get, set or replace the \code{crs} attribute
#' of a simple feature geometry list-column. This attribute is of class \code{crs},
#' and is a list consisting of \code{input} (user input, e.g. "EPSG:4326" or "WGS84"
#' or a proj4string), and \code{wkt}, an automatically generated wkt2 representation of the crs.
#' If \code{x} is identical to the wkt2 representation, and the CRS has a name, this name
#' is used for the \code{input} field.
#'
#' Comparison of two objects of class \code{crs} uses the GDAL function
#' \code{OGRSpatialReference::IsSame}.
#' @return Object of class \code{crs}, which is a list with elements \code{input} (length-1 character)
#' and \code{wkt} (length-1 character).
#' Elements may be \code{NA} valued; if all elements are \code{NA} the CRS is missing valued, and coordinates are
#' assumed to relate to an arbitrary Cartesian coordinate system.
st_crs = function(x, ...) UseMethod("st_crs")

#' @name st_crs
#' @export
st_crs.sf = function(x, ...) st_crs(st_geometry(x), ...)

#' @name st_crs
#' @export
st_crs.numeric = function(x, ...) {
	if (!is.finite(x))
		NA_crs_
	else
    	make_crs(paste0("EPSG:", x))
}


#' @name st_crs
#' @export
st_crs.character = function(x, ...) {
	if (is.na(x))
		NA_crs_
	else {
		crs = make_crs(x)
		if (is.na(crs))
			stop(paste("invalid crs:", x))
		# if we input wkt2, and CRS has a name, use it:
		if (identical(x, crs$wkt) && !identical(crs$Name, "unknown"))
			crs$input = crs$Name
		crs
	}
}

fix_crs = function(x) {
	if (all(c("epsg", "proj4string") %in% names(x))) {
		message("old-style crs object detected; please recreate object with a recent sf::st_crs()")
		x = unclass(x)
		if (!is.na(x$epsg))
			st_crs(x$epsg)
		else
			st_crs(x$proj4string)
	} else
		x
}


#' @name st_crs
#' @param parameters logical; \code{FALSE} by default; only for the `st_crs.sfc()` method: if \code{TRUE} return a classed list of coordinate reference system parameters, with named elements \code{SemiMajor}, \code{InvFlattening}, \code{units_gdal}, \code{IsVertical}, \code{WktPretty}, \code{Wkt}, \code{Name}, \code{proj4string}, \code{epsg}, \code{yx}, \code{ProjJson}, \code{WKT1_ESRI}, \code{srid} (in authority:code form), \code{axes} (a data.frame with columns \code{name} and \code{orientation}), \code{gcs_crs} with the WKT of the base geographic coordinate system, \code{ud_unit}. The list has class \code{crs_parameters}.
#' @export
st_crs.sfc = function(x, ..., parameters = FALSE) {
	crs = fix_crs(attr(x, "crs"))
	if (isTRUE(parameters)) {
		p = crs_parameters(crs)
		p$ud_unit = crs_ud_unit(crs)
		p
	} else
		crs
}

#' @name st_crs
#' @export
st_crs.bbox = function(x, ...) {
	crs = attr(x, "crs")
	if (is.null(crs))
		NA_crs_
	else
		crs
}

#' @name st_crs
#' @export
st_crs.CRS = function(x, ...) {
	if (is.null(comment(x)) || CPL_proj_version() < "6.0.0" || 
			CPL_gdal_version() < "3.0.0")
		st_crs(x@projargs)
	else {
		ret = st_crs(comment(x))
		name = ret$Name
		ret$input = if (name == "unknown")
				x@projargs
			else
				name
		ret
	}
}

#' @name st_crs
#' @export
st_crs.crs = function(x, ...) x

#' @export
st_crs.default = function(x, ...) NA_crs_

#' Set or replace coordinate reference system from object
#'
#' Set or replace retrieve coordinate reference system from object
#' @name st_crs
#' @param value one of (i) character: a string accepted by GDAL, (ii) integer, a valid EPSG value (numeric), or (iii) an object of class \code{crs}.
#' @details In case a coordinate reference system is replaced, no transformation takes
#' place and a warning is raised to stress this.
#'
#' @export
`st_crs<-` = function(x, value) UseMethod("st_crs<-")

#' @name st_crs
#' @examples
#' sfc = st_sfc(st_point(c(0,0)), st_point(c(1,1)))
#' sf = st_sf(a = 1:2, geom = sfc)
#' st_crs(sf) = 4326
#' st_geometry(sf)
#' @export
`st_crs<-.sf` = function(x, value) {
	st_crs(x[[ attr(x, "sf_column") ]]) = value
	x
}

# return crs object from crs, integer, or character string
make_crs = function(x) {

	if (inherits(x, "CRS")) {
		x = if (is.null(comment(x)) || (CPL_proj_version() < "6.0.0" || 
                    CPL_gdal_version() < "3.0.0"))

				x@projargs
			else
				comment(x) # WKT2
	}
	if (is.numeric(x) && !is.na(x))
		x = paste0("EPSG:", x)
	# return:
	if (is.na(x))
		NA_crs_
	else if (inherits(x, "crs"))
		x
	else if (is.character(x)) {
		if (grepl("+init=epsg:", x) &&
				compareVersion(sf_extSoftVersion()[["proj.4"]], "6.0.0") >= 0 &&
				compareVersion(sf_extSoftVersion()[["proj.4"]], "6.3.1") < 0) { # nocov start FIXME:
			x = strsplit(x, " ")[[1]]
			if (length(x) > 1)
				warning(paste("the following proj4string elements are ignored:",
					paste(x[-1], collapse = " "), "; remove the +init=epsg:XXXX to undo this"))
			x = paste0("EPSG:", as.integer(substr(x[1], 12, 20))) # nocov end
		}
		CPL_crs_from_input(x)
	} else
		stop(paste("cannot create a crs from an object of class", class(x)), call. = FALSE)
}

#' @name st_crs
#' @examples
#' sfc = st_sfc(st_point(c(0,0)), st_point(c(1,1)))
#' st_crs(sfc) = 4326
#' sfc
#' @export
`st_crs<-.sfc` = function(x, value) {

	if (is.null(attr(x, "crs")))
		start_crs = NA_crs_
	else
		start_crs = st_crs(x)

	end_crs = make_crs(value)

	if (!is.na(start_crs) && !is.na(end_crs) && start_crs != end_crs)
		warning("st_crs<- : replacing crs does not reproject data; use st_transform for that", call. = FALSE)

	if (is.na(end_crs) && !is.na(start_crs) && isTRUE(st_is_longlat(start_crs)) && any(st_is_full(x)))
		stop("To set the crs to NA, first remove the full polygons; see: st_is_full()")

	structure(x, crs = end_crs)
}

#' @export
`st_crs<-.bbox` = function(x, value) {
	structure(x, crs = make_crs(value))
}


#' @name st_crs
#' @examples
#' sfc = st_sfc(st_point(c(0,0)), st_point(c(1,1)))
#' sfc |> st_set_crs(4326) |> st_transform(3857)
#' @export
st_set_crs = function(x, value) {
	st_crs(x) = value
	x
}

#' Assert whether simple feature coordinates are longlat degrees
#'
#' Assert whether simple feature coordinates are longlat degrees
#' @param x object of class \link{sf} or \link{sfc}, or otherwise an object of a class that has an \link{st_crs} method returning a \code{crs} object
#' @return `TRUE` if `x` has geographic coordinates, `FALSE` if it has projected coordinates, or `NA` if \code{is.na(st_crs(x))}.
#' @export
st_is_longlat = function(x) {
	crs = st_crs(x)
	if (is.na(crs))
		NA
	else {
		ret = crs_parameters(crs)$IsGeographic
		if (ret && inherits(x, c("sf", "sfc", "stars")) && !is.null(attr(x, "bbox"))) {
			bb = st_bbox(x)
			# check for potentially meaningless value range:
			eps = sqrt(.Machine$double.eps)
			if (all(!is.na(unclass(bb))) &&
					(bb["xmin"] < (-180-eps) || bb["xmax"] > (360+eps) || bb["ymin"] < (-90-eps) || bb["ymax"] > (90+eps)))
				warning("bounding box has potentially an invalid value range for longlat data")
		}
		ret
	}
}

# a = "b" => a is the proj.4 unit (try: cs2cs -lu); "b" is the udunits2 unit
udunits_from_proj = list(
#   PROJ.4     UDUNITS
	`km` =     as_units("km"),
	`m` =      as_units("m"),
	`dm` =     as_units("dm"),
	`cm` =     as_units("cm"),
	`mm` =     as_units("mm"),
	`kmi` =    as_units("nautical_mile"),
	`in` =     as_units("in"),
	`ft` =     as_units("ft"),
	`yd` =     as_units("yd"),
	`mi` =     as_units("mi"),
	`fath` =   as_units("fathom"),
	`ch` =     as_units("chain"),
	`link` =   as_units("link", check_is_valid = FALSE), # not (yet) existing; set in .onLoad()
 	`us-in` =  as_units("us_in", check_is_valid = FALSE),
	`us-ft` =  as_units("US_survey_foot"),
	`us-yd` =  as_units("US_survey_yard"),
	`us-ch` =  as_units("chain"),
	`us-mi` =  as_units("US_survey_mile"),
	`ind-yd` = as_units("ind_yd", check_is_valid = FALSE),
	`ind-ft` = as_units("ind_ft", check_is_valid = FALSE),
	`ind-ch` = as_units("ind_ch", check_is_valid = FALSE),
	`kilometre` =  as_units("km"),
	`metre` =  as_units("m"),
	`decimetre` =     as_units("dm"),
	`centimetre` =     as_units("cm"),
	`millimetre` =     as_units("mm"),
	`nautical mile` = as_units("nautical_mile"),
	`Statute mile` = as_units("mi"),
 	`US survey inch` =  as_units("us_in", check_is_valid = FALSE),
	`US survey foot` =  as_units("US_survey_foot"),
	`US survey yard` =  as_units("US_survey_yard"),
	`US survey chain` =  as_units("chain"),
	`US survey mile` =  as_units("US_survey_mile"),
	`Indian yard (1937)` = as_units("ind_yd", check_is_valid = FALSE),
	`Indian foot (1937)` = as_units("ind_ft", check_is_valid = FALSE),
	`Indian chain` = as_units("ind_ch", check_is_valid = FALSE)
)

crs_ud_unit = function(x) {
	stopifnot(inherits(x, "crs"))
	if (is.na(x))
		return(NULL)

	x = crs_parameters(x)
	if (!is.null(x$units_gdal)) {
		u = udunits_from_proj[[x$units_gdal]]
		if (is.null(u)) {
			u = try(as_units(x$units_gdal), silent = TRUE)
			if (inherits(u, "try-error"))
				u = NULL
		}
		u
	} else
		NULL #2049
}

crs_parameters = function(x) {
	stopifnot(inherits(x, "crs"))
	if (is.na(x))
		list()
	else {
		ret = CPL_crs_parameters(x)
		units(ret$SemiMajor) = as_units("m")
		units(ret$SemiMinor) = as_units("m")
		ret
	}
}

epsg = function(x) {
	if (is.na(x))
		NA_integer_
	else if (grepl("^EPSG:", x[["input"]]))
	# else if (startsWith(x[["input"]], "EPSG:"))
		as.integer(gsub("^EPSG:(\\d+)\\b.*$", "\\1", x[["input"]]))
	else
		crs_parameters(x)[["epsg"]]
}

proj4string = function(x) {
	if (is.na(x))
		NA_character_
	else
		crs_parameters(x)[["proj4string"]]
}


#' @name st_as_text
#' @param projjson logical; if TRUE, return projjson form (requires GDAL 3.1 and PROJ 6.2), else return well-known-text form
#' @param pretty logical; if TRUE, print human-readable well-known-text representation of a coordinate reference system
#' @export
st_as_text.crs = function(x, ..., projjson = FALSE, pretty = FALSE) {
	if (is.na(x))
		NA_character_
	else if (projjson) {
		if (compareVersion(sf_extSoftVersion()["GDAL"], "3.1.0") == -1 || compareVersion(sf_extSoftVersion()["proj.4"], "6.2.0") == -1)
			stop("ProjJson requires GDAL >= 3.1.0 and PROJ >= 6.2.0")
		crs_parameters(x)$ProjJson
	} else { # wkt:
		if (pretty)
			crs_parameters(x)$WktPretty
		else
			crs_parameters(x)$Wkt
	}
}


#' @name st_crs
#' @details
#' \code{NA_crs_} is the \code{crs} object with missing values for \code{input} and \code{wkt}.
#' @export
NA_crs_ = structure(
	list(input = NA_character_,
		wkt = NA_character_),
	class = "crs")

#' @name st_crs
#' @export
#' @method is.na crs
is.na.crs = function(x) {
	identical(x, NA_crs_)
}

#' @name st_crs
#' @param name element name
#' @export
#' @examples
#' st_crs("EPSG:3857")$input
#' st_crs(3857)$proj4string
#' @details the `$` method for `crs` objects retrieves named elements
#' using the GDAL interface; named elements include
#' `SemiMajor`, `SemiMinor`, `InvFlattening`, `IsGeographic`,
#' `units_gdal`, `IsVertical`, `WktPretty`, `Wkt`,
#' `Name`, `proj4string`, `epsg`, `yx`, 
#' `ud_unit`, and `axes` (this may be subject to changes in future GDAL versions).
#'
#' Note that not all valid CRS have a corresponding `proj4string`. 
#'
#' `ud_unit` returns a valid \link[units]{units} object or `NULL` if units are missing.
#' @export
`$.crs` = function(x, name) {

	if (!is.null(x[["proj4string"]])) { # old-style object:
		warning("CRS uses proj4string, which is deprecated.")
		x = st_crs(x[["proj4string"]]) # FIXME: should this be only for some transition period? Add test?
	}
	if (name == "ud_unit")
		crs_ud_unit(x)
	else if (is.na(x))
		NA_character_
	else if (is.numeric(name) || name %in% names(x))
		x[[name]]
	else {
		p = crs_parameters(x)
		if (name %in% names(p))
			p[[name]]
		else {
			tryNum = function(x) { n = suppressWarnings(as.numeric(x)); if (is.na(n)) x else n }
			p4s = strsplit(p$proj4string, " ")[[1]]
			p4s2 = strsplit(p4s, "=")
			vals = lapply(p4s2, function(x) if (length(x) == 1) TRUE else tryNum(x[2]))
			names(vals) = substring(sapply(p4s2, function(x) x[1]), 2)
			vals[[name]]
		}
	}
}

#' @export
print.crs = function(x, ...) {
  cat("Coordinate Reference System:")
  if (is.na(x)) {
    cat(" NA\n")
  } else {
    cat("\n")
    if (is.na(x$input))
       cat("  No user input\n")
    else
       cat("  User input:", x$input, "\n")

	# print wkt:
    if (!is.na(x$wkt))
      cat("  wkt:\n", x$wkt, "\n", sep = "")
  }
}

#' @name st_crs
#' @export
#' @details format.crs returns NA if the crs is missing valued, or else
#' the name of a crs if it is different from "unknown", or
#' else the user input if it was set, or else its "proj4string" representation;
format.crs = function(x, ...) {
	if (is.na(x))
		NA_character_
	else {
		p = crs_parameters(x)
		if (p$Name == "unknown") {
			if (x$input == "unknown")
				x$proj4string
			else
				x$input
		} else
			x$Name
	}
}


#' @export
st_crs.Raster = function(x, ...) {
	crsobj <- raster::crs(x)
	st_crs(crsobj) # nocov
}

#' @export
st_crs.Spatial = function(x, ...) {
	if (! requireNamespace("sp", quietly = TRUE))
		stop("package sp required, please install it first")
	st_crs(x@proj4string) # nocov
}

#' @name st_crs
#' @param authority_compliant logical; specify whether axis order should be
#' handled compliant to the authority; if omitted, the current value is printed.
#' @details
#' \code{st_axis_order} can be used to get and set the axis order: \code{TRUE}
#' indicates axes order according to the authority
#' (e.g. EPSG:4326 defining coordinates to be latitude,longitude pairs), \code{FALSE}
#' indicates the usual GIS (display) order (longitude,latitude). This can be useful
#' when data are read, or have to be written, with coordinates in authority compliant order.
#' The return value is the current state of this (\code{FALSE}, by default).
#' @return \code{st_axis_order} returns the (logical) current value if called without
#' argument, or (invisibly) the previous value if it is being set.
#' @export
#' @examples
#' pt = st_sfc(st_point(c(0, 60)), crs = 4326)
#' # st_axis_order() only has effect in GDAL >= 2.5.0:
#' st_axis_order() # query default: FALSE means interpret pt as (longitude latitude)
#' st_transform(pt, 3857)[[1]]
#' old_value = FALSE
#' if (compareVersion(sf_extSoftVersion()["GDAL"], "2.5.0") >= 0)
#'    (old_value = st_axis_order(TRUE))
#' # now interpret pt as (latitude longitude), as EPSG:4326 prescribes:
#' st_axis_order() # query current value
#' st_transform(pt, 3857)[[1]]
#' st_axis_order(old_value) # set back to old value
st_axis_order = function(authority_compliant = logical(0)) {
	ret = CPL_axis_order_authority_compliant(authority_compliant)
	if (length(authority_compliant))
		invisible(ret)
	else
		ret
}


================================================
FILE: R/datasets.R
================================================
#' North Carolina SIDS data
#'
#' Sudden Infant Death Syndrome (SIDS) sample data for North Carolina counties,
#' two time periods (1974-78 and 1979-84). The details of the columns can be
#' found in a [spdep package vignette](https://r-spatial.github.io/spdep/articles/sids.html). 
#' Please note that, though this is basically the same as \code{nc.sids} dataset in spData
#' package, \code{nc} only contains a subset of variables. The differences are
#' also discussed on the vignette.
#' @format A `sf` object 
#' @name nc
#' @docType data
#' @seealso \url{https://r-spatial.github.io/spdep/articles/sids.html}
#' @examples
#' \donttest{
#' nc <- st_read(system.file("shape/nc.shp", package="sf"))
#' }
NULL


================================================
FILE: R/db.R
================================================
#' Read PostGIS table directly, using DBI and binary conversion
#'
#' Read PostGIS table directly through DBI and RPostgreSQL interface, converting
#' Well-Know Binary geometries to sfc
#' @param query SQL query to select records; see details
#' @param EWKB logical; is the WKB of type EWKB? if missing, defaults to
#'   \code{TRUE}
#' @param as_tibble logical; should the returned table be of class tibble or data.frame?
#' @details if \code{table} is not given but \code{query} is, the spatial
#'   reference system (crs) of the table queried is only available in case it
#'   has been stored into each geometry record (e.g., by PostGIS, when using
#'   EWKB)
#' @examples
#' \dontrun{
#' library(RPostgreSQL)
#' try(conn <- dbConnect(PostgreSQL(), dbname = "postgis"))
#' if (exists("conn") && !inherits(conn, "try-error")) {
#'   x = st_read(conn, "meuse", query = "select * from meuse limit 3;")
#'   x = st_read(conn, table = "public.meuse")
#'   print(st_crs(x)) # SRID resolved by the database, not by GDAL!
#'   dbDisconnect(conn)
#'  }
#' }
#' @name st_read
#' @details The function will automatically find the `geometry` type columns for
#'   drivers that support it. For the other drivers, it will try to cast all the
#'   character columns, which can be slow for very wide tables.
#' @export
st_read.DBIObject = function(dsn = NULL,
                             layer = NULL,
                             query = NULL,
                             EWKB = TRUE,
                             quiet = TRUE,
                             as_tibble = FALSE,
                             geometry_column = NULL,
                             ...) {
    if (is.null(dsn))
        stop("no connection provided") # nocov

    if (as_tibble && !requireNamespace("tibble", quietly = TRUE)) {
        stop("package tibble not available: install first?") # nocov
    }

    # check that ellipsis contains only what is needed
    expe <- setdiff(names(list(...)), names(formals(st_sf)))
    if(length(expe) > 0) {
        # error,  these arguments would be passed to st_sf
        suggest <- NULL
        if("table" %in% expe){
            suggest <- c(suggest, "\nMaybe you should use `layer` rather than `table` ?")
        }
        pref <- if(length(expe) > 1) "\t *" else  ""
        stop(
            "Unused arguments: ",
            if(length(expe) > 1) "\n" else "",
            paste(pref, expe, "=", list(...)[expe], collapse = "\n", sep = " "),
            suggest,
            "\nCheck arguments for `st_sf()` for details.",
            call. = FALSE
        )
    }

    # filter expected warnings (for RPostgreSQL driver)
    filter_warning <- function(expr, regexp) {
        wlist <- NULL
        warning_handler <- function(w) {
            wlist <<- c(wl
Download .txt
gitextract_91i9k_8r/

├── .Rbuildignore
├── .gitattributes
├── .github/
│   ├── .gitignore
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── other_issue.md
│   └── workflows/
│       ├── R-CMD-check.yaml
│       ├── pkgdown.yaml
│       ├── rhub.yaml
│       ├── test-coverage.yaml
│       └── tic-db.yml
├── .gitignore
├── CONDUCT.md
├── DESCRIPTION
├── LICENSE
├── NAMESPACE
├── NEWS.md
├── PROPOSAL.md
├── R/
│   ├── RcppExports.R
│   ├── aggregate.R
│   ├── agr.R
│   ├── arith.R
│   ├── bbox.R
│   ├── bind.R
│   ├── break_antimeridian.R
│   ├── cast_sfc.R
│   ├── cast_sfg.R
│   ├── collection_extract.R
│   ├── crop.R
│   ├── crs.R
│   ├── datasets.R
│   ├── db.R
│   ├── defunct.R
│   ├── gdal_utils.R
│   ├── geom-measures.R
│   ├── geom-predicates.R
│   ├── geom-transformers.R
│   ├── geos-overlayng.R
│   ├── graticule.R
│   ├── grid.R
│   ├── import-standalone-s3-register.R
│   ├── init.R
│   ├── jitter.R
│   ├── join.R
│   ├── m_range.R
│   ├── make_grid.R
│   ├── maps.R
│   ├── nearest.R
│   ├── normalize.R
│   ├── plot.R
│   ├── proj.R
│   ├── read.R
│   ├── s2.R
│   ├── sample.R
│   ├── sf-package.R
│   ├── sf.R
│   ├── sfc.R
│   ├── sfg.R
│   ├── sgbp.R
│   ├── shift_longitude.R
│   ├── sp.R
│   ├── spatstat.R
│   ├── stars.R
│   ├── terra.R
│   ├── tidyverse-vctrs.R
│   ├── tidyverse.R
│   ├── transform.R
│   ├── valid.R
│   ├── wkb.R
│   ├── wkt.R
│   └── z_range.R
├── README.md
├── _pkgdown.yml
├── cleanup
├── codecov.yml
├── configure
├── configure.ac
├── demo/
│   ├── 00Index
│   ├── affine.R
│   ├── basic.R
│   ├── ggplot.R
│   ├── meuse_sf.R
│   ├── nc.R
│   └── twitter.R
├── inst/
│   ├── CITATION
│   ├── csv/
│   │   └── pt.csv
│   ├── docker/
│   │   ├── README.md
│   │   ├── alma/
│   │   │   ├── Dockerfile
│   │   │   ├── README.md
│   │   │   ├── build_command
│   │   │   └── vito.repo
│   │   ├── arrow/
│   │   │   └── Dockerfile
│   │   ├── base/
│   │   │   └── Dockerfile
│   │   ├── bionic/
│   │   │   └── Dockerfile
│   │   ├── cran/
│   │   │   └── Dockerfile
│   │   ├── custom/
│   │   │   └── Dockerfile
│   │   ├── devel/
│   │   │   └── Dockerfile
│   │   ├── fedora/
│   │   │   └── Dockerfile
│   │   ├── gdal/
│   │   │   └── Dockerfile
│   │   ├── gdal304/
│   │   │   └── Dockerfile
│   │   ├── geos/
│   │   │   └── Dockerfile
│   │   ├── lowest/
│   │   │   └── Dockerfile
│   │   └── parquet/
│   │       └── Dockerfile
│   ├── gml/
│   │   └── fmi_test.gml
│   ├── gpkg/
│   │   ├── b_pump.gpkg
│   │   ├── buildings.gpkg
│   │   ├── grd_addr.gpkg
│   │   ├── nc.gpkg
│   │   ├── nospatial.gpkg
│   │   └── tl.gpkg
│   ├── include/
│   │   ├── sf.h
│   │   └── sf_RcppExports.h
│   ├── nc/
│   │   ├── cropped.nc
│   │   └── zarr.py
│   ├── osm/
│   │   └── overpass.osm
│   ├── shape/
│   │   ├── olinda1.dbf
│   │   ├── olinda1.prj
│   │   ├── olinda1.shp
│   │   ├── olinda1.shx
│   │   ├── storms_xyz.dbf
│   │   ├── storms_xyz.shp
│   │   ├── storms_xyz.shx
│   │   ├── storms_xyz_feature.dbf
│   │   ├── storms_xyz_feature.shp
│   │   ├── storms_xyz_feature.shx
│   │   ├── storms_xyzm.dbf
│   │   ├── storms_xyzm.shp
│   │   ├── storms_xyzm.shx
│   │   ├── storms_xyzm_feature.dbf
│   │   ├── storms_xyzm_feature.shp
│   │   └── storms_xyzm_feature.shx
│   └── tif/
│       └── geomatrix.tif
├── man/
│   ├── Ops.Rd
│   ├── aggregate.sf.Rd
│   ├── bind.Rd
│   ├── coerce-methods.Rd
│   ├── dbDataType.Rd
│   ├── dbWriteTable.Rd
│   ├── db_drivers.Rd
│   ├── dot-stop_geos.Rd
│   ├── extension_map.Rd
│   ├── gdal.Rd
│   ├── gdal_addo.Rd
│   ├── gdal_compressors.Rd
│   ├── gdal_utils.Rd
│   ├── geos_binary_ops.Rd
│   ├── geos_binary_pred.Rd
│   ├── geos_combine.Rd
│   ├── geos_measures.Rd
│   ├── geos_query.Rd
│   ├── geos_unary.Rd
│   ├── interpolate_aw.Rd
│   ├── is_driver_available.Rd
│   ├── is_driver_can.Rd
│   ├── is_geometry_column.Rd
│   ├── merge.sf.Rd
│   ├── nc.Rd
│   ├── plot.Rd
│   ├── prefix_map.Rd
│   ├── proj_tools.Rd
│   ├── rawToHex.Rd
│   ├── s2.Rd
│   ├── sf-defunct.Rd
│   ├── sf-package.Rd
│   ├── sf.Rd
│   ├── sf_extSoftVersion.Rd
│   ├── sf_project.Rd
│   ├── sfc.Rd
│   ├── sgbp.Rd
│   ├── st.Rd
│   ├── st_agr.Rd
│   ├── st_as_binary.Rd
│   ├── st_as_grob.Rd
│   ├── st_as_sf.Rd
│   ├── st_as_sfc.Rd
│   ├── st_as_text.Rd
│   ├── st_bbox.Rd
│   ├── st_break_antimeridian.Rd
│   ├── st_cast.Rd
│   ├── st_cast_sfc_default.Rd
│   ├── st_collection_extract.Rd
│   ├── st_coordinates.Rd
│   ├── st_crop.Rd
│   ├── st_crs.Rd
│   ├── st_drivers.Rd
│   ├── st_geometry.Rd
│   ├── st_geometry_type.Rd
│   ├── st_graticule.Rd
│   ├── st_is.Rd
│   ├── st_is_full.Rd
│   ├── st_is_longlat.Rd
│   ├── st_jitter.Rd
│   ├── st_join.Rd
│   ├── st_layers.Rd
│   ├── st_line_project_point.Rd
│   ├── st_line_sample.Rd
│   ├── st_m_range.Rd
│   ├── st_make_grid.Rd
│   ├── st_nearest_feature.Rd
│   ├── st_nearest_points.Rd
│   ├── st_normalize.Rd
│   ├── st_precision.Rd
│   ├── st_read.Rd
│   ├── st_relate.Rd
│   ├── st_sample.Rd
│   ├── st_shift_longitude.Rd
│   ├── st_transform.Rd
│   ├── st_viewport.Rd
│   ├── st_write.Rd
│   ├── st_z_range.Rd
│   ├── st_zm.Rd
│   ├── stars.Rd
│   ├── summary.sfc.Rd
│   ├── tibble.Rd
│   ├── tidyverse.Rd
│   ├── transform.sf.Rd
│   └── valid.Rd
├── sf.Rproj
├── src/
│   ├── Makevars.in
│   ├── Makevars.ucrt
│   ├── Makevars.win
│   ├── RcppExports.cpp
│   ├── bbox.cpp
│   ├── bbox.h
│   ├── gdal.cpp
│   ├── gdal.h
│   ├── gdal_geom.cpp
│   ├── gdal_read.cpp
│   ├── gdal_read.h
│   ├── gdal_read_stream.cpp
│   ├── gdal_sf_pkg.h
│   ├── gdal_utils.cpp
│   ├── gdal_write.cpp
│   ├── geos.cpp
│   ├── hex.cpp
│   ├── hex.h
│   ├── mdim.cpp
│   ├── ops.cpp
│   ├── polygonize.cpp
│   ├── proj.cpp
│   ├── proj_info.cpp
│   ├── raster2sf.cpp
│   ├── sfc-sfg.cpp
│   ├── signed_area.cpp
│   ├── stars.cpp
│   ├── wkb.cpp
│   ├── wkb.h
│   ├── zm_range.cpp
│   └── zm_range.h
├── tests/
│   ├── aggregate.R
│   ├── aggregate.Rout.save
│   ├── bgmap.rda
│   ├── cast.R
│   ├── cast.Rout.save
│   ├── crs.R
│   ├── crs.Rout.save
│   ├── dist.R
│   ├── dist.Rout.save
│   ├── dplyr.R
│   ├── dplyr.Rout.save
│   ├── empty.R
│   ├── empty.Rout.save
│   ├── full.R
│   ├── full.Rout.save
│   ├── gdal_geom.R
│   ├── gdal_geom.Rout.save
│   ├── geos.R
│   ├── geos.Rout.save
│   ├── graticule.R
│   ├── graticule.Rout.save
│   ├── grid.R
│   ├── grid.Rout.save
│   ├── maps.R
│   ├── maps.Rout.save
│   ├── plot.R
│   ├── plot.Rout.save
│   ├── read.R
│   ├── read.Rout.save
│   ├── roundtrip.R
│   ├── roundtrip.Rout.save
│   ├── s2.R
│   ├── s2.Rout.save
│   ├── sample.R
│   ├── sample.Rout.save
│   ├── sfc.R
│   ├── sfc.Rout.save
│   ├── sfg.R
│   ├── sfg.Rout.save
│   ├── spatstat.R
│   ├── spatstat.Rout.save
│   ├── stars.R
│   ├── stars.Rout.save
│   ├── test-by-element.R
│   ├── test-by-element.Rout.save
│   ├── testthat/
│   │   ├── test-aw.R
│   │   ├── test-bbox.R
│   │   ├── test-collection_extract.R
│   │   ├── test-crs.R
│   │   ├── test-gdal.R
│   │   ├── test-geos.R
│   │   ├── test-grid.R
│   │   ├── test-normalize.R
│   │   ├── test-plot.R
│   │   ├── test-postgis_ODBC.R
│   │   ├── test-postgis_RPostgreSQL.R
│   │   ├── test-postgis_RPostgres.R
│   │   ├── test-proj.R
│   │   ├── test-read.R
│   │   ├── test-s2.R
│   │   ├── test-sample.R
│   │   ├── test-sf.R
│   │   ├── test-sfc.R
│   │   ├── test-sfg.R
│   │   ├── test-shift_longitude.R
│   │   ├── test-sp.R
│   │   ├── test-st_cast.R
│   │   ├── test-tidyverse-vctrs.R
│   │   ├── test-tidyverse.R
│   │   ├── test-tm.R
│   │   ├── test-valid.R
│   │   ├── test-wkb.R
│   │   ├── test-wkt.R
│   │   ├── test-write.R
│   │   └── test-zm_range.R
│   ├── testthat.R
│   ├── units.R
│   ├── units.Rout.save
│   ├── wkb.R
│   └── wkb.Rout.save
├── tic.R
├── tools/
│   └── winlibs.R
├── vignettes/
│   ├── sf.fig
│   ├── sf1.Rmd
│   ├── sf2.Rmd
│   ├── sf3.Rmd
│   ├── sf4.Rmd
│   ├── sf5.Rmd
│   ├── sf6.Rmd
│   ├── sf7.Rmd
│   └── sf_fig.drawio
└── vignettes.awk
Download .txt
SYMBOL INDEX (383 symbols across 22 files)

FILE: inst/include/sf_RcppExports.h
  function namespace (line 9) | namespace sf {
  type SEXP (line 48) | typedef SEXP(*Ptr_CPL_write_wkb)(SEXP,SEXP);

FILE: src/RcppExports.cpp
  function RcppExport (line 18) | RcppExport SEXP _sf_CPL_get_bbox(SEXP sfSEXP, SEXP depthSEXP) {
  function RcppExport (line 29) | RcppExport SEXP _sf_CPL_gdal_init() {
  function RcppExport (line 37) | RcppExport SEXP _sf_CPL_gdal_cleanup_all() {
  function RcppExport (line 45) | RcppExport SEXP _sf_CPL_gdal_version(SEXP whatSEXP) {
  function RcppExport (line 55) | RcppExport SEXP _sf_CPL_crs_parameters(SEXP crsSEXP) {
  function RcppExport (line 65) | RcppExport SEXP _sf_CPL_crs_equivalent(SEXP crs1SEXP, SEXP crs2SEXP) {
  function RcppExport (line 76) | RcppExport SEXP _sf_CPL_crs_from_input(SEXP inputSEXP) {
  function RcppExport (line 86) | RcppExport SEXP _sf_CPL_roundtrip(SEXP sfcSEXP) {
  function RcppExport (line 96) | RcppExport SEXP _sf_CPL_circularstring_to_linestring(SEXP sfcSEXP) {
  function RcppExport (line 106) | RcppExport SEXP _sf_CPL_multisurface_to_multipolygon(SEXP sfcSEXP) {
  function RcppExport (line 116) | RcppExport SEXP _sf_CPL_compoundcurve_to_linear(SEXP sfcSEXP) {
  function RcppExport (line 126) | RcppExport SEXP _sf_CPL_curve_to_linestring(SEXP sfcSEXP) {
  function RcppExport (line 136) | RcppExport SEXP _sf_CPL_can_transform(SEXP srcSEXP, SEXP dstSEXP) {
  function RcppExport (line 147) | RcppExport SEXP _sf_CPL_transform(SEXP sfcSEXP, SEXP crsSEXP, SEXP AOISE...
  function RcppExport (line 163) | RcppExport SEXP _sf_CPL_transform_bounds(SEXP bbSEXP, SEXP crs_dstSEXP, ...
  function RcppExport (line 175) | RcppExport SEXP _sf_CPL_wrap_dateline(SEXP sfcSEXP, SEXP optSEXP, SEXP q...
  function RcppExport (line 187) | RcppExport SEXP _sf_CPL_get_gdal_drivers(SEXP dummySEXP) {
  function RcppExport (line 197) | RcppExport SEXP _sf_CPL_sfc_from_wkt(SEXP wktSEXP) {
  function RcppExport (line 207) | RcppExport SEXP _sf_CPL_gdal_with_geos() {
  function RcppExport (line 216) | RcppExport SEXP _sf_CPL_axis_order_authority_compliant(SEXP authority_co...
  function RcppExport (line 226) | RcppExport SEXP _sf_CPL_compressors() {
  function RcppExport (line 235) | RcppExport SEXP _sf_CPL_area(SEXP sfcSEXP) {
  function RcppExport (line 245) | RcppExport SEXP _sf_CPL_gdal_dimension(SEXP sfcSEXP, SEXP NA_if_emptySEX...
  function RcppExport (line 256) | RcppExport SEXP _sf_CPL_length(SEXP sfcSEXP) {
  function RcppExport (line 266) | RcppExport SEXP _sf_CPL_gdal_segmentize(SEXP sfcSEXP, SEXP dfMaxLengthSE...
  function RcppExport (line 277) | RcppExport SEXP _sf_CPL_gdal_linestring_sample(SEXP sfcSEXP, SEXP distLs...
  function RcppExport (line 288) | RcppExport SEXP _sf_CPL_get_layers(SEXP datasourceSEXP, SEXP optionsSEXP...
  function RcppExport (line 300) | RcppExport SEXP _sf_CPL_read_ogr(SEXP datasourceSEXP, SEXP layerSEXP, SE...
  function RcppExport (line 323) | RcppExport SEXP _sf_CPL_read_gdal_stream(SEXP stream_xptrSEXP, SEXP data...
  function RcppExport (line 344) | RcppExport SEXP _sf_CPL_gdalinfo(SEXP objSEXP, SEXP optionsSEXP, SEXP oo...
  function RcppExport (line 357) | RcppExport SEXP _sf_CPL_ogrinfo(SEXP objSEXP, SEXP optionsSEXP, SEXP ooS...
  function RcppExport (line 371) | RcppExport SEXP _sf_CPL_gdaladdo(SEXP objSEXP, SEXP methodSEXP, SEXP ove...
  function RcppExport (line 388) | RcppExport SEXP _sf_CPL_gdalwarp(SEXP srcSEXP, SEXP dstSEXP, SEXP option...
  function RcppExport (line 405) | RcppExport SEXP _sf_CPL_gdalrasterize(SEXP srcSEXP, SEXP dstSEXP, SEXP o...
  function RcppExport (line 422) | RcppExport SEXP _sf_CPL_gdaltranslate(SEXP srcSEXP, SEXP dstSEXP, SEXP o...
  function RcppExport (line 437) | RcppExport SEXP _sf_CPL_gdalfootprint(SEXP srcSEXP, SEXP dstSEXP, SEXP o...
  function RcppExport (line 452) | RcppExport SEXP _sf_CPL_gdalvectortranslate(SEXP srcSEXP, SEXP dstSEXP, ...
  function RcppExport (line 468) | RcppExport SEXP _sf_CPL_gdalbuildvrt(SEXP srcSEXP, SEXP dstSEXP, SEXP op...
  function RcppExport (line 483) | RcppExport SEXP _sf_CPL_gdaldemprocessing(SEXP srcSEXP, SEXP dstSEXP, SE...
  function RcppExport (line 500) | RcppExport SEXP _sf_CPL_gdalnearblack(SEXP srcSEXP, SEXP dstSEXP, SEXP o...
  function RcppExport (line 516) | RcppExport SEXP _sf_CPL_gdalgrid(SEXP srcSEXP, SEXP dstSEXP, SEXP option...
  function RcppExport (line 531) | RcppExport SEXP _sf_CPL_gdalmdiminfo(SEXP objSEXP, SEXP optionsSEXP, SEX...
  function RcppExport (line 544) | RcppExport SEXP _sf_CPL_gdalmdimtranslate(SEXP srcSEXP, SEXP dstSEXP, SE...
  function RcppExport (line 559) | RcppExport SEXP _sf_CPL_gdal_warper(SEXP infileSEXP, SEXP outfileSEXP, S...
  function RcppExport (line 575) | RcppExport SEXP _sf_CPL_write_ogr(SEXP objSEXP, SEXP dsnSEXP, SEXP layer...
  function RcppExport (line 600) | RcppExport SEXP _sf_CPL_delete_ogr(SEXP dsnSEXP, SEXP layerSEXP, SEXP dr...
  function RcppExport (line 613) | RcppExport SEXP _sf_CPL_geos_binop(SEXP sfc0SEXP, SEXP sfc1SEXP, SEXP op...
  function RcppExport (line 628) | RcppExport SEXP _sf_CPL_geos_binop_by_element(SEXP sfc0SEXP, SEXP sfc1SE...
  function RcppExport (line 643) | RcppExport SEXP _sf_CPL_geos_is_valid_reason(SEXP sfcSEXP) {
  function RcppExport (line 653) | RcppExport SEXP _sf_CPL_geos_make_valid(SEXP sfcSEXP, SEXP methodSEXP, S...
  function RcppExport (line 665) | RcppExport SEXP _sf_CPL_geos_is_valid(SEXP sfcSEXP, SEXP NA_on_exception...
  function RcppExport (line 676) | RcppExport SEXP _sf_CPL_geos_is_simple(SEXP sfcSEXP) {
  function RcppExport (line 686) | RcppExport SEXP _sf_CPL_geos_is_empty(SEXP sfcSEXP) {
  function RcppExport (line 696) | RcppExport SEXP _sf_CPL_geos_normalize(SEXP sfcSEXP) {
  function RcppExport (line 706) | RcppExport SEXP _sf_CPL_geos_union(SEXP sfcSEXP, SEXP by_featureSEXP, SE...
  function RcppExport (line 718) | RcppExport SEXP _sf_CPL_geos_snap(SEXP sfc0SEXP, SEXP sfc1SEXP, SEXP tol...
  function RcppExport (line 730) | RcppExport SEXP _sf_CPL_geos_op(SEXP opSEXP, SEXP sfcSEXP, SEXP bufferDi...
  function RcppExport (line 750) | RcppExport SEXP _sf_CPL_geos_voronoi(SEXP sfcSEXP, SEXP envSEXP, SEXP dT...
  function RcppExport (line 763) | RcppExport SEXP _sf_CPL_geos_op2(SEXP opSEXP, SEXP sfcxSEXP, SEXP sfcySE...
  function RcppExport (line 775) | RcppExport SEXP _sf_CPL_geos_dist_by_element(SEXP sfc0SEXP, SEXP sfc1SEX...
  function RcppExport (line 788) | RcppExport SEXP _sf_CPL_geos_version(SEXP runtimeSEXP, SEXP capiSEXP) {
  function RcppExport (line 799) | RcppExport SEXP _sf_CPL_geos_op2_by_element(SEXP opSEXP, SEXP sfcxSEXP, ...
  function RcppExport (line 811) | RcppExport SEXP _sf_CPL_geos_dist(SEXP sfc0SEXP, SEXP sfc1SEXP, SEXP whi...
  function RcppExport (line 824) | RcppExport SEXP _sf_CPL_geos_nearest_feature(SEXP sfc0SEXP, SEXP sfc1SEX...
  function RcppExport (line 835) | RcppExport SEXP _sf_CPL_geos_nearest_points(SEXP sfc0SEXP, SEXP sfc1SEXP...
  function RcppExport (line 847) | RcppExport SEXP _sf_CPL_transpose_sparse_incidence(SEXP mSEXP, SEXP nSEX...
  function RcppExport (line 858) | RcppExport SEXP _sf_CPL_nary_difference(SEXP sfcSEXP) {
  function RcppExport (line 868) | RcppExport SEXP _sf_CPL_nary_intersection(SEXP sfcSEXP) {
  function RcppExport (line 878) | RcppExport SEXP _sf_CPL_line_project(SEXP linesSEXP, SEXP pointsSEXP, SE...
  function RcppExport (line 890) | RcppExport SEXP _sf_CPL_line_interpolate(SEXP linesSEXP, SEXP distsSEXP,...
  function RcppExport (line 902) | RcppExport SEXP _sf_CPL_hex_to_raw(SEXP cxSEXP) {
  function RcppExport (line 912) | RcppExport SEXP _sf_CPL_raw_to_hex(SEXP rawSEXP) {
  function RcppExport (line 922) | RcppExport SEXP _sf_CPL_read_mdim(SEXP fileSEXP, SEXP array_namesSEXP, S...
  function RcppExport (line 939) | RcppExport SEXP _sf_CPL_write_mdim(SEXP nameSEXP, SEXP driverSEXP, SEXP ...
  function RcppExport (line 957) | RcppExport SEXP _sf_opp_sfc(SEXP geomSEXP, SEXP valueSEXP, SEXP multSEXP...
  function RcppExport (line 970) | RcppExport SEXP _sf_normalize_sfc(SEXP geomSEXP, SEXP minSEXP, SEXP rang...
  function RcppExport (line 983) | RcppExport SEXP _sf_CPL_polygonize(SEXP rasterSEXP, SEXP mask_nameSEXP, ...
  function RcppExport (line 1002) | RcppExport SEXP _sf_CPL_rasterize(SEXP rasterSEXP, SEXP raster_driverSEX...
  function RcppExport (line 1017) | RcppExport SEXP _sf_CPL_proj_h(SEXP bSEXP) {
  function RcppExport (line 1027) | RcppExport SEXP _sf_CPL_get_pipelines(SEXP crsSEXP, SEXP authoritySEXP, ...
  function RcppExport (line 1044) | RcppExport SEXP _sf_CPL_get_data_dir(SEXP from_projSEXP) {
  function RcppExport (line 1054) | RcppExport SEXP _sf_CPL_is_network_enabled(SEXP bSEXP) {
  function RcppExport (line 1064) | RcppExport SEXP _sf_CPL_enable_network(SEXP urlSEXP, SEXP enableSEXP) {
  function RcppExport (line 1075) | RcppExport SEXP _sf_CPL_set_data_dir(SEXP data_dirSEXP, SEXP with_projSE...
  function RcppExport (line 1086) | RcppExport SEXP _sf_CPL_use_proj4_init_rules(SEXP vSEXP) {
  function RcppExport (line 1096) | RcppExport SEXP _sf_CPL_proj_version(SEXP bSEXP) {
  function RcppExport (line 1106) | RcppExport SEXP _sf_CPL_proj_is_valid(SEXP proj4stringSEXP) {
  function RcppExport (line 1116) | RcppExport SEXP _sf_CPL_have_datum_files(SEXP fooSEXP) {
  function RcppExport (line 1126) | RcppExport SEXP _sf_CPL_proj_direct(SEXP from_toSEXP, SEXP ptsSEXP, SEXP...
  function RcppExport (line 1140) | RcppExport SEXP _sf_CPL_proj_info(SEXP typeSEXP) {
  function RcppExport (line 1150) | RcppExport SEXP _sf_CPL_xy2sfc(SEXP ccSEXP, SEXP dimSEXP, SEXP to_points...
  function RcppExport (line 1164) | RcppExport SEXP _sf_sfc_is_null(SEXP sfcSEXP) {
  function RcppExport (line 1174) | RcppExport SEXP _sf_sfc_unique_sfg_dims_and_types(SEXP sfcSEXP) {
  function RcppExport (line 1184) | RcppExport SEXP _sf_sfc_is_empty(SEXP sfcSEXP) {
  function RcppExport (line 1194) | RcppExport SEXP _sf_sfc_is_full(SEXP sfcSEXP) {
  function RcppExport (line 1204) | RcppExport SEXP _sf_points_cpp(SEXP ptsSEXP, SEXP gdimSEXP) {
  function RcppExport (line 1215) | RcppExport SEXP _sf_CPL_signed_area(SEXP ptsSEXP) {
  function RcppExport (line 1225) | RcppExport SEXP _sf_CPL_get_metadata(SEXP objSEXP, SEXP domain_itemSEXP,...
  function RcppExport (line 1237) | RcppExport SEXP _sf_CPL_get_crs(SEXP objSEXP, SEXP optionsSEXP) {
  function RcppExport (line 1248) | RcppExport SEXP _sf_CPL_inv_geotransform(SEXP gt_rSEXP) {
  function RcppExport (line 1258) | RcppExport SEXP _sf_CPL_read_gdal(SEXP fnameSEXP, SEXP optionsSEXP, SEXP...
  function RcppExport (line 1274) | RcppExport SEXP _sf_CPL_write_gdal(SEXP xSEXP, SEXP fnameSEXP, SEXP driv...
  function RcppExport (line 1295) | RcppExport SEXP _sf_CPL_extract(SEXP inputSEXP, SEXP xySEXP, SEXP interp...
  function RcppExport (line 1307) | RcppExport SEXP _sf_CPL_create(SEXP fileSEXP, SEXP nxySEXP, SEXP valueSE...
  function SEXP (line 1321) | static SEXP _sf_CPL_read_wkb_try(SEXP wkb_listSEXP, SEXP EWKBSEXP, SEXP ...
  function RcppExport (line 1331) | RcppExport SEXP _sf_CPL_read_wkb(SEXP wkb_listSEXP, SEXP EWKBSEXP, SEXP ...
  function SEXP (line 1356) | static SEXP _sf_CPL_write_wkb_try(SEXP sfcSEXP, SEXP EWKBSEXP) {
  function RcppExport (line 1365) | RcppExport SEXP _sf_CPL_write_wkb(SEXP sfcSEXP, SEXP EWKBSEXP) {
  function RcppExport (line 1390) | RcppExport SEXP _sf_CPL_get_z_range(SEXP sfSEXP, SEXP depthSEXP) {
  function RcppExport (line 1401) | RcppExport SEXP _sf_CPL_get_m_range(SEXP sfSEXP, SEXP depthSEXP) {
  function _sf_RcppExport_validate (line 1412) | static int _sf_RcppExport_validate(const char* sig) {
  function RcppExport (line 1422) | RcppExport SEXP _sf_RcppExport_registerCCallable() {
  function RcppExport (line 1542) | RcppExport void R_init_sf(DllInfo *dll) {

FILE: src/bbox.cpp
  function CPL_get_bbox (line 6) | Rcpp::NumericVector CPL_get_bbox(Rcpp::List sf, int depth = 0) {

FILE: src/gdal.cpp
  function __err_handler (line 33) | static void __err_handler(CPLErr eErrClass, int err_no, const char *msg)
  function __err_silent (line 58) | static void __err_silent(CPLErr eErrClass, int err_no, const char *msg)
  function set_error_handler (line 64) | void set_error_handler(void)
  function unset_error_handler (line 69) | void unset_error_handler(void)
  function CPL_gdal_init (line 75) | void CPL_gdal_init()
  function CPL_gdal_cleanup_all (line 85) | void CPL_gdal_cleanup_all()
  function handle_error (line 98) | void handle_error(OGRErr err) {
  function set_config_options (line 120) | void set_config_options(Rcpp::CharacterVector ConfigOptions) {
  function unset_config_options (line 130) | void unset_config_options(Rcpp::CharacterVector ConfigOptions) {
  function wkt_from_spatial_reference (line 138) | Rcpp::CharacterVector wkt_from_spatial_reference(const OGRSpatialReferen...
  function fix_old_style (line 153) | Rcpp::List fix_old_style(Rcpp::List crs) {
  function OGRSpatialReference (line 182) | OGRSpatialReference *OGRSrs_from_crs(Rcpp::List crs) {
  function CPL_crs_parameters (line 201) | Rcpp::List CPL_crs_parameters(Rcpp::List crs) {
  function srid_from_crs (line 381) | int srid_from_crs(Rcpp::List crs) {
  function CPL_crs_equivalent (line 397) | Rcpp::LogicalVector CPL_crs_equivalent(Rcpp::List crs1, Rcpp::List crs2) {
  function ogr_from_sfc (line 427) | std::vector<OGRGeometry *> ogr_from_sfc(Rcpp::List sfc, OGRSpatialRefere...
  function create_options (line 452) | std::vector<char *> create_options(Rcpp::CharacterVector lco, bool quiet) {
  function charpp2CV (line 470) | Rcpp::CharacterVector charpp2CV(CSLConstList cp) {
  function create_crs (line 480) | Rcpp::List create_crs(const OGRSpatialReference *ref, bool set_input) {
  function sfc_from_ogr (line 509) | Rcpp::List sfc_from_ogr(std::vector<OGRGeometry *> g, bool destroy = fal...
  function CPL_crs_from_input (line 531) | Rcpp::List CPL_crs_from_input(Rcpp::CharacterVector input) {
  function CPL_roundtrip (line 546) | Rcpp::List CPL_roundtrip(Rcpp::List sfc) { // for debug purposes
  function CPL_circularstring_to_linestring (line 558) | Rcpp::List CPL_circularstring_to_linestring(Rcpp::List sfc) { // need to...
  function CPL_multisurface_to_multipolygon (line 570) | Rcpp::List CPL_multisurface_to_multipolygon(Rcpp::List sfc) { // need to...
  function CPL_compoundcurve_to_linear (line 587) | Rcpp::List CPL_compoundcurve_to_linear(Rcpp::List sfc) { // need to pass...
  function CPL_curve_to_linestring (line 599) | Rcpp::List CPL_curve_to_linestring(Rcpp::List sfc) { // need to pass mor...
  function CPL_can_transform (line 610) | Rcpp::LogicalVector CPL_can_transform(Rcpp::List src, Rcpp::List dst) {
  function CPL_transform (line 632) | Rcpp::List CPL_transform(Rcpp::List sfc, Rcpp::List crs,
  function CPL_transform_bounds (line 701) | Rcpp::NumericVector CPL_transform_bounds(Rcpp::NumericVector bb, Rcpp::L...
  function CPL_wrap_dateline (line 749) | Rcpp::List CPL_wrap_dateline(Rcpp::List sfc, Rcpp::CharacterVector opt, ...
  function CPL_get_gdal_drivers (line 762) | Rcpp::List CPL_get_gdal_drivers(int dummy) {
  function CPL_sfc_from_wkt (line 793) | Rcpp::List CPL_sfc_from_wkt(Rcpp::CharacterVector wkt) {
  function CPL_gdal_with_geos (line 808) | Rcpp::LogicalVector CPL_gdal_with_geos() {
  function CPL_axis_order_authority_compliant (line 814) | Rcpp::LogicalVector CPL_axis_order_authority_compliant(Rcpp::LogicalVect...
  function OGRSpatialReference (line 827) | OGRSpatialReference *handle_axis_order(OGRSpatialReference *sr) {
  function to_cv (line 839) | Rcpp::CharacterVector to_cv(char **cpp) {
  function CPL_compressors (line 849) | Rcpp::List CPL_compressors() {
  function CPL_compressors (line 858) | Rcpp::List CPL_compressors() {

FILE: src/gdal_geom.cpp
  function CPL_area (line 9) | Rcpp::NumericVector CPL_area(Rcpp::List sfc) {
  function CPL_gdal_dimension (line 33) | Rcpp::IntegerVector CPL_gdal_dimension(Rcpp::List sfc, bool NA_if_empty ...
  function CPL_length (line 48) | Rcpp::NumericVector CPL_length(Rcpp::List sfc) {
  function CPL_gdal_segmentize (line 84) | Rcpp::List CPL_gdal_segmentize(Rcpp::List sfc, double dfMaxLength = 0.0) {
  function CPL_gdal_linestring_sample (line 98) | Rcpp::List CPL_gdal_linestring_sample(Rcpp::List sfc, Rcpp::List distLst) {

FILE: src/gdal_read.cpp
  function allocate_out_list (line 12) | Rcpp::List allocate_out_list(OGRFeatureDefn *poFDefn, int n_features, bo...
  function OGRwkbGeometryType (line 92) | OGRwkbGeometryType to_multi_what(std::vector<OGRGeometry *> gv) {
  function count_features (line 125) | size_t count_features(OGRLayer *poLayer) {
  function CPL_get_layers (line 139) | Rcpp::List CPL_get_layers(Rcpp::CharacterVector datasource, Rcpp::Charac...
  function sf_from_ogrlayer (line 196) | Rcpp::List sf_from_ogrlayer(OGRLayer *poLayer, bool quiet, bool int64_as...
  function finalize_dataset_xptr (line 521) | static void finalize_dataset_xptr(SEXP dataset_xptr) {
  function CPL_ogr_layer_setup (line 528) | Rcpp::List CPL_ogr_layer_setup(Rcpp::CharacterVector datasource, Rcpp::C...
  function CPL_read_ogr (line 641) | Rcpp::List CPL_read_ogr(Rcpp::CharacterVector datasource, Rcpp::Characte...

FILE: src/gdal_read_stream.cpp
  class GDALStreamWrapper (line 12) | class GDALStreamWrapper {
    method Make (line 14) | static void Make(struct ArrowArrayStream* stream, Rcpp::List shelter,
    type ArrowArrayStream (line 32) | struct ArrowArrayStream
    method GDALStreamWrapper (line 35) | GDALStreamWrapper(struct ArrowArrayStream* stream, Rcpp::List shelter):
    method get_schema (line 41) | int get_schema(struct ArrowSchema* out) {
    method get_next (line 45) | int get_next(struct ArrowArray* out) {
    method get_schema_wrap (line 53) | static int get_schema_wrap(struct ArrowArrayStream* stream, struct Arr...
    method get_next_wrap (line 57) | static int get_next_wrap(struct ArrowArrayStream* stream, struct Arrow...
    type ArrowArrayStream (line 61) | struct ArrowArrayStream
    method release_wrap (line 65) | static void release_wrap(struct ArrowArrayStream* stream) {
  function CPL_read_gdal_stream (line 74) | Rcpp::List CPL_read_gdal_stream(

FILE: src/gdal_utils.cpp
  function CPL_gdalinfo (line 50) | Rcpp::CharacterVector CPL_gdalinfo(Rcpp::CharacterVector obj, Rcpp::Char...
  function CPL_ogrinfo (line 72) | Rcpp::CharacterVector CPL_ogrinfo(Rcpp::CharacterVector obj, Rcpp::Chara...
  function CPL_gdaladdo (line 99) | Rcpp::LogicalVector CPL_gdaladdo(Rcpp::CharacterVector obj, Rcpp::Charac...
  function CPL_gdalwarp (line 139) | Rcpp::LogicalVector CPL_gdalwarp(Rcpp::CharacterVector src, Rcpp::Charac...
  function CPL_gdalrasterize (line 182) | Rcpp::LogicalVector CPL_gdalrasterize(Rcpp::CharacterVector src, Rcpp::C...
  function CPL_gdaltranslate (line 221) | Rcpp::LogicalVector CPL_gdaltranslate(Rcpp::CharacterVector src, Rcpp::C...
  function CPL_gdalfootprint (line 252) | Rcpp::LogicalVector CPL_gdalfootprint(Rcpp::CharacterVector src, Rcpp::C...
  function CPL_gdalvectortranslate (line 287) | Rcpp::LogicalVector CPL_gdalvectortranslate(Rcpp::CharacterVector src, R...
  function CPL_gdalbuildvrt (line 320) | Rcpp::LogicalVector CPL_gdalbuildvrt(Rcpp::CharacterVector src, Rcpp::Ch...
  function CPL_gdaldemprocessing (line 362) | Rcpp::LogicalVector CPL_gdaldemprocessing(Rcpp::CharacterVector src, Rcp...
  function CPL_gdalnearblack (line 395) | Rcpp::LogicalVector CPL_gdalnearblack(Rcpp::CharacterVector src, Rcpp::C...
  function CPL_gdalgrid (line 424) | Rcpp::LogicalVector CPL_gdalgrid(Rcpp::CharacterVector src, Rcpp::Charac...
  function CPL_gdalmdiminfo (line 453) | Rcpp::CharacterVector CPL_gdalmdiminfo(Rcpp::CharacterVector obj, Rcpp::...
  function CPL_gdalmdimtranslate (line 477) | Rcpp::LogicalVector CPL_gdalmdimtranslate(Rcpp::CharacterVector src, Rcp...
  function CPL_gdalmdiminfo (line 512) | Rcpp::CharacterVector CPL_gdalmdiminfo(Rcpp::CharacterVector obj, Rcpp::...
  function CPL_gdalmdimtranslate (line 516) | Rcpp::LogicalVector CPL_gdalmdimtranslate(Rcpp::CharacterVector src, Rcp...
  function CPL_gdalinfo (line 526) | Rcpp::CharacterVector CPL_gdalinfo(Rcpp::CharacterVector obj, Rcpp::Char...
  function CPL_gdalwarp (line 531) | Rcpp::LogicalVector CPL_gdalwarp(Rcpp::CharacterVector src, Rcpp::Charac...
  function CPL_gdalrasterize (line 536) | Rcpp::LogicalVector CPL_gdalrasterize(Rcpp::CharacterVector src, Rcpp::C...
  function CPL_gdaltranslate (line 542) | Rcpp::LogicalVector CPL_gdaltranslate(Rcpp::CharacterVector src, Rcpp::C...
  function CPL_gdalvectortranslate (line 547) | Rcpp::LogicalVector CPL_gdalvectortranslate(Rcpp::CharacterVector src, R...
  function CPL_gdalbuildvrt (line 552) | Rcpp::LogicalVector CPL_gdalbuildvrt(Rcpp::CharacterVector src, Rcpp::Ch...
  function CPL_gdaldemprocessing (line 557) | Rcpp::LogicalVector CPL_gdaldemprocessing(Rcpp::CharacterVector src, Rcp...
  function CPL_gdalnearblack (line 563) | Rcpp::LogicalVector CPL_gdalnearblack(Rcpp::CharacterVector src, Rcpp::C...
  function CPL_gdalgrid (line 568) | Rcpp::LogicalVector CPL_gdalgrid(Rcpp::CharacterVector src, Rcpp::Charac...
  function CPL_gdalmdiminfo (line 573) | Rcpp::CharacterVector CPL_gdalmdiminfo(Rcpp::CharacterVector obj, Rcpp::...
  function CPL_gdalmdimtranslate (line 578) | Rcpp::LogicalVector CPL_gdalmdimtranslate(Rcpp::CharacterVector src, Rcp...
  function CPL_gdal_warper (line 587) | Rcpp::LogicalVector CPL_gdal_warper(Rcpp::CharacterVector infile, Rcpp::...

FILE: src/gdal_write.cpp
  function SetupFields (line 10) | std::vector<OGRFieldType> SetupFields(OGRLayer *poLayer, Rcpp::List obj,...
  function get_dbl6 (line 49) | Rcpp::NumericVector get_dbl6(Rcpp::List in) {
  function SetNull (line 58) | void SetNull(OGRFeature *poFeature, size_t field) {
  function GetFieldIndex (line 66) | std::vector<int> GetFieldIndex(OGRLayer *poLayer, Rcpp::List obj) {
  function SetFields (line 80) | void SetFields(OGRFeature *poFeature, std::vector<OGRFieldType> tp, Rcpp...
  function CPL_write_ogr (line 175) | int CPL_write_ogr(Rcpp::List obj, Rcpp::CharacterVector dsn, Rcpp::Chara...
  function CPL_delete_ogr (line 385) | int CPL_delete_ogr(Rcpp::CharacterVector dsn, Rcpp::CharacterVector layer,

FILE: src/geos.cpp
  function __errorHandler (line 70) | static void __errorHandler(const char *fmt, ...) { // #nocov start
  function __warningHandler (line 86) | static void __warningHandler(const char *fmt, ...) {
  function __countErrorHandler (line 103) | static void __countErrorHandler(const char *fmt, void *userdata) {
  function __emptyNoticeHandler (line 108) | static void __emptyNoticeHandler(const char *fmt, void *userdata) { }
  function __checkInterruptFn (line 111) | static void __checkInterruptFn(void*) {
  function __checkInterrupt (line 115) | static void __checkInterrupt() {
  function __warningIgnore (line 125) | static void __warningIgnore(const char *fmt, ...) {
  function GEOSContextHandle_t (line 129) | inline GEOSContextHandle_t geos_init(void) {
  function geos_finish (line 141) | inline void geos_finish(GEOSContextHandle_t ctxt) {
  function GEOSContextHandle_t (line 149) | inline GEOSContextHandle_t geos_init2(void) {
  type GEOSContextScope (line 165) | struct GEOSContextScope {
    method GEOSContextScope (line 167) | GEOSContextScope() : hctx(geos_init()) {}
    method GEOSContextScope (line 168) | explicit GEOSContextScope(bool quiet) : hctx(quiet ? geos_init2() : ge...
    method GEOSContextScope (line 171) | GEOSContextScope(const GEOSContextScope&) = delete;
    method GEOSContextScope (line 172) | GEOSContextScope& operator=(const GEOSContextScope&) = delete;
  function cb (line 177) | void cb(void *item, void *userdata) { // callback function for tree sele...
  function GeomPtr (line 186) | static GeomPtr geos_ptr(GEOSGeometry* g, GEOSContextHandle_t hGEOSctxt) {
  function PrepGeomPtr (line 191) | static PrepGeomPtr geos_ptr(const GEOSPreparedGeometry* pg, GEOSContextH...
  function TreePtr (line 196) | static TreePtr geos_ptr(GEOSSTRtree* t, GEOSContextHandle_t hGEOSctxt) {
  function to_raw (line 201) | static std::vector<GEOSGeometry*> to_raw(std::vector<GeomPtr> & g) {
  function geos_grid_size (line 207) | double geos_grid_size(Rcpp::List x) {
  function geos_grid_size_xy (line 214) | double geos_grid_size_xy(Rcpp::List x, Rcpp::List y) {
  function geometries_from_sfc (line 218) | std::vector<GeomPtr> geometries_from_sfc(GEOSContextHandle_t hGEOSCtxt, ...
  function sfc_from_geometry (line 258) | Rcpp::List sfc_from_geometry(GEOSContextHandle_t hGEOSCtxt, std::vector<...
  function get_dim (line 291) | Rcpp::NumericVector get_dim(double dim0, double dim1) {
  function get_which (line 298) | Rcpp::IntegerVector get_which(Rcpp::LogicalVector row) {
  function chk_ (line 306) | bool chk_(char value) {
  function log_fn (line 312) | log_fn which_geom_fn(const std::string op) {
  function log_prfn (line 337) | log_prfn which_prep_geom_fn(const std::string op) {
  function CPL_geos_binop (line 376) | Rcpp::List CPL_geos_binop(Rcpp::List sfc0, Rcpp::List sfc1, std::string ...
  function CPL_geos_binop_by_element (line 564) | Rcpp::List CPL_geos_binop_by_element(Rcpp::List sfc0, Rcpp::List sfc1,
  function CPL_geos_is_valid_reason (line 630) | Rcpp::CharacterVector CPL_geos_is_valid_reason(Rcpp::List sfc) {
  function CPL_geos_make_valid (line 653) | Rcpp::List CPL_geos_make_valid(Rcpp::List sfc, std::string method, bool ...
  function CPL_geos_is_valid (line 684) | Rcpp::LogicalVector CPL_geos_is_valid(Rcpp::List sfc, bool NA_on_excepti...
  function CPL_geos_is_simple (line 732) | Rcpp::LogicalVector CPL_geos_is_simple(Rcpp::List sfc) {
  function CPL_geos_is_empty (line 742) | Rcpp::LogicalVector CPL_geos_is_empty(Rcpp::List sfc) {
  function CPL_geos_normalize (line 752) | Rcpp::List CPL_geos_normalize(Rcpp::List sfc) { // #nocov start
  function CPL_geos_union (line 767) | Rcpp::List CPL_geos_union(Rcpp::List sfc, bool by_feature = false, bool ...
  function CPL_geos_snap (line 820) | Rcpp::List CPL_geos_snap(Rcpp::List sfc0, Rcpp::List sfc1, Rcpp::Numeric...
  function GEOSGeometry (line 844) | GEOSGeometry *chkNULL(GEOSGeometry *value) {
  function CPL_geos_op (line 852) | Rcpp::List CPL_geos_op(std::string op, Rcpp::List sfc,
  function CPL_geos_voronoi (line 985) | Rcpp::List CPL_geos_voronoi(Rcpp::List sfc, Rcpp::List env, double dTole...
  function CPL_geos_op2 (line 1018) | Rcpp::List CPL_geos_op2(std::string op, Rcpp::List sfcx, Rcpp::List sfcy) {
  function CPL_geos_dist_by_element (line 1132) | Rcpp::NumericVector CPL_geos_dist_by_element(Rcpp::List sfc0, Rcpp::List...
  function CPL_geos_version (line 1196) | std::string CPL_geos_version(bool runtime = false, bool capi = false) {
  function CPL_geos_op2_by_element (line 1208) | Rcpp::List CPL_geos_op2_by_element(std::string op, Rcpp::List sfcx, Rcpp...
  function CPL_geos_dist (line 1276) | Rcpp::NumericMatrix CPL_geos_dist(Rcpp::List sfc0, Rcpp::List sfc1,
  function distance_fn (line 1287) | int distance_fn(const void *item1, const void *item2, double *distance, ...
  function CPL_geos_nearest_feature (line 1292) | Rcpp::IntegerVector CPL_geos_nearest_feature(Rcpp::List sfc0, Rcpp::List...
  function CPL_geos_nearest_feature (line 1330) | Rcpp::IntegerVector CPL_geos_nearest_feature(Rcpp::List sfc0, Rcpp::List...
  function CPL_geos_nearest_points (line 1336) | Rcpp::List CPL_geos_nearest_points(Rcpp::List sfc0, Rcpp::List sfc1, boo...
  function CPL_transpose_sparse_incidence (line 1366) | Rcpp::List CPL_transpose_sparse_incidence(Rcpp::List m, int n) {
  function CPL_nary_difference (line 1395) | Rcpp::List CPL_nary_difference(Rcpp::List sfc) {
  function CPL_nary_intersection (line 1463) | Rcpp::List CPL_nary_intersection(Rcpp::List sfc) {
  function CPL_line_project (line 1580) | Rcpp::NumericVector CPL_line_project(Rcpp::List lines, Rcpp::List points...
  function CPL_line_interpolate (line 1597) | Rcpp::List CPL_line_interpolate(Rcpp::List lines, Rcpp::NumericVector di...

FILE: src/hex.cpp
  function char2int (line 3) | inline unsigned char char2int(char c) {
  function CPL_hex_to_raw (line 15) | Rcpp::List CPL_hex_to_raw(Rcpp::CharacterVector cx) {
  function CPL_raw_to_hex (line 35) | Rcpp::CharacterVector CPL_raw_to_hex(Rcpp::RawVector raw) {

FILE: src/mdim.cpp
  function CharacterVector (line 17) | CharacterVector get_attributes(std::vector<std::shared_ptr<GDALAttribute...
  function List (line 31) | List get_dimension_values(std::shared_ptr<GDALMDArray> array) {
  function List (line 91) | List get_dimension(const std::shared_ptr<GDALDimension> dim) {
  function List (line 113) | List get_geometry(std::shared_ptr<GDALGroup> curGroup) {
  function List (line 154) | List get_all_arrays(std::shared_ptr<GDALGroup> curGroup, List ret, std::...
  function get_array (line 186) | std::shared_ptr<GDALMDArray> get_array(std::shared_ptr<GDALGroup> grp, c...
  function List (line 206) | List CPL_read_mdim(CharacterVector file, CharacterVector array_names, Ch...
  function write_attributes (line 417) | void write_attributes(std::shared_ptr<GDALMDArray> md, CharacterVector a...
  function List (line 435) | List CPL_write_mdim(CharacterVector name, CharacterVector driver, Intege...
  function List (line 597) | List CPL_read_mdim(CharacterVector file, CharacterVector array_names, Ch...
  function List (line 603) | List CPL_write_mdim(CharacterVector name, CharacterVector driver, Intege...

FILE: src/ops.cpp
  function add_feature (line 3) | void add_feature(SEXP &feature, SEXP &value) {
  function mult_feature (line 22) | void mult_feature(SEXP &feature, SEXP &value) {
  function recursive_opp (line 42) | void recursive_opp(SEXP &feature, SEXP &value, int mult) {
  function transform_bbox (line 63) | void transform_bbox(SEXP &feature, SEXP &value, int mult) {
  function SEXP (line 80) | SEXP opp_sfc(SEXP geom, SEXP value, SEXP mult, SEXP crs) {
  function SEXP (line 94) | SEXP normalize_sfc(SEXP geom, SEXP min, SEXP range, SEXP crs) {

FILE: src/polygonize.cpp
  function CPL_polygonize (line 24) | Rcpp::List CPL_polygonize(Rcpp::CharacterVector raster, Rcpp::CharacterV...
  function CPL_rasterize (line 146) | Rcpp::List CPL_rasterize(Rcpp::CharacterVector raster, Rcpp::CharacterVe...

FILE: src/proj.cpp
  function CPL_proj_h (line 12) | Rcpp::LogicalVector CPL_proj_h(bool b = false) {
  function CPL_get_pipelines (line 34) | Rcpp::DataFrame CPL_get_pipelines(Rcpp::CharacterVector crs, Rcpp::Chara...
  function CPL_get_data_dir (line 191) | Rcpp::CharacterVector CPL_get_data_dir(bool from_proj = false) {
  function CPL_is_network_enabled (line 208) | Rcpp::LogicalVector CPL_is_network_enabled(bool b = false) {
  function CPL_enable_network (line 221) | Rcpp::CharacterVector CPL_enable_network(Rcpp::CharacterVector url, bool...
  function CPL_set_data_dir (line 244) | Rcpp::LogicalVector CPL_set_data_dir(Rcpp::CharacterVector data_dir, boo...
  function CPL_use_proj4_init_rules (line 263) | Rcpp::LogicalVector CPL_use_proj4_init_rules(Rcpp::IntegerVector v) {
  function CPL_proj_version (line 269) | std::string CPL_proj_version(bool b = false) {
  function CPL_proj_is_valid (line 277) | Rcpp::List CPL_proj_is_valid(std::string proj4string) {
  function CPL_have_datum_files (line 296) | bool CPL_have_datum_files(SEXP foo) {
  function CPL_proj_direct (line 305) | Rcpp::NumericMatrix CPL_proj_direct(Rcpp::CharacterVector from_to, Rcpp:...
  function CPL_get_pipelines (line 426) | Rcpp::DataFrame CPL_get_pipelines(Rcpp::CharacterVector crs, Rcpp::Chara...
  function CPL_is_network_enabled (line 437) | Rcpp::LogicalVector CPL_is_network_enabled(bool b = false) {
  function CPL_enable_network (line 445) | Rcpp::CharacterVector CPL_enable_network(Rcpp::CharacterVector url, bool...
  function CPL_get_data_dir (line 461) | Rcpp::CharacterVector CPL_get_data_dir(bool from_proj = false) {
  function CPL_set_data_dir (line 469) | Rcpp::LogicalVector CPL_set_data_dir(Rcpp::CharacterVector data_dir, boo...
  function CPL_use_proj4_init_rules (line 473) | Rcpp::LogicalVector CPL_use_proj4_init_rules(Rcpp::IntegerVector v) {
  function CPL_proj_version (line 485) | std::string CPL_proj_version(bool b = false) {
  function CPL_proj_is_valid (line 492) | Rcpp::List CPL_proj_is_valid(std::string proj4string) {
  function CPL_have_datum_files (line 508) | bool CPL_have_datum_files(SEXP foo) {
  function CPL_proj_direct (line 529) | Rcpp::NumericMatrix CPL_proj_direct(Rcpp::CharacterVector from_to, Rcpp:...

FILE: src/proj_info.cpp
  function CPL_proj_info (line 7) | Rcpp::List CPL_proj_info(int type) {
  type PJconsts (line 152) | struct PJconsts
  type PJ_LIST (line 153) | struct PJ_LIST {
    type PJconsts (line 155) | struct PJconsts
    type PJconsts (line 155) | struct PJconsts
  type PJ_LIST (line 158) | struct PJ_LIST
    type PJconsts (line 155) | struct PJconsts
    type PJconsts (line 155) | struct PJconsts
  type PJ_ELLPS (line 159) | struct PJ_ELLPS {
  type PJ_ELLPS (line 165) | struct PJ_ELLPS
  type PJ_DATUMS (line 166) | struct PJ_DATUMS {
  type PJ_DATUMS (line 172) | struct PJ_DATUMS
  type PJ_UNITS (line 173) | struct PJ_UNITS {
  type PJ_UNITS (line 181) | struct PJ_UNITS
  function CPL_proj_info (line 185) | Rcpp::List CPL_proj_info(int type) {

FILE: src/raster2sf.cpp
  function List (line 6) | List CPL_xy2sfc(NumericMatrix cc, IntegerVector dim, bool to_points, Int...

FILE: src/sfc-sfg.cpp
  function LogicalVector (line 7) | LogicalVector sfc_is_null(List sfc) {
  function List (line 26) | List sfc_unique_sfg_dims_and_types(List sfc) {
  function LogicalVector (line 97) | LogicalVector sfc_is_empty(List sfc) {
  function LogicalVector (line 142) | LogicalVector sfc_is_full(List sfc) {
  function List (line 162) | List points_cpp(NumericMatrix pts, CharacterVector gdim = "XY") {

FILE: src/signed_area.cpp
  function CPL_signed_area (line 9) | double CPL_signed_area(NumericMatrix pts) {

FILE: src/stars.cpp
  function CharacterVector (line 18) | CharacterVector get_meta_data(GDALDatasetH ds, CharacterVector domain_it...
  function List (line 39) | List get_band_meta_data(GDALDataset *poDataset) {
  function CharacterVector (line 50) | CharacterVector CPL_get_metadata(CharacterVector obj, CharacterVector do...
  function List (line 62) | List CPL_get_crs(CharacterVector obj, CharacterVector options) {
  function NumericVector (line 92) | NumericVector CPL_inv_geotransform(NumericVector gt_r) {
  function equals_na (line 105) | bool equals_na(double value, double na, GDALDataType dt) {
  function NumericVector (line 115) | NumericVector read_gdal_data(GDALDataset *poDataset,
  function get_from_list (line 196) | int get_from_list(List lst, const char *name, int otherwise) {
  function NumericMatrix (line 204) | NumericMatrix get_color_table(GDALColorTable *tbl) {
  function List (line 219) | List get_cat(char **cat) {
  function List (line 241) | List get_rat(GDALRasterAttributeTable *tbl) {
  function List (line 286) | List CPL_read_gdal(CharacterVector fname, CharacterVector options, Chara...
  function CPL_write_gdal (line 495) | void CPL_write_gdal(NumericMatrix x, CharacterVector fname, CharacterVec...
  function get_bilinear (line 698) | double get_bilinear(GDALRasterBand *poBand, double Pixel, double Line,
  function NumericMatrix (line 753) | NumericMatrix CPL_extract(CharacterVector input, NumericMatrix xy, Chara...
  function CPL_create (line 836) | void CPL_create(CharacterVector file, IntegerVector nxy, NumericVector v...

FILE: src/wkb.cpp
  function wkb_read (line 34) | static inline void wkb_read(wkb_buf *wkb, void *dst, size_t n) {
  function T (line 44) | inline T wkb_read(wkb_buf *wkb) {
  function T (line 57) | T swap_endian(T u) {
  function read_spatialite_header (line 69) | void read_spatialite_header(wkb_buf *wkb, uint32_t *srid, bool swap) {
  function read_gpkg_header (line 86) | void read_gpkg_header(wkb_buf *wkb, uint32_t *srid, int endian) {
  function read_multipoint (line 113) | Rcpp::NumericMatrix read_multipoint(wkb_buf *wkb, int n_dims, bool swap,
  function read_geometrycollection (line 145) | Rcpp::List read_geometrycollection(wkb_buf *wkb, int n_dims, bool swap, ...
  function read_numeric_vector (line 175) | Rcpp::NumericVector read_numeric_vector(wkb_buf *wkb, int n, bool swap,
  function read_numeric_matrix (line 192) | Rcpp::NumericMatrix read_numeric_matrix(wkb_buf *wkb, int n_dims, bool s...
  function read_matrix_list (line 216) | Rcpp::List read_matrix_list(wkb_buf *wkb, int n_dims, bool swap,
  function read_data (line 235) | Rcpp::List read_data(wkb_buf *wkb, bool EWKB = false, bool spatialite = ...
  function native_endian (line 397) | int native_endian(void) {
  function CPL_read_wkb (line 404) | Rcpp::List CPL_read_wkb(Rcpp::List wkb_list, bool EWKB = false, bool spa...
  function make_type (line 440) | unsigned int make_type(const char *cls, const char *dim, bool EWKB = fal...
  function add_byte (line 503) | void add_byte(std::ostringstream& os, char c) {
  function add_int (line 507) | void add_int(std::ostringstream& os, unsigned int i) {
  function make_precise (line 512) | double make_precise(double d, double precision) {
  function add_double (line 522) | void add_double(std::ostringstream& os, double d, double prec = 0.0) {
  function write_vector (line 528) | void write_vector(std::ostringstream& os, Rcpp::NumericVector vec, doubl...
  function write_matrix (line 533) | void write_matrix(std::ostringstream& os, Rcpp::NumericMatrix mat, doubl...
  function write_matrix_list (line 543) | void write_matrix_list(std::ostringstream& os, Rcpp::List lst, double pr...
  function write_multilinestring (line 550) | void write_multilinestring(std::ostringstream& os, Rcpp::List lst, bool ...
  function write_multipolygon (line 559) | void write_multipolygon(std::ostringstream& os, Rcpp::List lst, bool EWK...
  function write_triangles (line 568) | void write_triangles(std::ostringstream& os, Rcpp::List lst, bool EWKB =...
  function write_geometrycollection (line 577) | void write_geometrycollection(std::ostringstream& os, Rcpp::List lst, bo...
  function write_multipoint (line 588) | void write_multipoint(std::ostringstream& os, Rcpp::NumericMatrix mat,
  function write_data (line 602) | void write_data(std::ostringstream& os, Rcpp::List sfc, int i = 0, bool ...
  function CPL_write_wkb (line 655) | Rcpp::List CPL_write_wkb(Rcpp::List sfc, bool EWKB = false) {
  function get_dim_sfc (line 721) | Rcpp::List get_dim_sfc(Rcpp::List sfc) {

FILE: src/zm_range.cpp
  function get_m_position (line 5) | int get_m_position(Rcpp::NumericVector& pt) {
  function get_m_position (line 13) | int get_m_position(Rcpp::NumericMatrix& nm) {
  function get_z_position (line 21) | int get_z_position(Rcpp::NumericVector& pt) {
  function get_z_position (line 28) | int get_z_position(Rcpp::NumericMatrix& nm) {
  function CPL_get_z_range (line 36) | Rcpp::NumericVector CPL_get_z_range(Rcpp::List sf, int depth) {
  function CPL_get_m_range (line 104) | Rcpp::NumericVector CPL_get_m_range(Rcpp::List sf, int depth) {
Condensed preview — 340 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,459K chars).
[
  {
    "path": ".Rbuildignore",
    "chars": 334,
    "preview": ".travis.yml\nPROPOSAL.md\nconfig.log\nconfig.status\nTODO\n^windows\n^appveyor\\.yml$\n^.*\\.Rproj$\n^\\.Rproj\\.user$\nblog\nREADME.m"
  },
  {
    "path": ".gitattributes",
    "chars": 160,
    "preview": "* text=auto\ndata/* binary\nsrc/* text=lf\nR/* text=lf\n\n# Force the following filetypes to have unix eols, so Windows does "
  },
  {
    "path": ".github/.gitignore",
    "chars": 7,
    "preview": "*.html\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 611,
    "preview": "---\nname: Bug report\nabout: Standard bug report template\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the bug**\nA"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/other_issue.md",
    "chars": 108,
    "preview": "---\nname: Other issue\nabout: Blank template for other issue types\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n\n"
  },
  {
    "path": ".github/workflows/R-CMD-check.yaml",
    "chars": 1529,
    "preview": "# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples\n# Need help debugging build failures? Start at"
  },
  {
    "path": ".github/workflows/pkgdown.yaml",
    "chars": 1324,
    "preview": "# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples\n# Need help debugging build failures? Start at"
  },
  {
    "path": ".github/workflows/rhub.yaml",
    "chars": 2942,
    "preview": "# R-hub's generic GitHub Actions workflow file. It's canonical location is at\n# https://github.com/r-hub/actions/blob/v1"
  },
  {
    "path": ".github/workflows/test-coverage.yaml",
    "chars": 1374,
    "preview": "# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples\n# Need help debugging build failures? Start at"
  },
  {
    "path": ".github/workflows/tic-db.yml",
    "chars": 5951,
    "preview": "## tic GitHub Actions template: linux\n## revision date: 2021-06-27\n# [Custom header]\non:\n  workflow_dispatch:\n  push:\n  "
  },
  {
    "path": ".gitignore",
    "chars": 199,
    "preview": ".Rproj.user\n.Rhistory\n.RData\n.Ruserdata\n\nsrc/*.o\nsrc/*.so\nsrc/*.dll\nsrc/Makevars\nconfig.log\nconfig.status\n\nwindows/\ninst"
  },
  {
    "path": "CONDUCT.md",
    "chars": 1387,
    "preview": "# Contributor Code of Conduct\n\nAs contributors and maintainers of this project, we pledge to respect all people who \ncon"
  },
  {
    "path": "DESCRIPTION",
    "chars": 4303,
    "preview": "Package: sf\nVersion: 1.1-1\nTitle: Simple Features for R\nAuthors@R:\n    c(person(given = \"Edzer\",\n             family = \""
  },
  {
    "path": "LICENSE",
    "chars": 48,
    "preview": "YEAR: 2016-2024\nCOPYRIGHT HOLDER: Edzer Pebesma\n"
  },
  {
    "path": "NAMESPACE",
    "chars": 15226,
    "preview": "# Generated by roxygen2: do not edit by hand\n\nS3method(\"$\",bbox)\nS3method(\"$\",crs)\nS3method(\"$\",m_range)\nS3method(\"$\",z_"
  },
  {
    "path": "NEWS.md",
    "chars": 52336,
    "preview": "# version 1.1-1\n\n* use RAII in functions calling GEOS for handling context, based on how terra does this; #2604\n\n* `st_g"
  },
  {
    "path": "PROPOSAL.md",
    "chars": 9982,
    "preview": "# Simple Features for R\n\nApplicant: [Edzer Pebesma](https://github.com/edzer/), [Institute for Geoinformatics](https://w"
  },
  {
    "path": "R/RcppExports.R",
    "chars": 14181,
    "preview": "# Generated by using Rcpp::compileAttributes() -> do not edit by hand\n# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD"
  },
  {
    "path": "R/aggregate.R",
    "chars": 12354,
    "preview": "#' aggregate an \\code{sf} object\n#'\n#' aggregate an \\code{sf} object, possibly union-ing geometries\n#' \n#' @note Does no"
  },
  {
    "path": "R/agr.R",
    "chars": 2954,
    "preview": "agr_levels = c(\"constant\", \"aggregate\", \"identity\")\n\n#' @name st_agr\n#' @details\n#' \\code{NA_agr_} is the \\code{agr} obj"
  },
  {
    "path": "R/arith.R",
    "chars": 6786,
    "preview": "#' Arithmetic operators for simple feature geometries\n#' @name Ops\n#'\n#' @param e1 object of class \\code{sfg} or \\code{s"
  },
  {
    "path": "R/bbox.R",
    "chars": 6453,
    "preview": "\n#' @name st_bbox\n#' @param x object of class \\code{bbox}\n#' @export\nis.na.bbox = function(x) identical(x, NA_bbox_)\n\nbb"
  },
  {
    "path": "R/bind.R",
    "chars": 3306,
    "preview": "chk_equal_crs = function(dots) {\n\tif (length(dots) > 1L) {\n\t\tcrs0 = st_crs(dots[[1]])\n\t\tvapply(dots[-1L], function(x) {\n"
  },
  {
    "path": "R/break_antimeridian.R",
    "chars": 5093,
    "preview": "\n#' Break antimeridian for plotting not centred on Greenwich\n#'\n#' Longitudes can be broken at the antimeridian of a tar"
  },
  {
    "path": "R/cast_sfc.R",
    "chars": 12194,
    "preview": "#' Cast geometry to another type: either simplify, or cast explicitly\n#'\n#' Cast geometry to another type: either simpli"
  },
  {
    "path": "R/cast_sfg.R",
    "chars": 8935,
    "preview": "## utility functions, patterns that are either used elsewhere or can be \n##  replaced by other changes \n## \n## worker fu"
  },
  {
    "path": "R/collection_extract.R",
    "chars": 5042,
    "preview": "#' Given an object with geometries of type \\code{GEOMETRY} or \\code{GEOMETRYCOLLECTION},\n#' return an object consisting "
  },
  {
    "path": "R/crop.R",
    "chars": 1496,
    "preview": "\n#' crop an sf object to a specific rectangle\n#' @param x object of class \\code{sf} or \\code{sfc}\n#' @param y numeric ve"
  },
  {
    "path": "R/crs.R",
    "chars": 16090,
    "preview": "#  alternative, but more limiting from sp/R/CRS-methods.R, https://github.com/edzer/sp/pull/31 @hughjonesd\n#  (no longer"
  },
  {
    "path": "R/datasets.R",
    "chars": 711,
    "preview": "#' North Carolina SIDS data\n#'\n#' Sudden Infant Death Syndrome (SIDS) sample data for North Carolina counties,\n#' two ti"
  },
  {
    "path": "R/db.R",
    "chars": 20375,
    "preview": "#' Read PostGIS table directly, using DBI and binary conversion\n#'\n#' Read PostGIS table directly through DBI and RPostg"
  },
  {
    "path": "R/defunct.R",
    "chars": 1076,
    "preview": "#' @title Deprecated functions in `sf`\n#' @name sf-defunct\n#' @description\n#' These functions are provided for compatibi"
  },
  {
    "path": "R/gdal_utils.R",
    "chars": 6576,
    "preview": "# nocov start\nresampling_method = function(option = \"near\") {\n\tif (length(option) != 1)\n\t\tstop(\"warper options should ha"
  },
  {
    "path": "R/geom-measures.R",
    "chars": 11498,
    "preview": "# unary, interfaced through GEOS:\n\n#' Dimension, simplicity, validity or is_empty queries on simple feature geometries\n#"
  },
  {
    "path": "R/geom-predicates.R",
    "chars": 15976,
    "preview": "#' @name geos_query\n#' @export\n#' @return st_is_simple returns a logical vector, indicating for each geometry whether it"
  },
  {
    "path": "R/geom-transformers.R",
    "chars": 56320,
    "preview": "\n# unary, returning geometries\n\n#' Geometric unary operations on simple feature geometry sets\n#'\n#' Geometric unary oper"
  },
  {
    "path": "R/geos-overlayng.R",
    "chars": 746,
    "preview": "# nocov start\nis_overlayng <- function() {\n\tpl1 = st_polygon(list(matrix(c(0, 0, 2, 0, 1, 1, 0 ,0), byrow = TRUE, ncol=2"
  },
  {
    "path": "R/graticule.R",
    "chars": 9197,
    "preview": "st_datum = function(x) {\n\tstopifnot(inherits(x, c(\"crs\", \"sf\", \"sfc\")))\n\tif (inherits(x, \"crs\"))\n\t\tx = st_sfc(st_point()"
  },
  {
    "path": "R/grid.R",
    "chars": 10947,
    "preview": "#' Convert sf* object to a grob\n#'\n#' Convert sf* object to an grid graphics object (grob)\n#' @param x object to be conv"
  },
  {
    "path": "R/import-standalone-s3-register.R",
    "chars": 6072,
    "preview": "# Standalone file: do not edit by hand\n# Source: <https://github.com/r-lib/rlang/blob/main/R/standalone-s3-register.R>\n#"
  },
  {
    "path": "R/init.R",
    "chars": 4697,
    "preview": "#' @importFrom utils head object.size str tail packageVersion compareVersion globalVariables\n#' @importFrom stats aggreg"
  },
  {
    "path": "R/jitter.R",
    "chars": 1666,
    "preview": "\n#' jitter geometries\n#' @param x object of class \\code{sf} or \\code{sfc}\n#' @param amount numeric; amount of jittering "
  },
  {
    "path": "R/join.R",
    "chars": 7512,
    "preview": "check_join = function(x, y) {\n\tif (inherits(y, \"sf\"))\n\t\tstop(\"y should not have class sf; for spatial joins, use st_join"
  },
  {
    "path": "R/m_range.R",
    "chars": 4760,
    "preview": "\n#' @name st_m_range\n#' @param x object of class \\code{m_range}\n#' @export\nis.na.m_range = function(x) identical(x, NA_m"
  },
  {
    "path": "R/make_grid.R",
    "chars": 7345,
    "preview": "#' Create a regular tesselation over the bounding box of an sf or sfc object\n#'\n#' Create a square or hexagonal grid cov"
  },
  {
    "path": "R/maps.R",
    "chars": 2441,
    "preview": "NAmat2xyList <- function(xy) {\n\tNAs <- unclass(attr(na.omit(xy), \"na.action\"))\n\tif ((length(NAs) == 1L) && (NAs == nrow("
  },
  {
    "path": "R/nearest.R",
    "chars": 5684,
    "preview": "#' get nearest points between pairs of geometries\n#' \n#' get nearest points between pairs of geometries\n#' @param x obje"
  },
  {
    "path": "R/normalize.R",
    "chars": 1475,
    "preview": "#' Normalize simple features\n#'\n#' \\code{st_normalize} transforms the coordinates in the input feature to fall\n#' betwee"
  },
  {
    "path": "R/plot.R",
    "chars": 39715,
    "preview": "kw_dflt = function(x, key.pos) {\n\tif (is.null(key.pos) || key.pos[1] == 0) # no key:\n\t\treturn(lcm(0))\n\n\tfont_scale = par"
  },
  {
    "path": "R/proj.R",
    "chars": 9796,
    "preview": "\n#' @name st_transform\n#' @param type character; one of `have_datum_files`, `proj`, `ellps`, `datum`, `units`, `path`, o"
  },
  {
    "path": "R/read.R",
    "chars": 33001,
    "preview": "sf_stringsAsFactors = function() {\n\tif (getRversion() < \"4.1.0\")\n\t\tdefault.stringsAsFactors()\n\telse\n\t\tFALSE\n}\n\nset_utf8 "
  },
  {
    "path": "R/s2.R",
    "chars": 3812,
    "preview": "# see https://docs.google.com/presentation/d/1Hl4KapfAENAOf4gv-pSngKwvS_jwNVHRPZTTDzXXn6Q/view?pli=1#slide=id.i0\n# and t"
  },
  {
    "path": "R/sample.R",
    "chars": 16596,
    "preview": "#' @export\n#' @name st_sample\nst_sample = function(x, size, ...) UseMethod(\"st_sample\")\n\n#' sample points on or in (sets"
  },
  {
    "path": "R/sf-package.R",
    "chars": 467,
    "preview": "#' @keywords internal\n#' @aliases sf-package\n#' @references \n#' Pebesma, E. and Bivand, R. (2023). Spatial Data\n#'   Sci"
  },
  {
    "path": "R/sf.R",
    "chars": 19792,
    "preview": "#' Convert foreign object to an sf object\n#'\n#' Convert foreign object to an sf object\n#' @param x object to be converte"
  },
  {
    "path": "R/sfc.R",
    "chars": 23257,
    "preview": "#' @export\nstr.sfc <- function(object, ...) {\n\tn <- length(object)\n\tcat(paste0(class(object)[1], \" of length \", n))\n\tif "
  },
  {
    "path": "R/sfg.R",
    "chars": 12831,
    "preview": "# dim: what does the third dimension, if present, refer to? (XYZ or XYM)\ngetClassDim = function(x, d, dim = \"XYZ\", type)"
  },
  {
    "path": "R/sgbp.R",
    "chars": 3831,
    "preview": "sgbp = function(x, predicate, region.id, ncol, sparse = TRUE, remove_self = FALSE, \n\t\t\t\tretain_unique = FALSE) {\n\tif (re"
  },
  {
    "path": "R/shift_longitude.R",
    "chars": 1435,
    "preview": "#' Shift or re-center geographical coordinates for a Pacific view\n#'\n#' @description\n#'   All longitudes < 0 are added t"
  },
  {
    "path": "R/sp.R",
    "chars": 15251,
    "preview": "## Method coordinates\n## @name coordinates\n## @exportMethod coordinates\n#if (!isGeneric(\"coordinates\"))\n#    setGeneric("
  },
  {
    "path": "R/spatstat.R",
    "chars": 9767,
    "preview": "# window_polygons_from_edges = function(w) {\n#\tmw = as.matrix(w$ends)\n#\tlst1 = lapply(seq_len(NROW(mw)), function(i) st_"
  },
  {
    "path": "R/stars.R",
    "chars": 17387,
    "preview": "#' functions to interact with gdal not meant to be called directly by users (but e.g. by stars::read_stars)\n#'\n#' @param"
  },
  {
    "path": "R/terra.R",
    "chars": 1569,
    "preview": "# see https://github.com/r-spatial/sf/issues/1567\n#' @export\nst_as_sf.SpatVector = function(x, ..., hex = TRUE, crs = st"
  },
  {
    "path": "R/tidyverse-vctrs.R",
    "chars": 7819,
    "preview": "types = c(\"POINT\", \"MULTIPOINT\", \"LINESTRING\", \"MULTILINESTRING\", \n            \"POLYGON\", \"MULTIPOLYGON\", \"GEOMETRYCOLLE"
  },
  {
    "path": "R/tidyverse.R",
    "chars": 26111,
    "preview": "## dplyr methods: ------\n#group_map.sf <- function(.tbl, .f, ...) {\n#\t st_as_sf(NextMethod()) # nocov\n#}\n\n# This is curr"
  },
  {
    "path": "R/transform.R",
    "chars": 8352,
    "preview": "chk_pol = function(x, dim = class(x)[1]) {\n\tPolClose = function(y) {\n\t\tif (any(head(y[[1]], 1) != tail(y[[1]], 1))) # cl"
  },
  {
    "path": "R/valid.R",
    "chars": 5498,
    "preview": "#' @name valid\n#' @param NA_on_exception logical; if TRUE, for polygons that would otherwise raise a GEOS error (excepti"
  },
  {
    "path": "R/wkb.R",
    "chars": 14110,
    "preview": "# convert character string, as typically PostgreSQL returned blobs, to raw vector;\n# skips a leading \"0x\", as this is cr"
  },
  {
    "path": "R/wkt.R",
    "chars": 7166,
    "preview": "# composed, WKT class name: \"XYZ\", \"POINT\" -> \"POINT Z\"\nWKT_name = function(x, EWKT = TRUE) {\n\tcls = class(x)\n\tzm = subs"
  },
  {
    "path": "R/z_range.R",
    "chars": 4646,
    "preview": "\n#' @name st_z_range\n#' @param x object of class \\code{z_range}\n#' @export\nis.na.z_range = function(x) identical(x, NA_z"
  },
  {
    "path": "README.md",
    "chars": 11575,
    "preview": "<!-- badges: start -->\n[![R-CMD-check](https://github.com/r-spatial/sf/actions/workflows/R-CMD-check.yaml/badge.svg)](ht"
  },
  {
    "path": "_pkgdown.yml",
    "chars": 239,
    "preview": "url: https://r-spatial.github.io/sf/\n\ntemplate:\n  bootstrap: 5\n\nnavbar:\n  structure:\n    left:  [reference, articles, bo"
  },
  {
    "path": "cleanup",
    "chars": 161,
    "preview": "#!/bin/sh\nrm -fr src/Makevars config.log config.status autom4te.cache src/*.o src/*.so\nrm -fr vignette/nc*\nrm -fr proj_c"
  },
  {
    "path": "codecov.yml",
    "chars": 339,
    "preview": "comment: false\nignore:\n  - \"inst/include/sf_RcppExports.h\" \n  - \"sf/R/stars.R\"\n  - \"sf/R/gdal_utils.R\"\n  - \"sf/src/raste"
  },
  {
    "path": "configure",
    "chars": 158846,
    "preview": "#! /bin/sh\n# Guess values for system-dependent variables and create Makefiles.\n# Generated by GNU Autoconf 2.71.\n#\n#\n# C"
  },
  {
    "path": "configure.ac",
    "chars": 20804,
    "preview": "dnl Process this file with autoconf to produce a configure script.\ndnl GDAL stuff largely copied from rgdal, (c) Roger B"
  },
  {
    "path": "demo/00Index",
    "chars": 266,
    "preview": "affine\t\tdemo script for affine transformations\nbasic\t\tsimple feature test script\nggplot\t\tshows use of geom_sf\nmeuse_sf\tc"
  },
  {
    "path": "demo/affine.R",
    "chars": 761,
    "preview": "library(sf)\n\na = 0.95\nb = 0.8\nang = 3 * pi / 180\nrot = function(a) matrix(c(cos(a), sin(a), -sin(a), cos(a)), 2, 2)\nn = "
  },
  {
    "path": "demo/basic.R",
    "chars": 3320,
    "preview": "## ----error=TRUE----------------------------------------------------------\nlibrary(sf)\n(p1 = st_point(c(1,2)))\nclass(p1"
  },
  {
    "path": "demo/ggplot.R",
    "chars": 438,
    "preview": "library(sf)\nnc = st_read(system.file(\"shape/nc.shp\", package=\"sf\"), quiet = TRUE)\n\n# single map:\nlibrary(ggplot2)\nggplot"
  },
  {
    "path": "demo/meuse_sf.R",
    "chars": 167,
    "preview": "data(meuse, package = \"sp\") # load data.frame from sp\nlibrary(sf)\nmeuse_sf = st_as_sf(meuse, coords = c(\"x\", \"y\"), crs ="
  },
  {
    "path": "demo/nc.R",
    "chars": 914,
    "preview": "## this object was created as follows:\nlibrary(sf)\n# nc = st_read(system.file(\"shapes/\", package=\"maptools\"), \"sids\")\n# "
  },
  {
    "path": "demo/twitter.R",
    "chars": 1839,
    "preview": "# see https://gist.github.com/edzer/9c5c24434ffcaf42917796a98c4dd9a6\nlibrary(sf)\ndata(wrld_simpl, package = \"maptools\")\n"
  },
  {
    "path": "inst/CITATION",
    "chars": 975,
    "preview": "citHeader(\"To cite package sf in publications, please use:\")\n\nbibentry(bibtype = \"Book\",\n  author= \"Edzer Pebesma and Ro"
  },
  {
    "path": "inst/csv/pt.csv",
    "chars": 81,
    "preview": "Id,Int64,Int32,WKT\n1,0,33,POINT(0 1)\n2,4294967297,44,POINT(44 55)\n3,,,POINT(0 0)\n"
  },
  {
    "path": "inst/docker/README.md",
    "chars": 2449,
    "preview": "# Build and check sf against r-release and r-devel\n\nSee [here](https://github.com/rocker-org/geospatial) for general doc"
  },
  {
    "path": "inst/docker/alma/Dockerfile",
    "chars": 2213,
    "preview": "#\n# Do not edit: NOW CONTINUED IN\n# https://github.com/Open-EO/openeo-udf-python-to-r/tree/main/docker\n#\nARG SPARK_VERSI"
  },
  {
    "path": "inst/docker/alma/README.md",
    "chars": 167,
    "preview": "VITO openEO backend image; build this docker container with\n```\ndocker build . -t alma --build-arg SPARK_VERSION=3.2.0 -"
  },
  {
    "path": "inst/docker/alma/build_command",
    "chars": 98,
    "preview": "docker build . -t alma --build-arg SPARK_VERSION=3.2.0 --build-arg PYTHON_PACKAGE=python38-devel \n"
  },
  {
    "path": "inst/docker/alma/vito.repo",
    "chars": 245,
    "preview": "[vito-public-alma]\nname=vito-yum-centos-public\nbaseurl=https://artifactory.vgt.vito.be/vito-yum-almalinux8-public/\ngpgch"
  },
  {
    "path": "inst/docker/arrow/Dockerfile",
    "chars": 5355,
    "preview": "FROM ubuntu:22.04\n# minimal docker file to get sf running on ubunty 22.04 image,\n# compiling geos/proj/gdal from source,"
  },
  {
    "path": "inst/docker/base/Dockerfile",
    "chars": 1665,
    "preview": "FROM ubuntu:16.04\n# minimal docker file to get sp and sf running on ubunty 16.04 image,\n# using gdal/geos/proj from ppa:"
  },
  {
    "path": "inst/docker/bionic/Dockerfile",
    "chars": 1596,
    "preview": "FROM ubuntu:18.04\n# minimal docker file to get sp and sf running on ubunty 16.04 image,\n# using gdal/geos/proj from ppa:"
  },
  {
    "path": "inst/docker/cran/Dockerfile",
    "chars": 2132,
    "preview": "FROM debian:testing\n# minimal docker file to get sp and sf running on ubunty 16.04 image,\n# using gdal/geos/proj from pp"
  },
  {
    "path": "inst/docker/custom/Dockerfile",
    "chars": 4159,
    "preview": "FROM ubuntu:18.04\n# minimal docker file to get sf running on an ubunty 16.04 image,\n# installing gdal, geos and proj.4 f"
  },
  {
    "path": "inst/docker/devel/Dockerfile",
    "chars": 4490,
    "preview": "FROM ubuntu:24.04\n# minimal docker file to get sp and sf running on ubunty 16.04 image,\n# using gdal/geos/proj from ppa:"
  },
  {
    "path": "inst/docker/fedora/Dockerfile",
    "chars": 3131,
    "preview": "FROM fedora:latest\n\nMAINTAINER \"edzerpebesma\" edzer.pebesma@uni-muenster.de\n\nRUN yum install -y gdal-devel geos-devel ud"
  },
  {
    "path": "inst/docker/gdal/Dockerfile",
    "chars": 4771,
    "preview": "FROM ubuntu:24.04\n# minimal docker file to get sp and sf running on ubunty 16.04 image,\n# using gdal/geos/proj from ppa:"
  },
  {
    "path": "inst/docker/gdal304/Dockerfile",
    "chars": 4477,
    "preview": "FROM ubuntu:22.04\n# minimal docker file to get sp and sf running on ubunty 16.04 image,\n# using gdal/geos/proj from ppa:"
  },
  {
    "path": "inst/docker/geos/Dockerfile",
    "chars": 4965,
    "preview": "FROM ubuntu:18.04\n# minimal docker file to get sp and sf running on ubunty 16.04 image,\n# using gdal/geos/proj from ppa:"
  },
  {
    "path": "inst/docker/lowest/Dockerfile",
    "chars": 3512,
    "preview": "FROM rocker/r-ver\n# minimal docker file to get sf running on an ubunty 16.04 image,\n# installing gdal, geos and proj.4 f"
  },
  {
    "path": "inst/docker/parquet/Dockerfile",
    "chars": 3681,
    "preview": "FROM ubuntu:22.04\n# minimal docker file to get sp and sf running on ubunty 16.04 image,\n# using gdal/geos/proj from ppa:"
  },
  {
    "path": "inst/gml/fmi_test.gml",
    "chars": 83627,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<wfs:FeatureCollection\n    timeStamp=\"2017-07-13T13:12:35Z\"\n    numberMatched=\"22"
  },
  {
    "path": "inst/include/sf.h",
    "chars": 230,
    "preview": "// Generated by using Rcpp::compileAttributes() -> do not edit by hand\n// Generator token: 10BE3573-1514-4C36-9D1C-5A225"
  },
  {
    "path": "inst/include/sf_RcppExports.h",
    "chars": 2975,
    "preview": "// Generated by using Rcpp::compileAttributes() -> do not edit by hand\n// Generator token: 10BE3573-1514-4C36-9D1C-5A225"
  },
  {
    "path": "inst/nc/zarr.py",
    "chars": 1013,
    "preview": "# from https://zarr.readthedocs.io/en/v1.1.0/tutorial.html\nimport zarr\nz = zarr.zeros((100, 100), chunks=(50, 50), dtype"
  },
  {
    "path": "inst/osm/overpass.osm",
    "chars": 27081,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<osm version=\"0.6\" generator=\"Overpass API\">\n<note>The data included in this docu"
  },
  {
    "path": "inst/shape/olinda1.prj",
    "chars": 147,
    "preview": "GEOGCS[\"GRS 1980(IUGG, 1980)\",DATUM[\"D_unknown\",SPHEROID[\"GRS80\",6378137,298.257222101]],PRIMEM[\"Greenwich\",0],UNIT[\"Deg"
  },
  {
    "path": "man/Ops.Rd",
    "chars": 2870,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/arith.R\n\\name{Ops}\n\\alias{Ops}\n\\alias{Ops."
  },
  {
    "path": "man/aggregate.sf.Rd",
    "chars": 2637,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/aggregate.R\n\\name{aggregate.sf}\n\\alias{agg"
  },
  {
    "path": "man/bind.Rd",
    "chars": 2037,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/bind.R\n\\name{bind}\n\\alias{bind}\n\\alias{rbi"
  },
  {
    "path": "man/coerce-methods.Rd",
    "chars": 2005,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sp.R\n\\name{as}\n\\alias{as}\n\\alias{Spatial}\n"
  },
  {
    "path": "man/dbDataType.Rd",
    "chars": 566,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/db.R\n\\name{dbDataType,PostgreSQLConnection"
  },
  {
    "path": "man/dbWriteTable.Rd",
    "chars": 1537,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/db.R\n\\name{dbWriteTable,PostgreSQLConnecti"
  },
  {
    "path": "man/db_drivers.Rd",
    "chars": 298,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/read.R\n\\docType{data}\n\\name{db_drivers}\n\\a"
  },
  {
    "path": "man/dot-stop_geos.Rd",
    "chars": 282,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-transformers.R\n\\name{.stop_geos}\n\\ali"
  },
  {
    "path": "man/extension_map.Rd",
    "chars": 239,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/read.R\n\\docType{data}\n\\name{extension_map}"
  },
  {
    "path": "man/gdal.Rd",
    "chars": 6031,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/stars.R\n\\name{gdal}\n\\alias{gdal}\n\\alias{gd"
  },
  {
    "path": "man/gdal_addo.Rd",
    "chars": 1254,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/stars.R\n\\name{gdal_addo}\n\\alias{gdal_addo}"
  },
  {
    "path": "man/gdal_compressors.Rd",
    "chars": 358,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/stars.R\n\\name{gdal_compressors}\n\\alias{gda"
  },
  {
    "path": "man/gdal_utils.Rd",
    "chars": 3421,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/gdal_utils.R\n\\name{gdal_utils}\n\\alias{gdal"
  },
  {
    "path": "man/geos_binary_ops.Rd",
    "chars": 5968,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-transformers.R\n\\name{geos_binary_ops}"
  },
  {
    "path": "man/geos_binary_pred.Rd",
    "chars": 8424,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-predicates.R\n\\name{geos_binary_pred}\n"
  },
  {
    "path": "man/geos_combine.Rd",
    "chars": 2941,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-transformers.R\n\\name{geos_combine}\n\\a"
  },
  {
    "path": "man/geos_measures.Rd",
    "chars": 4892,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-measures.R\n\\name{geos_measures}\n\\alia"
  },
  {
    "path": "man/geos_query.Rd",
    "chars": 1422,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-measures.R, R/geom-predicates.R\n\\name"
  },
  {
    "path": "man/geos_unary.Rd",
    "chars": 16414,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-transformers.R\n\\name{geos_unary}\n\\ali"
  },
  {
    "path": "man/interpolate_aw.Rd",
    "chars": 3792,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/aggregate.R\n\\name{interpolate_aw}\n\\alias{i"
  },
  {
    "path": "man/is_driver_available.Rd",
    "chars": 469,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/read.R\n\\name{is_driver_available}\n\\alias{i"
  },
  {
    "path": "man/is_driver_can.Rd",
    "chars": 612,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/read.R\n\\name{is_driver_can}\n\\alias{is_driv"
  },
  {
    "path": "man/is_geometry_column.Rd",
    "chars": 437,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/db.R\n\\name{is_geometry_column}\n\\alias{is_g"
  },
  {
    "path": "man/merge.sf.Rd",
    "chars": 630,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sf.R\n\\name{merge.sf}\n\\alias{merge.sf}\n\\tit"
  },
  {
    "path": "man/nc.Rd",
    "chars": 801,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/datasets.R\n\\docType{data}\n\\name{nc}\n\\alias"
  },
  {
    "path": "man/plot.Rd",
    "chars": 11111,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/plot.R\n\\name{plot}\n\\alias{plot}\n\\alias{plo"
  },
  {
    "path": "man/prefix_map.Rd",
    "chars": 224,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/read.R\n\\docType{data}\n\\name{prefix_map}\n\\a"
  },
  {
    "path": "man/proj_tools.Rd",
    "chars": 3303,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/proj.R\n\\name{proj_tools}\n\\alias{proj_tools"
  },
  {
    "path": "man/rawToHex.Rd",
    "chars": 342,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/wkb.R\n\\name{rawToHex}\n\\alias{rawToHex}\n\\ti"
  },
  {
    "path": "man/s2.Rd",
    "chars": 1706,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/s2.R\n\\name{s2}\n\\alias{s2}\n\\alias{sf_use_s2"
  },
  {
    "path": "man/sf-defunct.Rd",
    "chars": 1338,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/defunct.R\n\\name{sf-defunct}\n\\alias{sf-defu"
  },
  {
    "path": "man/sf-package.Rd",
    "chars": 2308,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sf-package.R\n\\docType{package}\n\\name{sf-pa"
  },
  {
    "path": "man/sf.Rd",
    "chars": 4260,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sf.R\n\\name{sf}\n\\alias{sf}\n\\alias{st_sf}\n\\a"
  },
  {
    "path": "man/sf_extSoftVersion.Rd",
    "chars": 336,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/init.R\n\\name{sf_extSoftVersion}\n\\alias{sf_"
  },
  {
    "path": "man/sf_project.Rd",
    "chars": 1664,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/init.R, R/proj.R\n\\name{sf_project}\n\\alias{"
  },
  {
    "path": "man/sfc.Rd",
    "chars": 2792,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sfc.R\n\\name{sfc}\n\\alias{sfc}\n\\alias{st_sfc"
  },
  {
    "path": "man/sgbp.Rd",
    "chars": 1423,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sgbp.R\n\\name{sgbp}\n\\alias{sgbp}\n\\alias{pri"
  },
  {
    "path": "man/st.Rd",
    "chars": 5663,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sfg.R\n\\name{st}\n\\alias{st}\n\\alias{st_point"
  },
  {
    "path": "man/st_agr.Rd",
    "chars": 687,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/agr.R\n\\name{st_agr}\n\\alias{st_agr}\n\\alias{"
  },
  {
    "path": "man/st_as_binary.Rd",
    "chars": 2318,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/wkb.R\n\\name{st_as_binary}\n\\alias{st_as_bin"
  },
  {
    "path": "man/st_as_grob.Rd",
    "chars": 420,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/grid.R\n\\name{st_as_grob}\n\\alias{st_as_grob"
  },
  {
    "path": "man/st_as_sf.Rd",
    "chars": 4312,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sf.R, R/sp.R, R/maps.R, R/spatstat.R, R/s2"
  },
  {
    "path": "man/st_as_sfc.Rd",
    "chars": 3844,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/db.R, R/sfc.R, R/wkb.R, R/wkt.R, R/sp.R,\n%"
  },
  {
    "path": "man/st_as_text.Rd",
    "chars": 2031,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/crs.R, R/wkt.R\n\\name{st_as_text}\n\\alias{st"
  },
  {
    "path": "man/st_bbox.Rd",
    "chars": 3051,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/bbox.R\n\\name{st_bbox}\n\\alias{st_bbox}\n\\ali"
  },
  {
    "path": "man/st_break_antimeridian.Rd",
    "chars": 1656,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/break_antimeridian.R\n\\name{st_break_antime"
  },
  {
    "path": "man/st_cast.Rd",
    "chars": 5488,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/cast_sfg.R, R/cast_sfc.R\n\\name{st_cast}\n\\a"
  },
  {
    "path": "man/st_cast_sfc_default.Rd",
    "chars": 623,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/cast_sfc.R\n\\name{st_cast_sfc_default}\n\\ali"
  },
  {
    "path": "man/st_collection_extract.Rd",
    "chars": 3048,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/collection_extract.R\n\\name{st_collection_e"
  },
  {
    "path": "man/st_coordinates.Rd",
    "chars": 1398,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sfc.R\n\\name{st_coordinates}\n\\alias{st_coor"
  },
  {
    "path": "man/st_crop.Rd",
    "chars": 1288,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/crop.R\n\\name{st_crop}\n\\alias{st_crop}\n\\ali"
  },
  {
    "path": "man/st_crs.Rd",
    "chars": 5735,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/crs.R\n\\name{st_crs}\n\\alias{st_crs}\n\\alias{"
  },
  {
    "path": "man/st_drivers.Rd",
    "chars": 1058,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/read.R\n\\name{st_drivers}\n\\alias{st_drivers"
  },
  {
    "path": "man/st_geometry.Rd",
    "chars": 2620,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sfc.R, R/sf.R\n\\name{st_geometry}\n\\alias{st"
  },
  {
    "path": "man/st_geometry_type.Rd",
    "chars": 586,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sfc.R\n\\name{st_geometry_type}\n\\alias{st_ge"
  },
  {
    "path": "man/st_graticule.Rd",
    "chars": 3613,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/graticule.R\n\\name{st_graticule}\n\\alias{st_"
  },
  {
    "path": "man/st_is.Rd",
    "chars": 695,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/cast_sfc.R\n\\name{st_is}\n\\alias{st_is}\n\\tit"
  },
  {
    "path": "man/st_is_full.Rd",
    "chars": 924,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sfc.R\n\\name{st_is_full}\n\\alias{st_is_full}"
  },
  {
    "path": "man/st_is_longlat.Rd",
    "chars": 613,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/crs.R\n\\name{st_is_longlat}\n\\alias{st_is_lo"
  },
  {
    "path": "man/st_jitter.Rd",
    "chars": 1233,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/jitter.R\n\\name{st_jitter}\n\\alias{st_jitter"
  },
  {
    "path": "man/st_join.Rd",
    "chars": 3949,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/join.R\n\\name{st_join}\n\\alias{st_join}\n\\ali"
  },
  {
    "path": "man/st_layers.Rd",
    "chars": 1052,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/read.R\n\\name{st_layers}\n\\alias{st_layers}\n"
  },
  {
    "path": "man/st_line_project_point.Rd",
    "chars": 1720,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-measures.R, R/geom-transformers.R\n\\na"
  },
  {
    "path": "man/st_line_sample.Rd",
    "chars": 1766,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-transformers.R\n\\name{st_line_sample}\n"
  },
  {
    "path": "man/st_m_range.Rd",
    "chars": 2434,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/m_range.R\n\\name{st_m_range}\n\\alias{st_m_ra"
  },
  {
    "path": "man/st_make_grid.Rd",
    "chars": 2441,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/make_grid.R\n\\name{st_make_grid}\n\\alias{st_"
  },
  {
    "path": "man/st_nearest_feature.Rd",
    "chars": 2162,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/nearest.R\n\\name{st_nearest_feature}\n\\alias"
  },
  {
    "path": "man/st_nearest_points.Rd",
    "chars": 2474,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/nearest.R\n\\name{st_nearest_points}\n\\alias{"
  },
  {
    "path": "man/st_normalize.Rd",
    "chars": 873,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/normalize.R\n\\name{st_normalize}\n\\alias{st_"
  },
  {
    "path": "man/st_precision.Rd",
    "chars": 2059,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sfc.R\n\\name{st_precision}\n\\alias{st_precis"
  },
  {
    "path": "man/st_read.Rd",
    "chars": 9858,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/read.R, R/db.R\n\\name{st_read}\n\\alias{st_re"
  },
  {
    "path": "man/st_relate.Rd",
    "chars": 2359,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/geom-predicates.R\n\\name{st_relate}\n\\alias{"
  },
  {
    "path": "man/st_sample.Rd",
    "chars": 6930,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sample.R\n\\name{st_sample}\n\\alias{st_sample"
  },
  {
    "path": "man/st_shift_longitude.Rd",
    "chars": 1181,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/shift_longitude.R\n\\name{st_shift_longitude"
  },
  {
    "path": "man/st_transform.Rd",
    "chars": 5900,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/transform.R, R/proj.R\n\\name{st_transform}\n"
  },
  {
    "path": "man/st_viewport.Rd",
    "chars": 1263,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/grid.R\n\\name{st_viewport}\n\\alias{st_viewpo"
  },
  {
    "path": "man/st_write.Rd",
    "chars": 5083,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/read.R\n\\name{st_write}\n\\alias{st_write}\n\\a"
  },
  {
    "path": "man/st_z_range.Rd",
    "chars": 2373,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/z_range.R\n\\name{st_z_range}\n\\alias{st_z_ra"
  },
  {
    "path": "man/st_zm.Rd",
    "chars": 943,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sfc.R\n\\name{st_zm}\n\\alias{st_zm}\n\\title{Dr"
  },
  {
    "path": "man/stars.Rd",
    "chars": 1428,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/plot.R\n\\name{stars}\n\\alias{stars}\n\\alias{."
  },
  {
    "path": "man/summary.sfc.Rd",
    "chars": 519,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sfc.R\n\\name{summary.sfc}\n\\alias{summary.sf"
  },
  {
    "path": "man/tibble.Rd",
    "chars": 483,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/tidyverse.R\n\\name{tibble}\n\\alias{tibble}\n\\"
  },
  {
    "path": "man/tidyverse.Rd",
    "chars": 12289,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/tidyverse.R, R/join.R\n\\name{tidyverse}\n\\al"
  },
  {
    "path": "man/transform.sf.Rd",
    "chars": 694,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/sf.R\n\\name{transform.sf}\n\\alias{transform."
  },
  {
    "path": "man/valid.Rd",
    "chars": 3601,
    "preview": "% Generated by roxygen2: do not edit by hand\n% Please edit documentation in R/valid.R\n\\name{valid}\n\\alias{valid}\n\\alias{"
  },
  {
    "path": "sf.Rproj",
    "chars": 381,
    "preview": "Version: 1.0\n\nRestoreWorkspace: No\nSaveWorkspace: No\nAlwaysSaveHistory: Default\n\nEnableCodeIndexing: Yes\nUseSpacesForTab"
  },
  {
    "path": "src/Makevars.in",
    "chars": 48,
    "preview": "PKG_CPPFLAGS=@PKG_CPPFLAGS@\nPKG_LIBS=@PKG_LIBS@\n"
  },
  {
    "path": "src/Makevars.ucrt",
    "chars": 1180,
    "preview": "PKG_CPPFLAGS = \\\n\t-DHAVE_PROJ_H\n\nifeq (,$(shell pkg-config --version 2>/dev/null))\n  LIBSHARPYUV = $(or $(and $(wildcard"
  },
  {
    "path": "src/Makevars.win",
    "chars": 938,
    "preview": "VERSION = 3.4.1\nRWINLIB = ../windows/gdal3-$(VERSION)\nTARGET = lib$(subst gcc,,$(COMPILED_BY))$(R_ARCH)\n\nPKG_CPPFLAGS =\\"
  },
  {
    "path": "src/RcppExports.cpp",
    "chars": 81843,
    "preview": "// Generated by using Rcpp::compileAttributes() -> do not edit by hand\n// Generator token: 10BE3573-1514-4C36-9D1C-5A225"
  },
  {
    "path": "src/bbox.cpp",
    "chars": 1640,
    "preview": "#include <Rcpp.h>\n\n#include \"bbox.h\"\n\n// [[Rcpp::export(rng=false)]]\nRcpp::NumericVector CPL_get_bbox(Rcpp::List sf, int"
  },
  {
    "path": "src/bbox.h",
    "chars": 119,
    "preview": "#ifndef SF_BBOX_H_\n#define SF_BBOX_H_\nRcpp::NumericVector CPL_get_bbox(Rcpp::List sf, int depth);\n#endif // SF_BBOX_H_\n"
  }
]

// ... and 140 more files (download for full content)

About this extraction

This page contains the full source code of the edzer/sfr GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 340 files (2.2 MB), approximately 592.9k tokens, and a symbol index with 383 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!