Skip to content

Commit

Permalink
version 0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
David Cooley authored and cran-robot committed Nov 7, 2019
1 parent 0ecc542 commit dbd1299
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 16 deletions.
7 changes: 4 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Package: sfheaders
Type: Package
Title: Constructs Simple Feature Objects
Version: 0.0.1
Date: 2019-11-07
Version: 0.0.2
Authors@R: c(
person("David", "Cooley", ,"[email protected]", role = c("aut", "cre"))
)
Expand All @@ -19,8 +20,8 @@ LinkingTo: Rcpp
Imports: Rcpp
Suggests: testthat, covr
NeedsCompilation: yes
Packaged: 2019-09-27 11:11:43 UTC; dave
Packaged: 2019-11-07 00:02:39 UTC; david
Author: David Cooley [aut, cre]
Maintainer: David Cooley <[email protected]>
Repository: CRAN
Date/Publication: 2019-10-03 06:50:02 UTC
Date/Publication: 2019-11-07 06:10:09 UTC
11 changes: 6 additions & 5 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
b65f055ca7887c3cdd32fb13e9231714 *DESCRIPTION
bc2138b0178c51f7368485026109bdc6 *DESCRIPTION
9fb3d67d2b9310baae21cdb283f6016e *NAMESPACE
cd0ba9aeb016660938bba9ed230be943 *NEWS.md
b37911e700f3dada468682ee2644f691 *R/RcppExports.R
925df1a7f90725359a72ee0ee10e88d6 *R/scratch.R
65f9c8198a5a2afa0479f9a8e0053806 *R/sf.R
02cb4e91e6a6bb1603864fc8994d47c8 *R/sf.R
008826d077ee7b870035fc96fc757f0d *R/sfc.R
7ae3943129deff39aef402b64a2f3d8c *R/sfg.R
9ad42c0340be8d31030dd1af1e0996ae *R/sfheaders-package.R
2a2829e460c9ad28b0082a12e0e56ad0 *R/utils.R
4fafe674945773188a8dbc9ebe03348d *README.md
aa4542ca289a6e9151b2e9a08605bf5d *README.md
d23d2f2ee96429551517826dc4884e54 *inst/include/sfheaders/sf/linestring/sf_linestring.hpp
4765a7a33ff99dd863da4868d3df37dc *inst/include/sfheaders/sf/multilinestring/sf_multilinestring.hpp
b17073341300cc0714efb94c6f59ee07 *inst/include/sfheaders/sf/multipoint/sf_multipoint.hpp
Expand All @@ -31,8 +32,8 @@ a3893a7f98255dd13ed5da587405d2b1 *inst/include/sfheaders/sfc/point/sfc_points.hp
938d5c4483bcf68e5d08a34384b781d0 *inst/include/sfheaders/sfc/polygon/sfc_polygon.hpp
4581e3fe8f27cafc8a1ff057610e9383 *inst/include/sfheaders/sfc/polygon/sfc_polygons.hpp
3e80cabfba5f6828f7fef2b0b7c8e605 *inst/include/sfheaders/sfc/sfc.hpp
40fc98021c67232789f33519ec263599 *inst/include/sfheaders/sfc/sfc_attributes.hpp
be4472f414d6d143dbe462d8fc6a7115 *inst/include/sfheaders/sfc/sfc_types.hpp
15801f8868b42a5123a2bc9076343853 *inst/include/sfheaders/sfc/sfc_attributes.hpp
c08ca6b078228ff7f88de29985c7ca9e *inst/include/sfheaders/sfc/sfc_types.hpp
8fb25bed0d863142176a330af12f66b6 *inst/include/sfheaders/sfc/z_range.hpp
debc9d0f80d110b47041172e6a279cac *inst/include/sfheaders/sfc/zm_range.hpp
d0f52883ebe4eb6859f60169c7c52ff4 *inst/include/sfheaders/sfg/linestring/sfg_linestring.hpp
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# sfheaders 0.0.2

* id column keeps user-supplied name (if character)
* patch for `crs` attributes
22 changes: 17 additions & 5 deletions R/sf.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ sf_point <- function( obj, x = NULL, y = NULL, z = NULL, m = NULL ) {
#' @export
sf_multipoint <- function( obj, x = NULL, y = NULL, z = NULL, m = NULL, multipoint_id = NULL ) {
geometry_columns <- c(x,y,z,m)
rcpp_sf_multipoint( obj, index_correct( geometry_columns ), index_correct( multipoint_id ) )
res <- rcpp_sf_multipoint( obj, index_correct( geometry_columns ), index_correct( multipoint_id ) )
return( replace_id( res, multipoint_id ) )
}


Expand Down Expand Up @@ -82,7 +83,8 @@ sf_multipoint <- function( obj, x = NULL, y = NULL, z = NULL, m = NULL, multipoi
#' @export
sf_linestring <- function( obj = NULL, x = NULL, y = NULL, z = NULL, m = NULL, linestring_id = NULL ) {
geometry_columns <- c(x,y,z,m)
rcpp_sf_linestring( obj, index_correct( geometry_columns ), index_correct( linestring_id ) )
res <- rcpp_sf_linestring( obj, index_correct( geometry_columns ), index_correct( linestring_id ) )
return( replace_id( res, linestring_id ) )
}


Expand Down Expand Up @@ -139,7 +141,8 @@ sf_linestring <- function( obj = NULL, x = NULL, y = NULL, z = NULL, m = NULL, l
#' @export
sf_multilinestring <- function( obj = NULL, x = NULL, y = NULL, z = NULL, m = NULL, multilinestring_id = NULL, linestring_id = NULL ) {
geometry_columns <- c(x,y,z,m)
rcpp_sf_multilinestring( obj, index_correct( geometry_columns ), index_correct( multilinestring_id ), index_correct( linestring_id ) )
res <- rcpp_sf_multilinestring( obj, index_correct( geometry_columns ), index_correct( multilinestring_id ), index_correct( linestring_id ) )
return( replace_id( res, multilinestring_id ) )
}


Expand Down Expand Up @@ -198,7 +201,8 @@ sf_multilinestring <- function( obj = NULL, x = NULL, y = NULL, z = NULL, m = NU
#' @export
sf_polygon <- function( obj = NULL, x = NULL, y = NULL, z = NULL, m = NULL, polygon_id = NULL, linestring_id = NULL, close = TRUE ) {
geometry_columns <- c(x,y,z,m)
rcpp_sf_polygon( obj, index_correct( geometry_columns ), index_correct( polygon_id ), index_correct( linestring_id ), close )
res <- rcpp_sf_polygon( obj, index_correct( geometry_columns ), index_correct( polygon_id ), index_correct( linestring_id ), close )
return( replace_id( res, polygon_id ) )
}


Expand Down Expand Up @@ -278,5 +282,13 @@ sf_polygon <- function( obj = NULL, x = NULL, y = NULL, z = NULL, m = NULL, poly
#' @export
sf_multipolygon <- function( obj = NULL, x = NULL, y = NULL, z = NULL, m = NULL, multipolygon_id = NULL, polygon_id = NULL, linestring_id = NULL, close = TRUE ) {
geometry_columns <- c(x,y,z,m)
rcpp_sf_multipolygon( obj, index_correct( geometry_columns ), index_correct( multipolygon_id ), index_correct( polygon_id ), index_correct( linestring_id ), close )
res <- rcpp_sf_multipolygon( obj, index_correct( geometry_columns ), index_correct( multipolygon_id ), index_correct( polygon_id ), index_correct( linestring_id ), close )
return( replace_id( res, multipolygon_id ) )
}

replace_id <- function( x, id ) {
if( is.character( id ) ) {
names( x )[ names( x ) == "id" ] <- id
}
return( x )
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
status](https://travis-ci.com/dcooley/sfheaders.svg?branch=master)](https://travis-ci.com/dcooley/sfheaders)
[![Coverage
status](https://codecov.io/gh/dcooley/sfheaders/branch/master/graph/badge.svg)](https://codecov.io/github/dcooley/sfheaders?branch=master)
![downloads](http://cranlogs.r-pkg.org/badges/grand-total/sfheaders)
[![CRAN RStudio mirror
downloads](http://cranlogs.r-pkg.org/badges/sfheaders)](https://CRAN.R-project.org/package=sfheaders)

## Another spatial library?

Expand Down
4 changes: 2 additions & 2 deletions inst/include/sfheaders/sfc/sfc_attributes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace sfc {
Rcpp::NumericVector& z_range,
Rcpp::NumericVector& m_range,
int& epsg,
std::string& proj4string,
Rcpp::String& proj4string,
int n_empty = 0,
double precision = 0.0
) {
Expand Down Expand Up @@ -163,7 +163,7 @@ namespace sfc {
Rcpp::NumericVector& z_range,
Rcpp::NumericVector& m_range,
int& epsg,
std::string& proj4string,
Rcpp::String& proj4string,
int n_empty = 0,
double precision = 0.0
) {
Expand Down
2 changes: 1 addition & 1 deletion inst/include/sfheaders/sfc/sfc_types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace sfc {
std::unordered_set< std::string > geometry_types{ geom };

int epsg = NA_INTEGER;
std::string proj4string;
Rcpp::String proj4string = NA_STRING;
//int n_empty = 0;
double precision = 0.0;

Expand Down

0 comments on commit dbd1299

Please sign in to comment.