Travel Mapping

User Discussions => Other Discussion => Topic started by: michih on September 10, 2016, 04:32:49 am

Title: Incorrect total mileage calculation
Post by: michih on September 10, 2016, 04:32:49 am
There's a problem that some system mileage is more than the corresponding region mileage: http://tm.teresco.org/user/?u=cinx

The total mileage (preview+active) of the BIH region is 2238.76mi.
The total mileage of bihm system is 2275.34mi though!

The total mileage of the LTU region is 1166.80mi.
The total mileage of ltua system is 1185.63mi though!

The total mileage of the MKD region is 536.59mi.
The total mileage of mkda system is 557.95mi though!

The total mileage of the MLT region is 110.92mi.
The total mileage of mltt system is 113.49mi though!
Title: Re: Incorrect total mileage calculation
Post by: si404 on September 10, 2016, 06:05:40 am
Is system mileage not removing concurrencies, but region mileage is?
Title: Re: Incorrect total mileage calculation
Post by: michih on September 10, 2016, 06:47:05 am
If it is, I think it's not a feature but a bug...
Title: Re: Incorrect total mileage calculation
Post by: mapcat on September 10, 2016, 08:35:19 am
This has been the case for a while...thought someone already reported it.

Another example: I have 1148.52 mi on Quebec freeways in Quebec but only 1120.02 mi in Quebec overall. I added my total mileage for each of the individual routes in the set and got 1148.50, so it obviously isn't accounting for some/all concurrencies (the A-20 and A-55 have a concurrency of around 37 km / 23 mi).
Title: Re: Incorrect total mileage calculation
Post by: Jim on December 20, 2016, 09:23:20 pm
OK, so the problem is in the SQL query in user/index.php, which attempts to compute the total system mileage by adding up all the routes in the system, not taking into account concurrencies. It looks to me like the stats generated by the site update in the logs directory are correct.  So I think we're good with the site update program itself.  I will see if I can come up with an SQL query that will get the correct sum from the existing DB info, or if I need to put more into the DB to get this right.
Title: Re: Incorrect total mileage calculation
Post by: Jim on December 20, 2016, 10:54:48 pm
I think I've got this one fixed and live on the site.  Fortunately, everything needed was there in the DB.
Title: Re: Incorrect total mileage calculation
Post by: michih on December 21, 2016, 04:01:00 am
Thanks, I've checked all calculations (see first post), and I think it's OK now.

The total mileage of the MLT region is 110.92mi.
The total mileage of mltt system is 113.49mi though!

Both have 110.92mi now :)
Title: Re: Incorrect total mileage calculation
Post by: Jim on December 21, 2016, 09:26:19 am
Looks like some larger systems are way off.  Definitely some things be counted multiple times.  (See other related thread.)  I'm looking at it.
Title: Re: Incorrect total mileage calculation
Post by: Jim on December 21, 2016, 10:00:06 am
Think I got it now.  Let me know.
Title: Re: Incorrect total mileage calculation
Post by: mapcat on December 21, 2016, 10:05:01 am
Mine look good.
Title: Re: Incorrect total mileage calculation
Post by: michih on December 21, 2016, 10:24:02 am
The small systems mentioned are still fine :)