hiten4github / tamt

Automatically exported from code.google.com/p/tamt
0 stars 0 forks source link

Cannot create traffic flow report #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
create a region with tags, zones, roads

upload small.zip as the gps file

tag the gps points in the import screen (not sure how i got more tagged records 
than there was GPS points)

add trafficount, daytype, default flow

create traffic flow report, get this error:

There was an error executing the SQL: ERROR: division by zero
  Where: PL/pgSQL function "tamt_trafficflowhourlyaverage" line 5 at FOR over SELECT rows
SQL statement "CREATE TABLE tmp_hrly AS SELECT * FROM 
TAMT_trafficFlowHourlyAverage( $1 ,  $2 ) AS foo( id text, tagid text, daytype 
text, hour_bucket float, w2_hrly float, w3_hrly float, pc_hrly float, tx_hrly 
float, ldv_hrly float, ldc_hrly float, hdc_hrly float, mdb_hrly float, hdb_hrly 
float )"
PL/pgSQL function "tamt_trafficflowreport" line 11 at SQL statement

Original issue reported on code.google.com by stuartmo...@gmail.com on 1 Mar 2011 at 10:38

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Division by zero happens in tamt_trafficflowhourlyaverage when a traffic count 
entry is from one hour to another (e.g. 06:00 to 07:00). The date_part function 
gives a minute interval of 0 for this instead of 60 (as in 60 minutes). Then, 
when we try to convert to:

w2 * (60.0 / date_part('minute', (endtime - starttime))) as w2avg

...we end up trying to compute 60/0.

This defect was totally invisible during previous testing with sample traffic 
counts that crossed the hour boundary. (e.g. 06:00 to 07:15) 

Original comment by stuartmo...@gmail.com on 1 Mar 2011 at 11:35

GoogleCodeExporter commented 9 years ago

Original comment by stuartmo...@gmail.com on 2 Mar 2011 at 12:25