@@ -168,7 +168,7 @@ bool LandsatHlsRaster::findRasters(raster_finder_t* finder)
168
168
169
169
/* Set raster group time and group featureId */
170
170
rasters_group_t * rgroup = new rasters_group_t ;
171
- rgroup->featureId = feature->GetFieldAsString (" id" );
171
+ rgroup->featureId = StringLib::duplicate ( feature->GetFieldAsString (" id" ) );
172
172
rgroup->gpsTime = getGmtDate (feature, DATE_TAG, rgroup->gmtDate );
173
173
174
174
/* Find each requested band in the index file */
@@ -188,7 +188,7 @@ bool LandsatHlsRaster::findRasters(raster_finder_t* finder)
188
188
189
189
raster_info_t rinfo;
190
190
rinfo.dataIsElevation = false ; /* All bands are not elevation */
191
- rinfo.fileName = filePath + fileName.substr (pos);
191
+ rinfo.fileId = finder-> fileDict . add ( filePath + fileName.substr (pos) );
192
192
193
193
if (strcmp (bandName, " Fmask" ) == 0 )
194
194
{
@@ -207,7 +207,7 @@ bool LandsatHlsRaster::findRasters(raster_finder_t* finder)
207
207
}
208
208
}
209
209
210
- // mlog(DEBUG, "Added group: %s with %ld rasters", rgroup->featureId.c_str() , rgroup->infovect.size());
210
+ // mlog(DEBUG, "Added group: %s with %ld rasters", rgroup->featureId, rgroup->infovect.size());
211
211
finder->rasterGroups .push_back (rgroup);
212
212
}
213
213
// mlog(DEBUG, "Found %ld raster groups", finder->rasterGroups.size());
@@ -274,10 +274,11 @@ uint32_t LandsatHlsRaster::_getGroupSamples(sample_mode_t mode, const rasters_gr
274
274
bool isS2 = false ;
275
275
std::size_t pos;
276
276
277
- pos = rgroup->featureId .find (" HLS.L30" );
277
+ const std::string featureId = rgroup->featureId ;
278
+ pos = featureId.find (" HLS.L30" );
278
279
if (pos != std::string::npos) isL8 = true ;
279
280
280
- pos = rgroup-> featureId .find (" HLS.S30" );
281
+ pos = featureId.find (" HLS.S30" );
281
282
if (pos != std::string::npos) isS2 = true ;
282
283
283
284
if (!isL8 && !isS2)
@@ -295,7 +296,7 @@ uint32_t LandsatHlsRaster::_getGroupSamples(sample_mode_t mode, const rasters_gr
295
296
{
296
297
for (const auto & rinfo : rgroup->infovect )
297
298
{
298
- const char * key = rinfo.fileName . c_str ( );
299
+ const char * key = fileDictGet ( rinfo.fileId );
299
300
cacheitem_t * item;
300
301
if (cache.find (key, &item))
301
302
{
@@ -407,12 +408,12 @@ uint32_t LandsatHlsRaster::_getGroupSamples(sample_mode_t mode, const rasters_gr
407
408
}
408
409
409
410
const double groupTime = rgroup->gpsTime / 1000 ;
410
- const std::string groupName = rgroup-> featureId + " {\" algo\" : \" " ;
411
+ const std::string groupName = featureId + " {\" algo\" : \" " ;
411
412
412
413
/* Calculate algos - make sure that all the necessary bands were read */
413
414
if (ndsi)
414
415
{
415
- RasterSample* sample = new RasterSample (groupTime, fileDictAdd (groupName + " NDSI\" }" ));
416
+ RasterSample* sample = new RasterSample (groupTime, fileDict. add (groupName + " NDSI\" }" ));
416
417
if ((green != invalid) && (swir16 != invalid))
417
418
sample->value = (green - swir16) / (green + swir16);
418
419
else sample->value = invalid;
@@ -421,7 +422,7 @@ uint32_t LandsatHlsRaster::_getGroupSamples(sample_mode_t mode, const rasters_gr
421
422
422
423
if (ndvi)
423
424
{
424
- RasterSample* sample = new RasterSample (groupTime, fileDictAdd (groupName + " NDVI\" }" ));
425
+ RasterSample* sample = new RasterSample (groupTime, fileDict. add (groupName + " NDVI\" }" ));
425
426
if ((red != invalid) && (nir08 != invalid))
426
427
sample->value = (nir08 - red) / (nir08 + red);
427
428
else sample->value = invalid;
@@ -430,7 +431,7 @@ uint32_t LandsatHlsRaster::_getGroupSamples(sample_mode_t mode, const rasters_gr
430
431
431
432
if (ndwi)
432
433
{
433
- RasterSample* sample = new RasterSample (groupTime, fileDictAdd (groupName + " NDWI\" }" ));
434
+ RasterSample* sample = new RasterSample (groupTime, fileDict. add (groupName + " NDWI\" }" ));
434
435
if ((nir08 != invalid) && (swir16 != invalid))
435
436
sample->value = (nir08 - swir16) / (nir08 + swir16);
436
437
else sample->value = invalid;
0 commit comments