SGBucket buck(aPos);
// get neigboring buckets
- int bx = (int)( range*SG_NM_TO_METER / buck.get_width_m() / 2);
- int by = (int)( range*SG_NM_TO_METER / buck.get_height_m() / 2 );
+ int bx = (int)( range*SG_NM_TO_METER / buck.get_width_m() / 2) + 1;
+ int by = (int)( range*SG_NM_TO_METER / buck.get_height_m() / 2 ) + 1;
// loop over bucket range
for ( int i=-bx; i<=bx; i++) {
for ( int j=-by; j<=by; j++) {
buck = sgBucketOffset(aPos.getLongitudeDeg(), aPos.getLatitudeDeg(), i, j);
long int bucket = buck.gen_index();
- comm_list_type Fstations = commlist_bck[bucket];
- comm_list_iterator current = Fstations.begin();
- comm_list_iterator last = Fstations.end();
+ comm_map_const_iterator Fstations = commlist_bck.find(bucket);
+ if (Fstations == commlist_bck.end()) continue;
+ comm_list_const_iterator current = Fstations->second.begin();
+ comm_list_const_iterator last = Fstations->second.end();
// double az1, az2, s;