Skip to content

Commit

Permalink
removed index file bbox check
Browse files Browse the repository at this point in the history
  • Loading branch information
elidwa committed Oct 9, 2024
1 parent 39ca549 commit 4980d43
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
26 changes: 7 additions & 19 deletions packages/geo/GeoIndexedRaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ uint32_t GeoIndexedRaster::getSamples(const std::vector<point_info_t>& points, L
*/
if(isSampling())
{
const double start = TimeLib::latchtime();
mlog(DEBUG, "Populating sllist with samples");
for(uint32_t pointIndx = 0; pointIndx < pointsGroups.size(); pointIndx++)
{
Expand All @@ -272,6 +273,8 @@ uint32_t GeoIndexedRaster::getSamples(const std::vector<point_info_t>& points, L

sllist.add(slist);
}
perfStats.collectSamplesTime = TimeLib::latchtime() - start;
mlog(INFO, "Populated sllist with samples, time: %lf", perfStats.collectSamplesTime);
}
else
{
Expand Down Expand Up @@ -306,11 +309,7 @@ uint32_t GeoIndexedRaster::getSamples(const std::vector<point_info_t>& points, L
unlockSampling();

/* Print performance stats */
mlog(INFO, "Performance Stats:");
mlog(INFO, "spatialFilter: %12.3lf", perfStats.spatialFilterTime);
mlog(INFO, "findingRasters:%12.3lf", perfStats.findRastersTime);
mlog(INFO, "findingUnique: %12.3lf", perfStats.findUniqueRastersTime);
mlog(INFO, "sampling: %12.3lf", perfStats.samplesTime);
perfStats.log(INFO);

return ssErrors;
}
Expand Down Expand Up @@ -401,9 +400,6 @@ GeoIndexedRaster::GeoIndexedRaster(lua_State *L, GeoParms* _parms, GdalRaster::o

/* Establish Credentials */
GdalRaster::initAwsAccess(_parms);

/* Mark index file bbox/extent poly as empty */
geoIndexPoly.empty();
}


Expand Down Expand Up @@ -646,7 +642,6 @@ bool GeoIndexedRaster::openGeoIndex(const OGRGeometry* geo, const std::vector<po
try
{
geoRtree.clear();
geoIndexPoly.empty();

/* Open new vector data set*/
dset = static_cast<GDALDataset *>(GDALOpenEx(newFile.c_str(), GDAL_OF_VECTOR | GDAL_OF_READONLY, NULL, NULL, NULL));
Expand Down Expand Up @@ -703,10 +698,6 @@ bool GeoIndexedRaster::openGeoIndex(const OGRGeometry* geo, const std::vector<po
bbox.lat_min = env.MinY;
bbox.lon_max = env.MaxX;
bbox.lat_max = env.MaxY;

/* Create poly geometry for index file bbox/envelope */
geoIndexPoly = GdalRaster::makeRectangle(bbox.lon_min, bbox.lat_min, bbox.lon_max, bbox.lat_max);
mlog(DEBUG, "index file extent/bbox: (%.6lf, %.6lf), (%.6lf, %.6lf)", bbox.lon_min, bbox.lat_min, bbox.lon_max, bbox.lat_max);
}

mlog(DEBUG, "Loaded %lld features from: %s", layer->GetFeatureCount(), newFile.c_str());
Expand Down Expand Up @@ -772,12 +763,9 @@ void GeoIndexedRaster::sampleRasters(OGRGeometry* geo)
*----------------------------------------------------------------------------*/
bool GeoIndexedRaster::sample(OGRGeometry* geo, int64_t gps, GroupOrdering* groupList)
{
const bool openNewFile = geoIndexPoly.IsEmpty() || !geoIndexPoly.Contains(geo);
if(openNewFile)
{
if(!openGeoIndex(geo, NULL))
return false;
}
/* Open the index file, if not already open */
if(!openGeoIndex(geo, NULL))
return false;

/* Find rasters that intersect with the geometry */
std::vector<OGRFeature*> foundFeatures;
Expand Down
17 changes: 13 additions & 4 deletions packages/geo/GeoIndexedRaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,19 @@ class GeoIndexedRaster: public RasterObject
double findRastersTime;
double findUniqueRastersTime;
double samplesTime;

PerfStats(void) : spatialFilterTime(0), findRastersTime(0), findUniqueRastersTime(0), samplesTime(0) {}
void clear(void) { spatialFilterTime = 0; findRastersTime = 0; findUniqueRastersTime = 0; samplesTime = 0;}
double collectSamplesTime;

PerfStats (void) : spatialFilterTime(0), findRastersTime(0), findUniqueRastersTime(0), samplesTime(0), collectSamplesTime(0) {}
void clear(void) { spatialFilterTime = 0; findRastersTime = 0; findUniqueRastersTime = 0; samplesTime = 0; collectSamplesTime = 0; }
void log (event_level_t lvl)
{
mlog(lvl, "Performance Stats:");
mlog(lvl, "spatialFilter: %12.3lf", spatialFilterTime);
mlog(lvl, "findingRasters:%12.3lf", findRastersTime);
mlog(lvl, "findingUnique: %12.3lf", findUniqueRastersTime);
mlog(lvl, "sampling: %12.3lf", samplesTime);
mlog(lvl, "collecSamples: %12.3lf", collectSamplesTime);
}
} perf_stats_t;

/*--------------------------------------------------------------------
Expand All @@ -267,7 +277,6 @@ class GeoIndexedRaster: public RasterObject
uint32_t cols;

GeoRtree geoRtree;
OGRPolygon geoIndexPoly;

/*--------------------------------------------------------------------
* Methods
Expand Down

0 comments on commit 4980d43

Please sign in to comment.