Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable database connection for st_read and st_write #558

Merged
merged 119 commits into from
Apr 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
6a1c03f
add db support for `st_read()` and `st_write()` closes #551
etiennebr Nov 17, 2017
e9dd701
update documentation
etiennebr Nov 17, 2017
caff1a2
`st_write()` uses generic `dbWriteTable()`
etiennebr Nov 21, 2017
32fcb0c
add tests for capital names support
etiennebr Nov 27, 2017
6b08f6a
fix crs support
etiennebr Dec 2, 2017
a22c446
remove `st_write_db`
etiennebr Dec 3, 2017
b794077
allow creation of crs absent from local proj4 database
etiennebr Dec 9, 2017
b3a12bf
add database crs manipulator
etiennebr Dec 9, 2017
4be6feb
remove maptools duplicate
etiennebr Dec 9, 2017
cde0730
document parameters
etiennebr Dec 9, 2017
5150c6f
make DBIObject default class for database connection
etiennebr Dec 10, 2017
2bda039
add RPostgres tests
etiennebr Jan 24, 2018
84a7aa7
allow travis to change table `spatial_ref_sys`
etiennebr Feb 1, 2018
1f6f904
remove ambiguous tests
etiennebr Feb 2, 2018
62ef5a7
improve database error message
etiennebr Mar 22, 2018
e9af8d4
resolve crs insertion
etiennebr Mar 22, 2018
a17efc2
delete create crs from database during tests
etiennebr Mar 22, 2018
41ab318
adapt RPostgreSQL tests
etiennebr Mar 22, 2018
2c66980
fix memory leak; tidy
edzer Feb 2, 2018
1504b92
add rstudio::conf present; pointer to migration wiki
edzer Feb 2, 2018
6f5dcff
tidy
edzer Feb 4, 2018
815b347
mv warning to right spot
edzer Feb 6, 2018
e297d98
Update rwinlib gdal2 stack
jeroen Feb 8, 2018
a607aa9
extend test on constant
edzer Feb 9, 2018
4baa096
addresses https://stat.ethz.ch/pipermail/r-sig-geo/2018-February/0263…
edzer Feb 11, 2018
22eb977
add to NEWS
edzer Feb 11, 2018
54ff183
stringsAsFactors
edzer Feb 11, 2018
d57e0ea
add the stars functions that need GDAL bindings or Rcpp
edzer Feb 11, 2018
de14e8a
add parameter read_data.
edzer Feb 12, 2018
d44687c
warnings; better default geometry column name
edzer Feb 13, 2018
d25857a
docs
edzer Feb 14, 2018
2d56f2c
stars updates
edzer Feb 15, 2018
d75d916
encoding of layer(s):
edzer Feb 15, 2018
543932c
update to proj.4 5.0.0RC3
edzer Feb 16, 2018
707f3b1
fix bug
edzer Feb 16, 2018
b3270a5
check win-builder issues
edzer Feb 16, 2018
95e7bef
add coverage tests
edzer Feb 17, 2018
9f65123
coverage
edzer Feb 17, 2018
6c33d09
coverage
edzer Feb 17, 2018
715b0e2
add gdal_write, to be used by stars
edzer Feb 18, 2018
e458f49
docs, test
edzer Feb 18, 2018
c2f55f0
coverage
edzer Feb 18, 2018
c49ccf4
rename some parameters
edzer Feb 18, 2018
043dd11
fix #641
edzer Feb 19, 2018
bb2f4da
tidy
edzer Feb 19, 2018
bd2c8a4
restore plotting device state after plotting map with legend
edzer Feb 21, 2018
2ae5a63
stars fixes
edzer Feb 21, 2018
27f7281
improve reset of plot + docs
edzer Feb 21, 2018
7d35e24
Add failing test for #644 (binary ops on tibbles with common column n…
ateucher Feb 21, 2018
579a36c
Use data.frame instead of cbind so duplicated column names are fixed.…
ateucher Feb 21, 2018
f1a05c0
Formatting and comments, use tbl_df class in test
ateucher Feb 21, 2018
d2cac62
Use tibble::as_tibble instead of depracated dplyr::tbl_df. #644
ateucher Feb 21, 2018
548e5ca
Add NEWS item for #644
ateucher Feb 21, 2018
e9a1ae8
fixes crash on plotting a single sfc point
lbusett Feb 22, 2018
c9f00ca
tidy
edzer Feb 22, 2018
8b291fc
address #647
edzer Feb 22, 2018
b6f1756
update
edzer Feb 23, 2018
7792257
coverage
edzer Feb 23, 2018
7285f74
Add Arch Linux install instructions
cmcaine Feb 23, 2018
21aa76e
docs
edzer Feb 24, 2018
09b00fd
clarify https://github.com/r-spatial/sf/issues/651
edzer Feb 25, 2018
286522f
update news
edzer Feb 26, 2018
9b857e1
fix st_proj_info("units") for 5.0.0
Feb 26, 2018
e088fc8
simplify #575
edzer Feb 28, 2018
64a3004
docs
edzer Feb 28, 2018
b762a41
Add documentation of WKT and EWKT conventions used in st_as_text. Als…
dblodgett-usgs Feb 28, 2018
5d67ab4
fixes #656
edzer Mar 1, 2018
6675c91
tidy, NEWS, stars api
edzer Mar 2, 2018
0f25eb4
travis
edzer Mar 3, 2018
0f68bf5
deprecate sf_transform
edzer Mar 3, 2018
0513546
exporting functions needed for stars
edzer Mar 3, 2018
8375dbd
fix longlat asp
edzer Mar 3, 2018
ae4f23f
restore sf_project; clean up star exports
edzer Mar 4, 2018
9f10b08
add vsi flag to st_drivers' output
edzer Mar 4, 2018
36e978c
key.pos stuff
edzer Mar 4, 2018
4b1e5e9
typo
edzer Mar 4, 2018
3431bc5
tidy, coverage
edzer Mar 5, 2018
2300de4
addresses #660
edzer Mar 7, 2018
20828ad
update
edzer Mar 7, 2018
f73d3a0
Add ORCID for Jeroen
jeroen Mar 8, 2018
0a20fb9
typo
edzer Mar 10, 2018
fab4ebb
update
edzer Mar 12, 2018
318105f
remove unused variable
edzer Mar 12, 2018
12c66b2
addressing #545 but needs further sorting out!
edzer Mar 12, 2018
5adc07f
update to proj 5
edzer Mar 12, 2018
47f383c
update
edzer Mar 12, 2018
6e5588a
Et for B
Valexandre Mar 12, 2018
83788a8
fix typo in README
christophertull Mar 12, 2018
7555208
have --with-proj-lib actually work
edzer Mar 13, 2018
57b20fa
add proper distinct.sf method; #669
edzer Mar 14, 2018
1c6047a
Update description of by
Robinlovelace Mar 14, 2018
cb40187
Add note saying formula notation does not work
Robinlovelace Mar 14, 2018
aa84592
update docs
edzer Mar 15, 2018
4c7ef4c
update docs
edzer Mar 15, 2018
1e4d77f
improve docs; tidy distinct; #672
edzer Mar 16, 2018
fe38be9
coverage
edzer Mar 16, 2018
82a957c
read band metadata for GRIB
edzer Mar 16, 2018
df7f606
address #676
edzer Mar 16, 2018
a74593c
coverage
edzer Mar 16, 2018
2f80383
tidy
edzer Mar 16, 2018
1ca78f0
addresses Fedora 26 issue
edzer Mar 17, 2018
2500ed8
add ordered to docs; #672
edzer Mar 19, 2018
94a5d7e
fix distinct.sf; #672, #669
edzer Mar 19, 2018
9a22caa
update docs
edzer Mar 19, 2018
44f0508
update
edzer Mar 19, 2018
6de78ed
help file geos_binary_pred: link to sgbp
MatthieuStigler Mar 19, 2018
2a06793
docs
edzer Mar 19, 2018
9bdcdd0
have / and * also keep crs; #675
edzer Mar 21, 2018
a6ec56f
add db support for `st_read()` and `st_write()` closes #551
etiennebr Nov 17, 2017
c1ce6f8
make DBIObject default class for database connection
etiennebr Dec 10, 2017
c5d0438
mute odbc
etiennebr Mar 22, 2018
6953207
Merge branch 'master' into generic-st_read
etiennebr Mar 22, 2018
f8e85e0
export DBI methods
etiennebr Apr 5, 2018
c781e30
make tests handle localhost connection
etiennebr Apr 5, 2018
e622932
add deprecated
etiennebr Apr 5, 2018
92f2452
update odbc tests
etiennebr Apr 5, 2018
021d36a
fix documentation
etiennebr Apr 5, 2018
17b1cb4
fix schema naming for RPostgreSQL
etiennebr Apr 5, 2018
e6e9615
skip multi geoms tests on travis
etiennebr Apr 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ before_install:
- wget http://download.osgeo.org/postgis/source/postgis-2.3.2.tar.gz
- (mv postgis* /tmp; cd /tmp; tar xzf postgis-2.3.2.tar.gz)
- (cd /tmp/postgis-2.3.2 ; ./configure; make; sudo make install)

# activate liblwgeom by:
- sudo ldconfig
# create postgis databases:
- sudo service postgresql restart
- createdb postgis
- psql -d postgis -c "CREATE EXTENSION postgis;"
- psql -d postgis -c "GRANT CREATE ON DATABASE postgis TO travis"
- psql -d postgis -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO travis"
- createdb empty
- psql -d empty -c "CREATE EXTENSION postgis;"

Expand Down
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Imports:
grDevices,
grid,
Rcpp,
RPostgreSQL,
DBI (>= 0.5),
units (>= 0.4-6),
classInt,
Expand All @@ -38,7 +39,6 @@ Suggests:
tmap,
maptools,
RSQLite,
RPostgreSQL,
tibble (>= 1.4.1),
pillar,
rlang,
Expand Down Expand Up @@ -94,4 +94,5 @@ Collate:
spatstat.R
stars.R
gdal_utils.R
deprecated.R
RoxygenNote: 6.0.1
8 changes: 8 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ S3method(st_polygonize,sfc)
S3method(st_polygonize,sfg)
S3method(st_precision,sf)
S3method(st_precision,sfc)
S3method(st_read,DBIObject)
S3method(st_read,PostgreSQLConnection)
S3method(st_read,default)
S3method(st_segmentize,sf)
S3method(st_segmentize,sfc)
Expand Down Expand Up @@ -362,7 +364,11 @@ export(ungroup.sf)
export(unite.sf)
export(unnest.sf)
export(write_sf)
exportMethods(dbDataType)
exportMethods(dbWriteTable)
import(graphics)
importClassesFrom(DBI,DBIObject)
importClassesFrom(RPostgreSQL,PostgreSQLConnection)
importFrom(DBI,dbConnect)
importFrom(DBI,dbDisconnect)
importFrom(DBI,dbExecute)
Expand Down Expand Up @@ -399,4 +405,6 @@ importFrom(utils,head)
importFrom(utils,object.size)
importFrom(utils,str)
importFrom(utils,tail)
importMethodsFrom(DBI,dbDataType)
importMethodsFrom(DBI,dbWriteTable)
useDynLib(sf)
17 changes: 14 additions & 3 deletions R/crs.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Ops.crs <- function(e1, e2) {
#' @name st_crs
#' @param x numeric, character, or object of class \link{sf} or \link{sfc}
#' @param ... ignored
#' @param valid default TRUE. This allows to create crs without checking against
#' the local proj4 database. It can be used to synchronize crs with a remote
#' database, but avoid it as much as possible.
#' @param proj4text character. Must be used in conjunction with \code{valid = FALSE}.
#' @export
#' @return If \code{x} is numeric, return \code{crs} object for SRID \code{x}; if \code{x} is character, return \code{crs} object for proj4string \code{x}; if \code{wkt} is given, return \code{crs} object for well-known-text representation \code{wkt}; 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
Expand All @@ -54,7 +58,14 @@ st_crs.sf = function(x, ...) st_crs(st_geometry(x), ...)

#' @name st_crs
#' @export
st_crs.numeric = function(x, ...) make_crs(x)
st_crs.numeric = function(x, proj4text = "", valid = TRUE, ...) {
if (!valid)
return(structure(list(epsg = x, proj4string = proj4text), class = "crs"))
if (proj4text != "")
warning("`proj4text` is not used to validate crs. Remove `proj4text` ",
"argument or set `valid = FALSE` to stop warning.")
make_crs(x)
}

#' @name st_crs
#' @export
Expand All @@ -69,7 +80,7 @@ st_crs.character = function(x, ..., wkt) {
#' @name st_crs
#' @param parameters logical; \code{FALSE} by default; if \code{TRUE} return a list of coordinate reference system parameters, with named elements \code{SemiMajor}, \code{InvFlattening}, \code{units_gdal}, \code{IsVertical}, \code{WktPretty}, and \code{Wkt}
#' @export
st_crs.sfc = function(x, ..., parameters = FALSE) {
st_crs.sfc = function(x, ..., parameters = FALSE) {
crs = attr(x, "crs")
if (parameters) {
if (is.na(crs))
Expand Down Expand Up @@ -332,7 +343,7 @@ print.crs = function(x, ...) {
cat(" EPSG:", x$epsg, "\n")
if (is.na(x$proj4string))
stop(" invalid crs: please report an issue") # nocov
else
else
cat(" proj4string: \"", x$proj4string, "\"\n", sep = "")
}
}
Loading