• Willkommen im Geoclub - dem größten deutschsprachigen Geocaching-Forum. Registriere dich kostenlos, um alle Inhalte zu sehen und neue Beiträge zu erstellen.

StatDistance Error

Moewe

Geonewbie
Hallo Leute

Habe mir die neuste Version von Geolog (2.47) geladen und beim Ausführen auf einem Ubuntu System erhalte ich folgende Fehlermeldung:

Code:
Generate HTML pages in the main directory ...
 ... contact gcprofileAn error has occurred while evaluating 'StatDistance()':
 Illegal division by zero at (eval 29) line 19.
 index map statAn error has occurred while evaluating 'StatDistance()':
 Illegal division by zero at (eval 142) line 19.

Checking databases ...
  Checking state.tab ... ........
  Checking the integrity of found entries... ........
  Checking the integrity of not-found entries...
  Checking the integrity of hidden entries...
Module habe ich alle installiert - so hoffe ich zumindest.

Kann mir da jemand bitte weiterhelfen?

mfg Moewe
 

HSCA

Geomaster
Ich helfe Dir gerne, muss aber erst die anderen anstehenden Fehler beheben. Also bitte nicht ungeduldig werden, wenn ich nicht gleich antworte. Kannst du mal bitte die finddistance.incl aus dem Verzeichnis gcdir/statistics/ posten?

C
 
OP
M

Moewe

Geonewbie
Hallo

Vielen Dank :)
Hier der Inhalt:
Code:
##eval(

sub StatDistance {
    my @distanceValue=(0, 10, 20, 30, 40, 50, 100, 200, 500, 1000);
    my @distanceCount=();
    my $distance;
    my $totalCount = 0;

    for my $j (0..scalar(@distanceValue)) {
      $distanceCount[$j] = 0;
      }

    foreach (keys(%found)) {
      if($found{$_}->{'Type'} !~ /locationless/i) {
        $totalCount++;
        $distance = GeoDistance($homelat, $homelon, $found{$_}->{'CacheLat'}, $found{$_}->{'CacheLon'});
      #$distance = $geodist->inverse($homelat,$homelon,$found{$_}->{'CacheLat'}, $found{$_}->{'CacheLon'}) / 1000;
        for my $i (0..scalar(@distanceValue)-2) {
          if(($distance < $distanceValue[$i + 1]) && ($distance >= $distanceValue[$i])) {
            $distanceCount[$i]++;
          }
        }
        if($distance >= $distanceValue[scalar(@distanceValue)-1]) {
          $distanceCount[scalar(@distanceValue)-1]++;
        }
      }
    }
    my $maxCount = 0;
    for my $k (0..scalar(@distanceValue)-1) {
      if ($maxCount < $distanceCount[$k])
      {
        $maxCount = $distanceCount[$k];
      }
    }
    my $text = "";
    for my $i (0..scalar(@distanceValue)-1) {
      if($i < (scalar(@distanceValue)-1)) {
        $text .= '<tr><td bgcolor="#dcdcdc">'.$distanceValue[$i].'-'.$distanceValue[$i+1];
      }
      else {
        $text .= '<tr><td bgcolor="#dcdcdc">>'.$distanceValue[$i];
      }
      my $percent = $distanceCount[$i] / $totalCount * 100;
      $text .= '</td><td bgcolor="#dcdcdc"><div><p style="margin: 0px; height: 100%; white-space:nowrap; display: block; width: '.sprintf("%1.0f%%",($distanceCount[$i] / $maxCount * 100)).'; background: '.statcolor_red_yellow_green($distanceCount[$i],0,$maxCount).'">'.$distanceCount[$i].sprintf(" (%1.1f%%)",$percent).'</p></div></td>';
    }
    return $text;
  }
)##

<div ##caption-style##>Funde nach Entfernung</div>
<table ##table-style##>
  <tr>
    <td width="33%" style="background:#dcdcdc;color:black" >Entfernung</td>
   <td bgcolor="#dcdcdc">Anzahl</td>
  </tr>
  ##eval(StatDistance())##
</table>
 

HSCA

Geomaster
Moewe schrieb:
erhalte ich folgende Fehlermeldung:

Code:
Generate HTML pages in the main directory ...
 ... contact gcprofileAn error has occurred while evaluating 'StatDistance()':
 Illegal division by zero at (eval 29) line 19.
 index map statAn error has occurred while evaluating 'StatDistance()':
 Illegal division by zero at (eval 142) line 19.

Checking databases ...
  Checking state.tab ... ........
  Checking the integrity of found entries... ........
  Checking the integrity of not-found entries...
  Checking the integrity of hidden entries...

Der Fehler scheint nur aufzutreten, wenn die Home-Koordinaten identisch mit Cache-Koordinaten sind. Dann sollte GeoDistance 0 berechenen, bringt aber einen Fehler.

Problembehebung: Home-Koordinaten etwas verschieben (die letzte Stelle reicht aus)

C
 
Oben