Bad intersections - Highways - Railways - Work in progress
Posted: Sun 31 Oct 2010 10:17 am
This work is in progress. With help of Shades, I begin to understand how to remove all bad intersections (Highways and Railways). Bad intersections are not only on WP#2:
1. If a route has n WP, we have bad intersections when:
WP-intersections on WP#2, 3, 4.... (n-2), (n-1)
So we have to find all bad records where: 1 < WP-Intersections < n
2. A road has 2 intersection-WP (1 and MAXWP) or only 1 (ending-road) or none (isolated road).
A) Useful scripts (written by 4Shades):
1. Highways:
- To rebuild Highway_Intersections:
- To list all highways routes with Max(Waypoint_Number)<6:
- To list all bad road intersection routes (1<WP<5):
- To list all bad intersections when WPMAX=n and 1< WP-intersection <n:
2. Railways:
- To rebuild Railway_Intersections:
- To list all railway routes with Max(Waypoint_Number)<5:
- To list the number of short routes in each map:
- To list all bad rail intersection routes (1<WP<5):
- To list all bad intersections when WPMAX=n and 1< WP-intersection <n:
B) Method:
1. For all short routes (MAXWP<5) we increase the WP's number to 5 by editing the tables and adding new WP: It gives very good results with trains.
2. For all overlaping routes (mainly Highways), we have to locate in FMB, find the overlaping road and rebuild tables. I'm able to do that only for maps where I have the highways.mis file.
--> Channel has the greatest density of railways: Results were perfect in London (SEE)
C) Final work: All intersections are on WP#1 or WP#MAX AND WP#MAX >2
Here are all maps that contain records in Highways or Railways_Waypoints tables[/u]:
Pay attention: the sql files do not contain the "drop table if exists tablename". Empty tables first!
Ardennes Highways New capture
Ardennes Railways: checked no change
Balaton Highways
Balaton Railways
Bay of Biscay Highways
Bay of Biscay Railways: checked no change
Berlin Highways New capture
Berlin Railways
Cartagena Highways: checked no change
Cartagena Railways: checked no change
Central Med Highways New capture
Central Med Railways New capture
Channel 1940 Highways
Channel 1940 Railways
Channel 1942 Highways
Channel 1942 Railways
Crete Highways: checked no change
Crimea Highways: checked no change
Crimea Railways
Cyrenaica Highways New capture
Cyrenaica Railways: checked no change
Darwin Highways: checked no change
Darwin Railways: checked no change
El Alamein Highways: checked no change
El Alamein Railways: checked no change
English Channel Highways: checked no change
EnglishChannel Railways
Fortress Malta Highways
Fortress Malta Railways: checked no change
France Highways
France Railways
Gothic Line Highways
Gothic_Line Railways
Gulf of Finland Highways New capture
Gulf_of_Finland Railways
Hawaii Highways New capture by Hawk5
Iasi Highways: checked no change
Iasi Railways: checked no change
Imphal Highways: checked no change
Italy Highways
Italy Railways: checked no change
Italy_Greece_Highways (European part of Mediterranean Map)New capture
Khalkhin Gol Highways: checked no change
Kiev Highways
Kiev Railways: checked no change
Kiev_AP Highways
Kiev_AP Railways
Korea Highways: checked no change
Korea Railways: checked no change
Kuban Highways
Kuban Railways
Kurland Highways New capture
Kurland Railways: checked no change
Kursk Highways: checked no change
Kursk Railways: checked no change
Kyushu Highways: checked no change
Kyushu Railways: checked no change
Lvov Highways
Lvov Railways
Libya Highways: checked no change
Libya Railways: checked no change
Malta Highways: checked no change
Malta Railways
Manchuria Highways (Hawk5) (WP#MAX > 1)
Manchuria Railways
Marianas Highways New capture
Mediterranean Highways New capture
Moscow Highways (Hawk_5)
Moscow Railways
Murmansk Highways: checked no change
Murmansk Railways: checked no change
New Guinea Highways: checked no change
Normandy Highways
Normandy Railways
NorthSea Highways
Odessa Highways: checked no change
Odessa Railways: checked no change
Okinawa Highways
Oslo Highways: checked no change
Ostfriesland Highways: checked no change
Ostfriesland Railways
Philippines Highways: checked no change
Philippines Railways: checked no change
Prokhorovka Highways: checked no change
Prokhorovka Railways: checked no change
Sardegna Highways: checked no change
Sinai Highways: checked no change
Sinai Railways: checked no change
Singapore Highways New capture
Singapore Railways: checked no change
Slot all maps Highways: checked no change
Slovakia Highways
Slovakia Railways
Slovenia Highways
Slovenia Railways
Smolensk Highways
Smolensk Railways
Stalingrad Highways: checked no change
Stalingrad Railways: checked no change
Tarawa Highways: checked no change
Tubruq Highways: checked no change
1. If a route has n WP, we have bad intersections when:
WP-intersections on WP#2, 3, 4.... (n-2), (n-1)
So we have to find all bad records where: 1 < WP-Intersections < n
2. A road has 2 intersection-WP (1 and MAXWP) or only 1 (ending-road) or none (isolated road).
A) Useful scripts (written by 4Shades):
1. Highways:
- To rebuild Highway_Intersections:
Code: Select all
#
# This query is used to rebuild the Highway_Intersections table from scratch.
# Run this query whenever new waypoints have been added to the Highways table.
# Query written by IV/JG7_4Shades 6 September 2006
#
drop table if exists Highway_Intersections;
CREATE TABLE `Highway_Intersections` (
`Map` varchar(50) default NULL,
`Intersection_X_Axis` int(11) default NULL,
`Intersection_Y_Axis` int(11) default NULL,
`Route` int(11) default NULL,
`Waypoint_Number` int(11) default NULL
) TYPE=InnoDB;
INSERT INTO Highway_Intersections SELECT DISTINCT * FROM (SELECT Map, X_Axis as Intersection_X_Axis, Y_Axis AS Intersection_Y_Axis, Route, Waypoint_Number FROM Highways, (SELECT Map AS Junction_Map, X_Axis AS Junction_X_Axis, Y_Axis AS Junction_Y_Axis, COUNT(Route) AS Exits FROM Highways GROUP BY CONCAT(Map,'^',X_Axis,'^',Y_Axis) HAVING COUNT(Route)>1) AS Junctions WHERE Map=Junctions.Junction_Map AND X_Axis=Junctions.Junction_X_Axis AND Y_Axis=Junction_Y_Axis ORDER BY X_Axis, Y_Axis, Route) AS Table_With_Dups;
#
# End of query.
#
Code: Select all
SELECT A.Map, A.Route, A.MaxWP FROM (SELECT Map, Route, Max(Waypoint_Number) AS MaxWP FROM Highways GROUP BY Route ORDER BY Route) AS A WHERE A.MaxWP<6 ORDER BY A.Map;
Code: Select all
SELECT * FROM Highway_Intersections WHERE Waypoint_Number>1 AND Waypoint_Number<5 ORDER BY Map;
Code: Select all
SELECT HMMap AS Map, HMRoute AS Route, HM.MaxWP AS RouteMaxWP, HI.Waypoint_Number AS IntersectionWP FROM (SELECT Map AS HIMap, Route as HIRoute, Waypoint_Number FROM Highway_Intersections WHERE Waypoint_Number>1 ORDER BY Map,Route) AS HI, (SELECT Map AS HMMap, Route AS HMRoute, Max(Waypoint_Number) AS MaxWP FROM Highways GROUP BY Map, Route ORDER BY Map,Route) AS HM WHERE HI.HIMap=HM.HMMap AND HI.HIRoute = HM.HMRoute AND HI.Waypoint_Number<>HM.MaxWP;
- To rebuild Railway_Intersections:
Code: Select all
# This query is used to rebuild the Railway_Intersections table from scratch.
# Run this query whenever new waypoints have been added to the Railway_Waypoints table.
# Query written by IV/JG7_4Shades 26 September 2008
#
drop table if exists Railway_Intersections;
CREATE TABLE `Railway_Intersections` (
`Map` varchar(50) default NULL,
`Intersection_X_Axis` int(11) default NULL,
`Intersection_Y_Axis` int(11) default NULL,
`Route` int(11) default NULL,
`Waypoint_Number` int(11) default NULL
) TYPE=InnoDB;
INSERT INTO Railway_Intersections SELECT DISTINCT * FROM (SELECT Map, X_Axis as Intersection_X_Axis, Y_Axis AS Intersection_Y_Axis, Route, Waypoint_Number FROM Railway_Waypoints, (SELECT Map AS Junction_Map, X_Axis AS Junction_X_Axis, Y_Axis AS Junction_Y_Axis, COUNT(Route) AS Exits FROM Railway_Waypoints GROUP BY CONCAT(Map,'^',X_Axis,'^',Y_Axis) HAVING COUNT(Route)>1) AS Junctions WHERE Map=Junctions.Junction_Map AND X_Axis=Junctions.Junction_X_Axis AND Y_Axis=Junction_Y_Axis ORDER BY X_Axis, Y_Axis, Route) AS Table_With_Dups;
#
# End of query.
#
Code: Select all
SELECT A.Map, A.Route, A.MaxWP FROM (SELECT Map, Route, Max(Waypoint_Number) AS MaxWP FROM Railway_Waypoints GROUP BY Route ORDER BY Route) AS A WHERE A.MaxWP<5 ORDER BY A.Map;
Code: Select all
SELECT A.Map, Count(*) AS NShort FROM (SELECT Map, Route, Max(Waypoint_Number) AS MaxWP FROM Railway_Waypoints GROUP BY Route ORDER BY Route) AS A WHERE A.MaxWP<5 GROUP BY A.Map ORDER BY A.Map;
Code: Select all
SELECT * FROM Railway_Intersections WHERE Waypoint_Number>1 AND Waypoint_Number<5 ORDER BY Map
Code: Select all
SELECT HMMap AS Map, HMRoute AS Route, HM.MaxWP AS RouteMaxWP, HI.Waypoint_Number AS IntersectionWP FROM (SELECT Map AS HIMap, Route as HIRoute, Waypoint_Number FROM Railway_Intersections WHERE Waypoint_Number>1 ORDER BY Map,Route) AS HI, (SELECT Map AS HMMap, Route AS HMRoute, Max(Waypoint_Number) AS MaxWP FROM Railway_Waypoints GROUP BY Map, Route ORDER BY Map,Route) AS HM WHERE HI.HIMap=HM.HMMap AND HI.HIRoute = HM.HMRoute AND HI.Waypoint_Number<>HM.MaxWP;
1. For all short routes (MAXWP<5) we increase the WP's number to 5 by editing the tables and adding new WP: It gives very good results with trains.
2. For all overlaping routes (mainly Highways), we have to locate in FMB, find the overlaping road and rebuild tables. I'm able to do that only for maps where I have the highways.mis file.
--> Channel has the greatest density of railways: Results were perfect in London (SEE)
C) Final work: All intersections are on WP#1 or WP#MAX AND WP#MAX >2
Here are all maps that contain records in Highways or Railways_Waypoints tables[/u]:
Pay attention: the sql files do not contain the "drop table if exists tablename". Empty tables first!
Ardennes Highways New capture
Ardennes Railways: checked no change
Balaton Highways
Balaton Railways
Bay of Biscay Highways
Bay of Biscay Railways: checked no change
Berlin Highways New capture
Berlin Railways
Cartagena Highways: checked no change
Cartagena Railways: checked no change
Central Med Highways New capture
Central Med Railways New capture
Channel 1940 Highways
Channel 1940 Railways
Channel 1942 Highways
Channel 1942 Railways
Crete Highways: checked no change
Crimea Highways: checked no change
Crimea Railways
Cyrenaica Highways New capture
Cyrenaica Railways: checked no change
Darwin Highways: checked no change
Darwin Railways: checked no change
El Alamein Highways: checked no change
El Alamein Railways: checked no change
English Channel Highways: checked no change
EnglishChannel Railways
Fortress Malta Highways
Fortress Malta Railways: checked no change
France Highways
France Railways
Gothic Line Highways
Gothic_Line Railways
Gulf of Finland Highways New capture
Gulf_of_Finland Railways
Hawaii Highways New capture by Hawk5
Iasi Highways: checked no change
Iasi Railways: checked no change
Imphal Highways: checked no change
Italy Highways
Italy Railways: checked no change
Italy_Greece_Highways (European part of Mediterranean Map)New capture
Khalkhin Gol Highways: checked no change
Kiev Highways
Kiev Railways: checked no change
Kiev_AP Highways
Kiev_AP Railways
Korea Highways: checked no change
Korea Railways: checked no change
Kuban Highways
Kuban Railways
Kurland Highways New capture
Kurland Railways: checked no change
Kursk Highways: checked no change
Kursk Railways: checked no change
Kyushu Highways: checked no change
Kyushu Railways: checked no change
Lvov Highways
Lvov Railways
Libya Highways: checked no change
Libya Railways: checked no change
Malta Highways: checked no change
Malta Railways
Manchuria Highways (Hawk5) (WP#MAX > 1)
Manchuria Railways
Marianas Highways New capture
Mediterranean Highways New capture
Moscow Highways (Hawk_5)
Moscow Railways
Murmansk Highways: checked no change
Murmansk Railways: checked no change
New Guinea Highways: checked no change
Normandy Highways
Normandy Railways
NorthSea Highways
Odessa Highways: checked no change
Odessa Railways: checked no change
Okinawa Highways
Oslo Highways: checked no change
Ostfriesland Highways: checked no change
Ostfriesland Railways
Philippines Highways: checked no change
Philippines Railways: checked no change
Prokhorovka Highways: checked no change
Prokhorovka Railways: checked no change
Sardegna Highways: checked no change
Sinai Highways: checked no change
Sinai Railways: checked no change
Singapore Highways New capture
Singapore Railways: checked no change
Slot all maps Highways: checked no change
Slovakia Highways
Slovakia Railways
Slovenia Highways
Slovenia Railways
Smolensk Highways
Smolensk Railways
Stalingrad Highways: checked no change
Stalingrad Railways: checked no change
Tarawa Highways: checked no change
Tubruq Highways: checked no change