File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ DataFrame cpp_s2_cap(List geog) {
52
52
// [[Rcpp::export]]
53
53
DataFrame cpp_s2_lat_lng_rect (List geog) {
54
54
SEXP item;
55
- NumericVector lat_lo (geog.size ()), lat_hi (geog.size ()), lng_lo (geog.size ()), lng_hi (geog.size ());
55
+ NumericVector lat_lo (geog.size ()), lat_hi (geog.size ()), lng_lo (geog.size ()),
56
+ lng_hi (geog.size ()), lat_cnt (geog.size ()), lng_cnt (geog.size ());
56
57
for (R_xlen_t i = 0 ; i < geog.size (); i++) {
57
58
Rcpp::checkUserInterrupt ();
58
59
item = geog[i];
@@ -65,9 +66,12 @@ DataFrame cpp_s2_lat_lng_rect(List geog) {
65
66
lat_hi[i] = rect.lat_hi ().degrees ();
66
67
lng_lo[i] = rect.lng_lo ().degrees ();
67
68
lng_hi[i] = rect.lng_hi ().degrees ();
69
+ S2LatLng center = rect.GetCenter ();
70
+ lat_cnt[i] = center.lat ().degrees ();
71
+ lng_cnt[i] = center.lng ().degrees ();
68
72
}
69
73
}
70
74
DataFrame df = DataFrame::create ( _[" lat_lo" ] = lat_lo , _[" lat_hi" ] = lat_hi,
71
- _[" lng_lo" ] = lng_lo, _[" lng_hi" ] = lng_hi );
75
+ _[" lng_lo" ] = lng_lo, _[" lng_hi" ] = lng_hi, _[ " lat_cnt " ] = lat_cnt, _[ " lng_cnt " ] = lng_cnt );
72
76
return df;
73
77
}
You can’t perform that action at this time.
0 commit comments