Skip to content

Commit

Permalink
Add R bindings (#55)
Browse files Browse the repository at this point in the history
* sketch + document

* some funcs

* with src

* sketch handler

* test scaffold

* add vendoring logic

* make sure bootstrap is called on R CMD INSTALL

* maybe working utility

* more fixes

* notes

* possibly working visitor

* progress

* sketch type math

* more type logic

* theoretical array creation from buffers

* fix interleaved

* some testing

* tested array from buffers

* basic wkt support

* test wk

* test metadata handling

* stream method

* add xy method

* rename

* test point

* use array reader

* writer support

* with check passing

* get type inspection up and running

* add wkb method

* theoretical support for converting anything to geoarrow

* sf support

* get sf compat tested for all types

* more robust geometry type checking

* move back to default inference

* note about future

* more testing inference

* respect COORD_TYPE

* document + export

* namespace r-specific sources

* wire up kernel

* wiring up kernel

* kernel callers

* maybe fix

* maybe fix check

* try devel pak

* sketch array methods with kernel

* maybe better

* maybe passing CI

* maybe fix test

* just to pass check for a moment

* maybe fix install

* working on inference

* infer stuff

* maybe fix version

* other way around

* infer for arrays

* infer working

* passing cmd check

* with matrix
  • Loading branch information
paleolimbot authored Sep 25, 2023
1 parent 68d67e5 commit d16a904
Show file tree
Hide file tree
Showing 43 changed files with 3,189 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/r-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

name: test-r

on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- '.github/workflows/r-check.yaml'
- 'src/geoarrow/**'
- 'r/**'

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: '3.6'}
- {os: windows-latest, r: '4.0'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}

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

steps:
- uses: actions/checkout@v2

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

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, arrow=?ignore-before-r=4.0.0
needs: check
working-directory: r/geoarrow

- uses: r-lib/actions/check-r-package@v2
env:
ARROW_R_VERBOSE_TEST: "true"
_R_CHECK_FORCE_SUGGESTS_: false
with:
upload-snapshots: true
working-directory: r/geoarrow
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ out/
.DS_Store
CMakeUserPresets.json
.vscode
.Rproj.user
5 changes: 5 additions & 0 deletions r/geoarrow/.Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
^geoarrow\.Rproj$
^\.Rproj\.user$
^\.vscode$
^bootstrap\.R$
^LICENSE\.md$
2 changes: 2 additions & 0 deletions r/geoarrow/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.Rproj.user
.Rhistory
31 changes: 31 additions & 0 deletions r/geoarrow/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Package: geoarrow
Title: Extension types for geospatial data for use with 'Arrow'
Version: 0.0.0.9000
Authors@R:
person(given = "Dewey",
family = "Dunnington",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0002-9415-4582"))
Description: Provides extension types and conversions to between R-native
object types and 'Arrow' columnar types.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Imports:
nanoarrow,
wk (>= 0.6.0)
LinkingTo:
wk
Config/testthat/edition: 3
Config/build/bootstrap: TRUE
URL: https://github.com/geoarrow/geoarrow-c
Depends:
R (>= 2.10)
Suggests:
arrow,
sf,
testthat (>= 3.0.0)
Remotes:
nanoarrow=apache/arrow-nanoarrow/r
2 changes: 2 additions & 0 deletions r/geoarrow/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2023
COPYRIGHT HOLDER: geoarrow authors
21 changes: 21 additions & 0 deletions r/geoarrow/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2023 geoarrow authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions r/geoarrow/NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by roxygen2: do not edit by hand

S3method(as_geoarrow_array,character)
S3method(as_geoarrow_array,default)
S3method(as_geoarrow_array,nanoarrow_array)
S3method(as_geoarrow_array,wk_wkb)
S3method(as_geoarrow_array,wk_wkt)
S3method(as_geoarrow_array,wk_xy)
S3method(as_geoarrow_array_stream,default)
S3method(as_geoarrow_array_stream,nanoarrow_array_stream)
S3method(infer_geoarrow_schema,default)
S3method(infer_geoarrow_schema,nanoarrow_array)
S3method(infer_geoarrow_schema,nanoarrow_array_stream)
S3method(infer_nanoarrow_schema,sfc)
S3method(infer_nanoarrow_schema,wk_wkb)
S3method(infer_nanoarrow_schema,wk_wkt)
S3method(infer_nanoarrow_schema,wk_xy)
export(as_geoarrow_array)
export(as_geoarrow_array_stream)
export(geoarrow_handle)
export(geoarrow_schema_parse)
export(geoarrow_writer)
export(infer_geoarrow_schema)
export(na_extension_geoarrow)
export(na_extension_large_wkb)
export(na_extension_large_wkt)
export(na_extension_wkb)
export(na_extension_wkt)
importFrom(nanoarrow,infer_nanoarrow_schema)
useDynLib(geoarrow, .registration = TRUE)
Loading

0 comments on commit d16a904

Please sign in to comment.