Skip to content

Commit 6560a69

Browse files
committed
bugfix PointDB R-package connection write scanAngleRank as signed integer; R-package as.LAS change parameter proj4string to crs for lidR compatiblity
1 parent 0227165 commit 6560a69

File tree

6 files changed

+63
-35
lines changed

6 files changed

+63
-35
lines changed

r-package/DESCRIPTION

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
Package: RSDB
2-
Type: Package
3-
Title: R to RSDB Server Connection Package
4-
Version: 1.3.9
5-
Author: woellauer
6-
Maintainer: woellauer <email@email>
7-
Description: RSDB (Remote Sensing Database) manages (hyperspectral) rasters and (LiDAR) point-clouds as well as vector data and auxiliary ROIs (regions of interest as named polygons) and POIs (points of interest as named points). Contained data can be queried, processed and analysed.
8-
This R package connects to an RSDB server running at local or remote computer.
9-
License: GPL-3
10-
Encoding: UTF-8
11-
LazyData: true
12-
RoxygenNote: 7.2.3
13-
Imports:
14-
R6,
15-
httr,
16-
jsonlite,
17-
openssl,
18-
raster,
19-
sf,
20-
stars
21-
Suggests:
22-
rgl,
23-
lidR,
24-
rlas,
25-
data.table,
26-
hsdar,
27-
mapview
1+
Package: RSDB
2+
Type: Package
3+
Title: R to RSDB Server Connection Package
4+
Version: 1.3.10
5+
Author: woellauer
6+
Maintainer: woellauer <email@email>
7+
Description: RSDB (Remote Sensing Database) manages (hyperspectral) rasters and (LiDAR) point-clouds as well as vector data and auxiliary ROIs (regions of interest as named polygons) and POIs (points of interest as named points). Contained data can be queried, processed and analysed.
8+
This R package connects to an RSDB server running at local or remote computer.
9+
License: GPL-3
10+
Encoding: UTF-8
11+
LazyData: true
12+
RoxygenNote: 7.3.2
13+
Imports:
14+
R6,
15+
httr,
16+
jsonlite,
17+
openssl,
18+
raster,
19+
sf,
20+
stars
21+
Suggests:
22+
rgl,
23+
lidR,
24+
rlas,
25+
data.table,
26+
hsdar,
27+
mapview

r-package/R/util.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#'
33
#' Creates an \link{extent} that covers the square over the circle at point x,y with radius r.
44
#'
5-
#' Extents are used to query data from \link{RasterDB} , from \link{PointCloud} and from \link{PointDB}.
5+
#' Extents are used to query data from \link{RasterDB} , from \link{PointCloud} and from \link{PointDB}.
66
#'
77
#' @param x first coordinate
88
#' @param y second coordinate
@@ -19,7 +19,7 @@ extent_radius <- function(x, y, r) {
1919
#'
2020
#' Creates an \link{extent} that covers the square with center point x,y and with diameter (edge length) d.
2121
#'
22-
#' Extents are used to query data from \link{RasterDB} , from \link{PointCloud} and from \link{PointDB}.
22+
#' Extents are used to query data from \link{RasterDB} , from \link{PointCloud} and from \link{PointDB}.
2323
#'
2424
#' @param x first coordinate
2525
#' @param y second coordinate
@@ -215,12 +215,12 @@ as.speclib <- function(rasterStack, na=NULL) {
215215
#'
216216
#' Convert data.frame of points (received from PointDB or PointCloud) to \link[lidR]{LAS} in lidR package.
217217
#'
218-
#' optional parameter proj4string: crs of points. e.g. proj4string <- CRS(pointdb$info$proj4)
218+
#' Optional parameter crs: crs of points. e.g. crs <- sf::st_crs(paste0('EPSG:', pointdb$info$epsg))
219219
#'
220220
#' @seealso \link[lidR]{LAS}
221221
#' @author woellauer
222222
#' @export
223-
as.LAS <- function(df, proj4string = sp::CRS()) {
223+
as.LAS <- function(df, crs = sf::NA_crs_) {
224224
stopifnot(is.data.frame(df))
225225
cn <- colnames(df)
226226
stopifnot("x" %in% cn && "y" %in% cn)
@@ -234,7 +234,7 @@ as.LAS <- function(df, proj4string = sp::CRS()) {
234234

235235
header <- rlas::header_create(dt)
236236

237-
result <- lidR::LAS(data=dt, header=header, proj4string=proj4string, check=TRUE)
237+
result <- lidR::LAS(data=dt, header=header, crs=crs, check=TRUE)
238238
return(result)
239239
}
240240

r-package/man/RSDB-package.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r-package/man/as.LAS.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/util/rdat/RdatDataFrame.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,32 @@ public void write(DataOutput out, Iterable<T> coll) throws IOException {
103103
}
104104

105105
}
106+
107+
public static class Int8Column<T> extends Column<T> {
108+
@FunctionalInterface
109+
public static interface ToByteFunction<T> {
110+
byte applyAsByte(T value);
111+
}
112+
113+
private final ToByteFunction<T> mapper;
114+
115+
public Int8Column(String name, ToByteFunction<T> mapper) {
116+
super(name);
117+
this.mapper = mapper;
118+
}
119+
120+
@Override
121+
public void write(DataOutput out, Iterable<T> coll) throws IOException {
122+
Rdat.writeSizedString(out, name);
123+
out.writeByte(Rdat.TYPE_INT8);
124+
out.writeByte(Rdat.TYPE_INT8_SIZE);
125+
for (T e:coll) {
126+
byte v = mapper.applyAsByte(e);
127+
out.writeByte(v);
128+
}
129+
}
130+
131+
}
106132

107133
public static class DoubleColumn<T> extends Column<T> {
108134

src/util/rdat/RdatDataFrame_points.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import util.rdat.RdatDataFrame.DoubleColumn;
1717
import util.rdat.RdatDataFrame.UInt16Column;
1818
import util.rdat.RdatDataFrame.UInt8Column;
19+
import util.rdat.RdatDataFrame.Int8Column;
1920

2021
public class RdatDataFrame_points {
2122

@@ -27,7 +28,7 @@ public class RdatDataFrame_points {
2728
add(new UInt16Column<GeoPoint>("intensity", GeoPoint::getIntensity));
2829
add(new UInt8Column<GeoPoint>("returnNumber", GeoPoint::getReturnNumber));
2930
add(new UInt8Column<GeoPoint>("returns", GeoPoint::getReturns));
30-
add(new UInt8Column<GeoPoint>("scanAngleRank", GeoPoint::getScanAngleRank));
31+
add(new Int8Column<GeoPoint>("scanAngleRank", GeoPoint::getScanAngleRank));
3132
add(new UInt8Column<GeoPoint>("classification", GeoPoint::getClassification));
3233
add(new UInt8Column<GeoPoint>("classificationFlags", GeoPoint::getClassificationFlags));
3334
}};

0 commit comments

Comments
 (0)