Skip to content

Commit

Permalink
fixes #2371
Browse files Browse the repository at this point in the history
  • Loading branch information
edzer committed Apr 1, 2024
1 parent 8bf890e commit 43aec36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gdal_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ Rcpp::List sf_from_ogrlayer(OGRLayer *poLayer, bool quiet, bool int64_as_string,
Rcpp::NumericVector toTypeUser, Rcpp::CharacterVector fid_column,
bool promote_to_multi = true, int nfeatures = -1) {

OGRFeatureDefn *poFDefn = poLayer->GetLayerDefn();

size_t n = 0;
if (nfeatures == -1) {
double n_d = (double) poLayer->GetFeatureCount();
Expand All @@ -213,8 +215,6 @@ Rcpp::List sf_from_ogrlayer(OGRLayer *poLayer, bool quiet, bool int64_as_string,
std::vector<OGRFeature *> poFeatureV(n); // full archive
Rcpp::CharacterVector fids(n);

OGRFeatureDefn *poFDefn = poLayer->GetLayerDefn();

std::vector<OGRGeometry *> poGeometryV(n * poFDefn->GetGeomFieldCount());
// cycles column wise: 2nd el is 1st geometry, 2nd feature

Expand Down

0 comments on commit 43aec36

Please sign in to comment.