Skip to content

Commit 28502b3

Browse files
authored
Merge pull request #19 from JosiahParry/geom
Geom
2 parents b424445 + 769bbf3 commit 28502b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3978
-1278
lines changed

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ reqwest = { version = "0.12.3", optional = true }
1919
serde = { version = "1.0.192", features = ["derive"] }
2020
serde_json = "1.0.108"
2121
serde_with = "3.4.0"
22-
derive_builder = { version = "0.20.0", optional = true }
22+
derive_builder = { version = "0.20.0" }
2323

2424
[lib]
2525
crate-type = ["staticlib", "lib"]
2626

2727
[features]
2828
default = []
29-
places-client = ["reqwest/blocking", "reqwest/json", "derive_builder"]
29+
places-client = ["reqwest/blocking", "reqwest/json"]
3030
geo = ["dep:geo-types"]
3131
geoarrow = ["dep:geo-types", "dep:geoarrow", "arrow"]
3232

r/DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ License: MIT + file LICENSE
99
Encoding: UTF-8
1010
Language: en
1111
Roxygen: list(markdown = TRUE)
12-
RoxygenNote: 7.2.3
12+
RoxygenNote: 7.3.1
1313
Config/rextendr/version: 0.3.1.9000
1414
SystemRequirements: Cargo (rustc package manager)

r/NAMESPACE

+34-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,37 @@
11
# Generated by roxygen2: do not edit by hand
22

3-
export(parse_esri_json_raw)
4-
export(parse_esri_json_raw_geoarrow)
5-
export(parse_esri_json_raw_simd)
6-
export(parse_esri_json_str)
7-
export(parse_esri_json_str_simd)
3+
export(as_featureset_2d)
4+
export(as_featureset_3d)
5+
export(sf_as_features_2d)
6+
export(sf_as_features_3d)
7+
export(sfc_linestring_features_2d)
8+
export(sfc_linestring_features_3d)
9+
export(sfc_linestring_featureset_2d)
10+
export(sfc_linestring_featureset_3d)
11+
export(sfc_multilinestring_features_2d)
12+
export(sfc_multilinestring_features_3d)
13+
export(sfc_multilinestring_featureset_2d)
14+
export(sfc_multilinestring_featureset_3d)
15+
export(sfc_multipoint_features_2d)
16+
export(sfc_multipoint_features_3d)
17+
export(sfc_multipoint_featureset_2d)
18+
export(sfc_multipoint_featureset_3d)
19+
export(sfc_multipolygon_features_2d)
20+
export(sfc_multipolygon_features_3d)
21+
export(sfc_multipolygon_featureset_2d)
22+
export(sfc_multipolygon_featureset_3d)
23+
export(sfc_point_features_2d)
24+
export(sfc_point_features_3d)
25+
export(sfc_point_featureset_2d)
26+
export(sfc_point_featureset_3d)
27+
export(sfc_polygon_features_2d)
28+
export(sfc_polygon_features_3d)
29+
export(sfc_polygon_featureset_2d)
30+
export(sfc_polygon_featureset_3d)
31+
export(sfg_linestring_as_polyline)
32+
export(sfg_multilinestring_as_polyline)
33+
export(sfg_multipoint_as_multipoint)
34+
export(sfg_multipolygon_as_polygon)
35+
export(sfg_point_as_point)
36+
export(sfg_polygon_as_polygon)
837
useDynLib(serdesri, .registration = TRUE)

r/R/extendr-wrappers.R

+141-5
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,155 @@
1212
NULL
1313

1414
#' @export
15-
parse_esri_json_str <- function(str, n_dim) .Call(wrap__parse_esri_json_str, str, n_dim)
15+
#' @rdname geometries
16+
sfg_point_as_point <- function(x, sr) .Call(wrap__sfg_point_as_point, x, sr)
1617

18+
#' Convert sfg geometries to EsriJSON strings
19+
#'
20+
#' @param x an sfg object
1721
#' @export
18-
parse_esri_json_str_simd <- function(str, n_dim) .Call(wrap__parse_esri_json_str_simd, str, n_dim)
22+
#' @rdname geometries
23+
sfg_multipoint_as_multipoint <- function(x, sr) .Call(wrap__sfg_multipoint_as_multipoint, x, sr)
1924

2025
#' @export
21-
parse_esri_json_raw_simd <- function(raw, n_dim) .Call(wrap__parse_esri_json_raw_simd, raw, n_dim)
26+
#' @rdname geometries
27+
sfg_linestring_as_polyline <- function(x, sr) .Call(wrap__sfg_linestring_as_polyline, x, sr)
2228

2329
#' @export
24-
parse_esri_json_raw <- function(raw, n_dim) .Call(wrap__parse_esri_json_raw, raw, n_dim)
30+
#' @rdname geometries
31+
sfg_multilinestring_as_polyline <- function(x, sr) .Call(wrap__sfg_multilinestring_as_polyline, x, sr)
2532

2633
#' @export
27-
parse_esri_json_raw_geoarrow <- function(raw, n_dim) .Call(wrap__parse_esri_json_raw_geoarrow, raw, n_dim)
34+
#' @rdname geometries
35+
sfg_polygon_as_polygon <- function(x, sr) .Call(wrap__sfg_polygon_as_polygon, x, sr)
36+
37+
#' @export
38+
#' @rdname geometries
39+
sfg_multipolygon_as_polygon <- function(x, sr) .Call(wrap__sfg_multipolygon_as_polygon, x, sr)
40+
41+
#' @param attrs a data.frame of columns that define the attributes
42+
#' @param geoms an sfc geometry column
43+
#' @param n the number of rows in `attrs`, if geometry is provided, must have as many elements as `n`
44+
#' @param sr a list representing the spatial reference e.g. `list(wkid = 3857)`
45+
#' @export
46+
#' @rdname features
47+
sf_as_features_2d <- function(attrs, geoms, n, sr) .Call(wrap__sf_as_features_2d, attrs, geoms, n, sr)
48+
49+
#' @export
50+
#' @rdname features
51+
sf_as_features_3d <- function(attrs, geoms, n, sr) .Call(wrap__sf_as_features_3d, attrs, geoms, n, sr)
52+
53+
#' Create an EsriJSON feature array
54+
#' @param an sfc geometry vector
55+
#' @export
56+
#' @rdname features
57+
sfc_linestring_features_2d <- function(x, sr) .Call(wrap__sfc_linestring_features_2d, x, sr)
58+
59+
#' @export
60+
#' @rdname features
61+
sfc_linestring_features_3d <- function(x, sr) .Call(wrap__sfc_linestring_features_3d, x, sr)
62+
63+
#' @export
64+
#' @rdname featureset
65+
sfc_linestring_featureset_2d <- function(x, sr) .Call(wrap__sfc_linestring_featureset_2d, x, sr)
66+
67+
#' @export
68+
#' @rdname featureset
69+
sfc_linestring_featureset_3d <- function(x, sr) .Call(wrap__sfc_linestring_featureset_3d, x, sr)
70+
71+
#' @export
72+
#' @rdname features
73+
sfc_multilinestring_features_2d <- function(x, sr) .Call(wrap__sfc_multilinestring_features_2d, x, sr)
74+
75+
#' @export
76+
#' @rdname features
77+
sfc_multilinestring_features_3d <- function(x, sr) .Call(wrap__sfc_multilinestring_features_3d, x, sr)
78+
79+
#' @export
80+
#' @rdname featureset
81+
sfc_multilinestring_featureset_2d <- function(x, sr) .Call(wrap__sfc_multilinestring_featureset_2d, x, sr)
82+
83+
#' @export
84+
#' @rdname featureset
85+
sfc_multilinestring_featureset_3d <- function(x, sr) .Call(wrap__sfc_multilinestring_featureset_3d, x, sr)
86+
87+
#' @export
88+
#' @rdname features
89+
sfc_multipoint_features_2d <- function(x, sr) .Call(wrap__sfc_multipoint_features_2d, x, sr)
90+
91+
#' @export
92+
#' @rdname features
93+
sfc_multipoint_features_3d <- function(x, sr) .Call(wrap__sfc_multipoint_features_3d, x, sr)
94+
95+
#' @export
96+
#' @rdname featureset
97+
sfc_multipoint_featureset_2d <- function(x, sr) .Call(wrap__sfc_multipoint_featureset_2d, x, sr)
98+
99+
#' @export
100+
#' @rdname featureset
101+
sfc_multipoint_featureset_3d <- function(x, sr) .Call(wrap__sfc_multipoint_featureset_3d, x, sr)
102+
103+
#' @export
104+
#' @rdname features
105+
sfc_multipolygon_features_2d <- function(x, sr) .Call(wrap__sfc_multipolygon_features_2d, x, sr)
106+
107+
#' @export
108+
#' @rdname features
109+
sfc_multipolygon_features_3d <- function(x, sr) .Call(wrap__sfc_multipolygon_features_3d, x, sr)
110+
111+
#' @export
112+
#' @rdname featureset
113+
sfc_multipolygon_featureset_2d <- function(x, sr) .Call(wrap__sfc_multipolygon_featureset_2d, x, sr)
114+
115+
#' @export
116+
#' @rdname featureset
117+
sfc_multipolygon_featureset_3d <- function(x, sr) .Call(wrap__sfc_multipolygon_featureset_3d, x, sr)
118+
119+
#' @export
120+
#' @rdname features
121+
sfc_point_features_2d <- function(x, sr) .Call(wrap__sfc_point_features_2d, x, sr)
122+
123+
#' @export
124+
#' @rdname features
125+
sfc_point_features_3d <- function(x, sr) .Call(wrap__sfc_point_features_3d, x, sr)
126+
127+
#' @export
128+
#' @rdname featureset
129+
sfc_point_featureset_2d <- function(x, sr) .Call(wrap__sfc_point_featureset_2d, x, sr)
130+
131+
#' @export
132+
#' @rdname featureset
133+
sfc_point_featureset_3d <- function(x, sr) .Call(wrap__sfc_point_featureset_3d, x, sr)
134+
135+
#' @export
136+
#' @rdname features
137+
sfc_polygon_features_2d <- function(x, sr) .Call(wrap__sfc_polygon_features_2d, x, sr)
138+
139+
#' @export
140+
#' @rdname features
141+
sfc_polygon_features_3d <- function(x, sr) .Call(wrap__sfc_polygon_features_3d, x, sr)
142+
143+
#' @export
144+
#' @rdname featureset
145+
sfc_polygon_featureset_2d <- function(x, sr) .Call(wrap__sfc_polygon_featureset_2d, x, sr)
146+
147+
#' @export
148+
#' @rdname featureset
149+
sfc_polygon_featureset_3d <- function(x, sr) .Call(wrap__sfc_polygon_featureset_3d, x, sr)
150+
151+
#' Create a `FeatureSet` with 2-dimensional geometries
152+
#' @param attrs a data.frame of columns that define the attributes
153+
#' @param geoms an sfc geometry column
154+
#' @param n the number of rows in `attrs`, if geometry is provided, must have as many elements as `n`
155+
#' @param sr a list representing the spatial reference e.g. `list(wkid = 3857)`
156+
#' @export
157+
#' @rdname featureset
158+
as_featureset_2d <- function(attrs, geoms, n, sr) .Call(wrap__as_featureset_2d, attrs, geoms, n, sr)
159+
160+
#' @export
161+
#' @rdname featureset
162+
#' @param has_z bool. Whether Z or M geometries are provided. When `has_z = FALSE`, the attribute `hasM = true`
163+
as_featureset_3d <- function(attrs, geoms, n, sr, has_z) .Call(wrap__as_featureset_3d, attrs, geoms, n, sr, has_z)
28164

29165

30166
# nolint end

0 commit comments

Comments
 (0)