# HG changeset patch # User Teemu Piippo # Date 1492516758 -10800 # Node ID 48efa8ca14dd705b6e508f331929eb7b65c544ad # Parent 22c22ff63e66acbe1c30149d11003313137dc525 Suppea ajovuoroesitys diff -r 22c22ff63e66 -r 48efa8ca14dd .hgignore --- a/.hgignore Mon Apr 17 22:56:39 2017 +0300 +++ b/.hgignore Tue Apr 18 14:59:18 2017 +0300 @@ -2,3 +2,4 @@ __pycache__ gtfs gtfs.zip +pysäkkialueet.json diff -r 22c22ff63e66 -r 48efa8ca14dd Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Tue Apr 18 14:59:18 2017 +0300 @@ -0,0 +1,14 @@ +all: gtfs pysäkkialueet.json + +pysäkkialueet.json: alue-edustajat.json alueet.gmp gtfs + ./alueet.py > pysäkkialueet.json + +gtfs: gtfs.zip + unzip gtfs.zip -d gtfs + +gtfs.zip: + wget http://data.foli.fi/gtfs/gtfs.zip + +clean: + rm -f pysäkkialueet.json gtfs.zip + rm -rf gtfs \ No newline at end of file diff -r 22c22ff63e66 -r 48efa8ca14dd alue-edustajat.json --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/alue-edustajat.json Tue Apr 18 14:59:18 2017 +0300 @@ -0,0 +1,73 @@ +{ + "Artukainen": "1516", + "Eerikvalla": "395", + "Friskala": "394", + "Haarla": "364", + "Halinen": "1628", + "Hepokulta": "26", + "Ihala": "2098", + "Impivaara": "1564", + "Itäharju": "1672", + "Itäranta": "332", + "Jänessaari": "437", + "Kaistarniemi": "1747", + "Kakskerta": "1764", + "Kastu": "627", + "Katariina": "1708", + "Kauppatori": "T1", + "Kerttuli": "867", + "Kohmo": "1651", + "Konserttitalo": "18", + "Kukola": "303", + "Kuninkoja": "2129", + "Kupittaa": "1972", + "Kurala": "1660", + "Kuuvuori": "218", + "Lauttaranta": "128", + "Lentoasema": "1586", + "Liljalaakso": "592", + "Linja-autoasema": "41", + "Littoinen": "6085", + "Luostarinmäki": "864", + "Länsinummi": "818", + "Maanpää": "1729", + "Majakkaranta": "81", + "Marjaniemi": "534", + "Martti": "74", + "Moikoinen": "90", + "Mylly": "2117", + "Mälikkälä": "781", + "Nummenmäki": "62", + "Nättinummi": "30", + "Oriniemi": "316", + "Oriketo": "1435", + "Pansio": "1506", + "Papinsaari": "352", + "Perno": "745", + "Pernon telakka": "775", + "Pikisaari": "124", + "Pläkkikaupunki": "780", + "Port Arthur": "9", + "Puutori": "286", + "Pääskyvuori": "879", + "Raunistula": "224", + "Rautatieasema": "144", + "Ruissalo": "666", + "Runosmäki": "1015", + "Räntämäki": "1441", + "Saaro": "556", + "Satama": "1", + "Satava": "373", + "Suikkila": "485", + "Teräsrautela": "476", + "Tuomiokirkkotori": "131", + "TYKS": "1030", + "Uittamo": "920", + "Vanha Suurtori": "219", + "Varissuo": "828", + "Verkahovi": "1601", + "VII": "109", + "Vähä-Heikkilä": "944", + "Yliopistonmäki": "1797", + "Ylioppilaskylä": "1643" +} \ No newline at end of file diff -r 22c22ff63e66 -r 48efa8ca14dd alueet.gmp --- a/alueet.gmp Mon Apr 17 22:56:39 2017 +0300 +++ b/alueet.gmp Tue Apr 18 14:59:18 2017 +0300 @@ -1,74 +1,77 @@ -roadmap^60.43008939664394, 22.252131324329984^11@undefined^#FF0000,5,1,#ff8800,0.4^
Ylioppilaskylä^60.4609,22.28027~60.46498,22.28722~60.46587,22.29813~60.4646,22.30422~60.46284,22.30463~60.46111,22.3071~60.45995,22.29775~60.45769,22.28959~60.45981,22.28626 -polygon^#FF0000,5,1,#ff8800,0.4^
Halinen^60.4716,22.30774~60.47444,22.31868~60.47537,22.32499~60.47319,22.3325~60.46946,22.33473~60.46617,22.33658~60.46503,22.3245~60.46416,22.30973~60.47051,22.30346 -polygon^#FF0000,5,1,#ff8800,0.4^
Satama^60.44255,22.20659~60.44617,22.19914~60.45022,22.19881~60.44886,22.21573~60.44435,22.23624~60.43617,22.23826~60.43205,22.22517~60.43592,22.20679 -polygon^#FF0000,5,1,#ff8800,0.4^
Papinsaari^60.39482,22.2577~60.40037,22.27521~60.39147,22.28456~60.38851,22.27179 -polygon^#FF0000,5,1,#ff8800,0.4^
Kaistarniemi^60.3977,22.24465~60.40772,22.24046~60.40792,22.26057~60.40076,22.27409~60.3952,22.25642 -polygon^#FF0000,5,1,#ff8800,0.4^
Haarla^60.3977,22.22706~60.38719,22.23676~60.38341,22.22466~60.38518,22.21205~60.39359,22.20706~60.39816,22.21341 -polygon^#FF0000,5,1,#ff8800,0.4^
Friskala^60.39868,22.21599~60.39804,22.22852~60.38876,22.23916~60.38952,22.24843~60.39329,22.25135~60.40217,22.23474~60.4019,22.21689 -polygon^#FF0000,5,1,#ff8800,0.4^
Kukola^60.41228,22.23341~60.40674,22.23847~60.40283,22.23487~60.40258,22.2168~60.40696,22.21113~60.41236,22.21849 -polygon^#FF0000,5,1,#ff8800,0.4^
Oriniemi^60.38871,22.16432~60.39236,22.18483~60.39972,22.188~60.40171,22.1823~60.39919,22.15413~60.39151,22.15633 -polygon^#FF0000,5,1,#ff8800,0.4^
Maanpää^60.42123,22.17264~60.41472,22.15422~60.40622,22.14277~60.40003,22.15599~60.40577,22.17143~60.41357,22.18174 -polygon^#FF0000,5,1,#ff8800,0.4^
Pikisaari^60.43275,22.20869~60.4239,22.21632~60.41889,22.19831~60.42495,22.19216~60.43033,22.19648 -polygon^#FF0000,5,1,#ff8800,0.4^
Jänessaari^60.42148,22.17333~60.42584,22.18964~60.41902,22.1971~60.41534,22.18056 -polygon^#FF0000,5,1,#ff8800,0.4^
Lentoasema​^60.51616,22.23289~60.50782,22.23676~60.50492,22.27787~60.50936,22.29718~60.51901,22.29847~60.51961,22.26218 -polygon^#FF0000,5,1,#ff8800,0.4^
Mylly^60.49144,22.19414~60.4885,22.19573~60.48964,22.20822~60.49153,22.20901~60.49295,22.20801 -polygon^#FF0000,5,1,#ff8800,0.4^
Kuninkoja^60.49702,22.21496~60.49936,22.22028~60.50048,22.23744~60.49676,22.2392~60.49373,22.23435~60.49306,22.23554~60.49178,22.23402~60.48872,22.22903~60.48729,22.2221~60.49085,22.21505 -polygon^#FF0000,5,1,#ff8800,0.4^
Liljalaakso^60.48957,22.23314~60.49088,22.23302~60.49168,22.23435~60.49311,22.23588~60.49375,22.23486~60.49667,22.2395~60.49666,22.24905~60.49075,22.24422~60.49122,22.24265~60.49107,22.24049~60.49067,22.23908~60.49024,22.2361 -polygon^#FF0000,5,1,#ff8800,0.4^
Länsinummi^60.48921,22.23234~60.49017,22.23633~60.49054,22.23922~60.49097,22.24059~60.49111,22.24266~60.49068,22.24412~60.48955,22.24429~60.48579,22.24697~60.48516,22.23227~60.4884,22.23225 -polygon^#FF0000,5,1,#ff8800,0.4^
Hepokulta^60.46742,22.16646~60.47441,22.16731~60.47744,22.17186~60.47668,22.17882~60.4752,22.18835~60.47127,22.19204~60.46632,22.19152~60.46475,22.18783~60.46403,22.17242 -polygon^#FF0000,5,1,#ff8800,0.4^
Nättinummi^60.45177,22.26442~60.45305,22.2671~60.45144,22.26956~60.45042,22.26871~60.44977,22.26697 -polygon^#FF0000,5,1,#ff8800,0.4^
Teräsrautela^60.47182,22.29006~60.47585,22.29014~60.48198,22.29898~60.4786,22.30708~60.47647,22.31503~60.4748,22.31928~60.47057,22.30316~60.47158,22.29897 -polygon^#FF0000,5,1,#ff8800,0.4^
Ihala^60.46443,22.27208~60.47176,22.2828~60.47215,22.28351~60.47295,22.28976~60.47586,22.28966~60.47505,22.27803~60.47529,22.26612~60.47341,22.26482~60.47244,22.26502~60.47,22.26609~60.46873,22.26701~60.46674,22.26877~60.46574,22.26934~60.46434,22.27049~60.46395,22.27063~60.46343,22.27033~60.46395,22.27112 -polygon^#FF0000,5,1,#ff8800,0.4^
Kauppatori^60.45901,22.268~60.45994,22.26648~60.46324,22.27012~60.46392,22.27117~60.46441,22.2721~60.47172,22.28286~60.4721,22.28353~60.47232,22.2854~60.46842,22.28529~60.4655,22.28372~60.46387,22.28141~60.46168,22.27527 -polygon^#FF0000,5,1,#ff8800,0.4^
Räntämäki​^60.47238,22.28572~60.47263,22.28779~60.47285,22.28987~60.47174,22.28992~60.47142,22.29881~60.47041,22.3031~60.46833,22.30499~60.4655,22.3027~60.46669,22.29898~60.46669,22.29606~60.46569,22.29358~60.46553,22.28608~60.46104,22.27866~60.46121,22.27507~60.46379,22.28189~60.46546,22.2844~60.4686,22.28605 -polygon^#FF0000,5,1,#ff8800,0.4^
Kastu^60.45775,22.29049~60.4599,22.29787~60.45951,22.29945~60.45688,22.3026~60.45537,22.29751~60.45501,22.29585~60.45465,22.29285~60.45619,22.29141 -polygon^#FF0000,5,1,#ff8800,0.4^
Raunistula^60.45331,22.2865~60.45033,22.29068~60.45113,22.29322~60.45198,22.29413~60.45225,22.29741~60.45399,22.29853~60.45529,22.2975~60.45495,22.29585~60.45446,22.2915~60.45386,22.28832~60.45369,22.28748 -polygon^#FF0000,5,1,#ff8800,0.4^
Koroinen^60.45449,22.27684~60.45363,22.28081~60.45187,22.28268~60.45021,22.27761~60.45183,22.27498~60.45315,22.276 -polygon^#FF0000,5,1,#ff8800,0.4^
Kuuvuori^60.45191,22.28278~60.45318,22.28653~60.45331,22.28639~60.45376,22.28747~60.45455,22.2916~60.45579,22.29063~60.45768,22.28938~60.45871,22.28782~60.45974,22.28622~60.4608,22.28048~60.45965,22.27872~60.45826,22.27791~60.45722,22.2778~60.45553,22.27757~60.45456,22.27695~60.45369,22.28097 -polygon^#FF0000,5,1,#ff8800,0.4^
TYKS^60.4445,22.25538~60.44359,22.25256~60.44121,22.24824~60.43617,22.25517~60.43897,22.26358 -polygon^#FF0000,5,1,#ff8800,0.4^
Tuomiokirkkotori^60.42981,22.22978~60.43034,22.2315~60.43061,22.23372~60.42969,22.2362~60.42969,22.23711~60.43068,22.24313~60.42616,22.24204~60.42284,22.23813~60.42596,22.23233 -polygon^#FF0000,5,1,#ff8800,0.4^
Yliopistonmäki^60.42205,22.23332~60.41743,22.22843~60.41462,22.23002~60.41226,22.23362~60.40794,22.23766~60.40841,22.26324~60.41685,22.25384~60.42155,22.24643~60.42243,22.23594 -polygon^#FF0000,5,1,#ff8800,0.4^
Martti
^60.4537,22.25043~60.45203,22.25283~60.45345,22.25685~60.45493,22.25432 -polygon^#FF0000,5,1,#ff8800,0.4^
Majakkaranta^60.45014,22.27757~60.4531,22.28664~60.45031,22.29057~60.44735,22.28184 -polygon^#FF0000,5,1,#ff8800,0.4^
Moikoinen^60.44005,22.2866~60.44433,22.30705~60.44753,22.30114~60.45008,22.29708~60.4519,22.29485~60.45193,22.2942~60.45107,22.2933~60.44645,22.27961~60.44438,22.28246 -polygon^#FF0000,5,1,#ff8800,0.4^
Rautatieasema^60.45224,22.29757~60.4499,22.32448~60.4569,22.32432~60.4621,22.31703~60.45992,22.29862~60.45961,22.29964~60.45684,22.30304~60.45528,22.29775~60.45402,22.29882 -polygon^#FF0000,5,1,#ff8800,0.4^
Kerttuli^60.45206,22.29738~60.45137,22.2971~60.44687,22.30439~60.44232,22.3131~60.43895,22.31757~60.44625,22.3267~60.44913,22.32902 -polygon^#FF0000,5,1,#ff8800,0.4^
Kupittaa^60.35447,22.12646~60.34122,22.13676~60.33714,22.17865~60.35634,22.30671~60.36475,22.31056~60.38221,22.2982~60.37208,22.22194~60.3631,22.16082 -polygon^#FF0000,5,1,#ff8800,0.4^
Nummenmäki^60.36483,22.11222~60.35498,22.12595~60.34539,22.09816~60.35061,22.08758 -polygon^#FF0000,5,1,#ff8800,0.4^
Itäharju^60.35557,22.12732~60.36614,22.11211~60.37617,22.11563~60.38197,22.13505~60.38392,22.1608~60.38367,22.21058~60.38265,22.23049~60.37467,22.23427~60.36377,22.15899 -polygon^#FF0000,5,1,#ff8800,0.4^
Kakskerta^60.44513,22.32739~60.4509,22.33176~60.45303,22.33709~60.45193,22.34516~60.44766,22.34725~60.44482,22.35053~60.44204,22.35147~60.44187,22.33875~60.44334,22.33174 -polygon^#FF0000,5,1,#ff8800,0.4^
Eerikvalla^60.44211,22.3519~60.44491,22.35092~60.44783,22.34766~60.45206,22.34564~60.45506,22.34898~60.4569,22.35851~60.45464,22.36246~60.44861,22.36587~60.44271,22.36825 -polygon^#FF0000,5,1,#ff8800,0.4^
Satava^60.45658,22.33769~60.46067,22.33863~60.46369,22.34413~60.46361,22.35091~60.46069,22.35683~60.45802,22.35761~60.45549,22.34853~60.45532,22.34116 -polygon^#FF0000,5,1,#ff8800,0.4^
Pääskyvuori^60.4623,22.31774~60.46502,22.33262~60.46094,22.33791~60.4565,22.33709~60.45315,22.33619~60.45112,22.33105~60.45135,22.32557~60.45712,22.32505 -polygon^#FF0000,5,1,#ff8800,0.4^
Varissuo^60.42408,22.21672~60.43288,22.20943~60.43357,22.21448~60.43179,22.225~60.42963,22.22912~60.42589,22.23131~60.42324,22.2362~60.42237,22.23158~60.41794,22.22753 -polygon^#FF0000,5,1,#ff8800,0.4^
Kohmo^60.45645,22.26163~60.45447,22.26424~60.45634,22.26935~60.4576,22.26927~60.45794,22.2662 -polygon^#FF0000,5,1,#ff8800,0.4^
Kurala^60.456,22.26864~60.45472,22.2702~60.45356,22.26639~60.45395,22.26597~60.45512,22.26643 -polygon^#FF0000,5,1,#ff8800,0.4^
Lauttaranta^60.45569,22.26935~60.45492,22.27039~60.45569,22.27163~60.45627,22.27076 -undefined^#FF0000,5,1,#ff8800,0.4^
Linja-autoasema^60.45811,22.27231~60.4578,22.27506~60.45618,22.27427~60.45707,22.27271 -undefined^#FF0000,5,1,#ff8800,0.4^
Puutori^ -undefined^#FF0000,5,1,#ff8800,0.4^
Konserttitalo^60.49152,22.24869~60.49397,22.26783~60.48683,22.27238~60.48425,22.26869~60.48425,22.2544 -undefined^#FF0000,5,1,#ff8800,0.4^
Verkahovi^60.48328,22.24959~60.48059,22.25139~60.47672,22.25169~60.47522,22.26525~60.4831,22.2707 +roadmap^60.443792526257056, 22.279618602314603^15@undefined^#FF0000,5,1,#ff8800,0.4^^60.4609,22.28027~60.46498,22.28722~60.46587,22.29813~60.4646,22.30422~60.46284,22.30463~60.46111,22.3071~60.45995,22.29775~60.45769,22.28959~60.45981,22.28626 +polygon^#FF0000,5,1,#ff8800,0.4^^60.4716,22.30774~60.47444,22.31868~60.47537,22.32499~60.47319,22.3325~60.46946,22.33473~60.46617,22.33658~60.46503,22.3245~60.46416,22.30973~60.47051,22.30346 +polygon^#FF0000,5,1,#ff8800,0.4^^60.44255,22.20659~60.44617,22.19914~60.45022,22.19881~60.44886,22.21573~60.44435,22.23624~60.43617,22.23826~60.43205,22.22517~60.43592,22.20679 +polygon^#FF0000,5,1,#ff8800,0.4^^60.39482,22.2577~60.40037,22.27521~60.39147,22.28456~60.38851,22.27179 +polygon^#FF0000,5,1,#ff8800,0.4^^60.3977,22.24465~60.40772,22.24046~60.40792,22.26057~60.40076,22.27409~60.3952,22.25642 +polygon^#FF0000,5,1,#ff8800,0.4^^60.3977,22.22706~60.38719,22.23676~60.38341,22.22466~60.38518,22.21205~60.39359,22.20706~60.39816,22.21341 +polygon^#FF0000,5,1,#ff8800,0.4^^60.39868,22.21599~60.39804,22.22852~60.38876,22.23916~60.38952,22.24843~60.39329,22.25135~60.40217,22.23474~60.4019,22.21689 +polygon^#FF0000,5,1,#ff8800,0.4^^60.41228,22.23341~60.40674,22.23847~60.40283,22.23487~60.40258,22.2168~60.40696,22.21113~60.41236,22.21849 +polygon^#FF0000,5,1,#ff8800,0.4^^60.38871,22.16432~60.39236,22.18483~60.39972,22.188~60.40171,22.1823~60.39919,22.15413~60.39151,22.15633 +polygon^#FF0000,5,1,#ff8800,0.4^^60.42123,22.17264~60.41472,22.15422~60.40622,22.14277~60.40003,22.15599~60.40577,22.17143~60.41357,22.18174 +polygon^#FF0000,5,1,#ff8800,0.4^^60.43275,22.20869~60.4239,22.21632~60.41889,22.19831~60.42495,22.19216~60.43033,22.19648 +polygon^#FF0000,5,1,#ff8800,0.4^^60.42148,22.17333~60.42584,22.18964~60.41902,22.1971~60.41534,22.18056 +polygon^#FF0000,5,1,#ff8800,0.4^^60.51616,22.23289~60.50782,22.23676~60.50492,22.27787~60.50936,22.29718~60.51901,22.29847~60.51961,22.26218 +polygon^#FF0000,5,1,#ff8800,0.4^^60.49144,22.19414~60.4885,22.19573~60.48964,22.20822~60.49153,22.20901~60.49295,22.20801 +undefined^#FF0000,5,1,#ff8800,0.4^^60.49702,22.21496~60.49936,22.22028~60.50048,22.23744~60.49676,22.2392~60.49373,22.23435~60.49306,22.23554~60.49178,22.23402~60.48872,22.22903~60.48729,22.2221~60.49085,22.21505 +undefined^#FF0000,5,1,#ff8800,0.4^^60.46742,22.16646~60.47441,22.16731~60.47744,22.17186~60.47668,22.17882~60.4752,22.18835~60.47127,22.19204~60.46632,22.19152~60.46475,22.18783~60.46403,22.17242 +undefined^#FF0000,5,1,#ff8800,0.4^^60.47182,22.29006~60.47585,22.29014~60.48198,22.29898~60.4786,22.30708~60.47647,22.31503~60.4748,22.31928~60.47057,22.30316~60.47158,22.29897 +undefined^#FF0000,5,1,#ff8800,0.4^^60.46443,22.27208~60.47176,22.2828~60.47215,22.28351~60.47295,22.28976~60.47586,22.28966~60.47505,22.27803~60.47529,22.26612~60.47341,22.26482~60.47244,22.26502~60.47,22.26609~60.46873,22.26701~60.46674,22.26877~60.46574,22.26934~60.46434,22.27049~60.46395,22.27063~60.46343,22.27033~60.46395,22.27112 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45901,22.268~60.45994,22.26648~60.46324,22.27012~60.46392,22.27117~60.46441,22.2721~60.47172,22.28286~60.4721,22.28353~60.47232,22.2854~60.46842,22.28529~60.4655,22.28372~60.46387,22.28141~60.46168,22.27527 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45775,22.29049~60.4599,22.29787~60.45951,22.29945~60.45688,22.3026~60.45537,22.29751~60.45501,22.29585~60.45465,22.29285~60.45619,22.29141 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45331,22.2865~60.45033,22.29068~60.45113,22.29322~60.45198,22.29413~60.45225,22.29741~60.45399,22.29853~60.45529,22.2975~60.45495,22.29585~60.45446,22.2915~60.45386,22.28832~60.45369,22.28748 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45449,22.27684~60.45363,22.28081~60.45187,22.28268~60.45021,22.27761~60.45183,22.27498~60.45315,22.276 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45191,22.28278~60.45318,22.28653~60.45331,22.28639~60.45376,22.28747~60.45455,22.2916~60.45579,22.29063~60.45768,22.28938~60.45871,22.28782~60.45974,22.28622~60.4608,22.28048~60.45965,22.27872~60.45826,22.27791~60.45722,22.2778~60.45553,22.27757~60.45456,22.27695~60.45369,22.28097 +undefined^#FF0000,5,1,#ff8800,0.4^^60.4445,22.25538~60.44359,22.25256~60.44121,22.24824~60.43617,22.25517~60.43897,22.26358 +undefined^#FF0000,5,1,#ff8800,0.4^^60.42205,22.23332~60.41743,22.22843~60.41462,22.23002~60.41226,22.23362~60.40794,22.23766~60.40841,22.26324~60.41685,22.25384~60.42155,22.24643~60.42243,22.23594 +undefined^#FF0000,5,1,#ff8800,0.4^^60.4537,22.25043~60.45203,22.25283~60.45345,22.25685~60.45493,22.25432 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45014,22.27757~60.4531,22.28664~60.45031,22.29057~60.44735,22.28184 +undefined^#FF0000,5,1,#ff8800,0.4^^60.44005,22.2866~60.44433,22.30705~60.44753,22.30114~60.45008,22.29708~60.4519,22.29485~60.45193,22.2942~60.45107,22.2933~60.44645,22.27961~60.44438,22.28246 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45224,22.29757~60.4499,22.32448~60.4569,22.32432~60.4621,22.31703~60.45992,22.29862~60.45961,22.29964~60.45684,22.30304~60.45528,22.29775~60.45402,22.29882 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45206,22.29738~60.45137,22.2971~60.44687,22.30439~60.44232,22.3131~60.43895,22.31757~60.44625,22.3267~60.44913,22.32902 +undefined^#FF0000,5,1,#ff8800,0.4^^60.35447,22.12646~60.34122,22.13676~60.33714,22.17865~60.35634,22.30671~60.36475,22.31056~60.38221,22.2982~60.37208,22.22194~60.3631,22.16082 +undefined^#FF0000,5,1,#ff8800,0.4^^60.36483,22.11222~60.35498,22.12595~60.34539,22.09816~60.35061,22.08758 +undefined^#FF0000,5,1,#ff8800,0.4^^60.35557,22.12732~60.36614,22.11211~60.37617,22.11563~60.38197,22.13505~60.38392,22.1608~60.38367,22.21058~60.38265,22.23049~60.37467,22.23427~60.36377,22.15899 +undefined^#FF0000,5,1,#ff8800,0.4^^60.44513,22.32739~60.4509,22.33176~60.45303,22.33709~60.45193,22.34516~60.44766,22.34725~60.44482,22.35053~60.44204,22.35147~60.44187,22.33875~60.44334,22.33174 +undefined^#FF0000,5,1,#ff8800,0.4^^60.44211,22.3519~60.44491,22.35092~60.44783,22.34766~60.45206,22.34564~60.45506,22.34898~60.4569,22.35851~60.45464,22.36246~60.44861,22.36587~60.44271,22.36825 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45658,22.33769~60.46067,22.33863~60.46369,22.34413~60.46361,22.35091~60.46069,22.35683~60.45802,22.35761~60.45549,22.34853~60.45532,22.34116 +undefined^#FF0000,5,1,#ff8800,0.4^^60.4623,22.31774~60.46502,22.33262~60.46094,22.33791~60.4565,22.33709~60.45315,22.33619~60.45112,22.33105~60.45135,22.32557~60.45712,22.32505 +undefined^#FF0000,5,1,#ff8800,0.4^^60.42408,22.21672~60.43288,22.20943~60.43357,22.21448~60.43179,22.225~60.42963,22.22912~60.42589,22.23131~60.42324,22.2362~60.42237,22.23158~60.41794,22.22753 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45645,22.26163~60.45447,22.26424~60.45634,22.26935~60.4576,22.26927~60.45794,22.2662 +undefined^#FF0000,5,1,#ff8800,0.4^^60.456,22.26864~60.45472,22.2702~60.45356,22.26639~60.45395,22.26597~60.45512,22.26643 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45569,22.26935~60.45492,22.27039~60.45569,22.27163~60.45627,22.27076 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45811,22.27231~60.4578,22.27506~60.45618,22.27427~60.45707,22.27271 +undefined^#FF0000,5,1,#ff8800,0.4^^NaN,NaN +undefined^#FF0000,5,1,#ff8800,0.4^^60.49152,22.24869~60.49397,22.26783~60.48683,22.27238~60.48425,22.26869~60.48425,22.2544 +undefined^#FF0000,5,1,#ff8800,0.4^^60.48328,22.24959~60.48059,22.25139~60.47672,22.25169~60.47522,22.26525~60.4831,22.2707 undefined^#FF0000,5,1,#ff8800,0.4^^60.45857,22.22045~60.46175,22.23684~60.46635,22.24233~60.46999,22.22342~60.46663,22.21524~60.4656,22.21092~60.46162,22.21221 -undefined^#FF0000,5,1,#ff8800,0.4^
Runosmäki^60.4697,22.22131~60.46693,22.21517~60.46528,22.20514~60.47272,22.19522~60.47605,22.20406~60.47122,22.21328 -undefined^#FF0000,5,1,#ff8800,0.4^
Impivaara^60.4705,22.21951~60.48023,22.22414~60.48044,22.21169~60.47626,22.20483~60.47169,22.21384 -undefined^#FF0000,5,1,#ff8800,0.4^
Suikkila^ -undefined^#FF0000,5,1,#ff8800,0.4^
Pläkkikaupunki^60.4848,22.22929~60.4745,22.23281~60.47744,22.25101~60.48083,22.25006~60.48293,22.24869~60.48568,22.24715 +undefined^#FF0000,5,1,#ff8800,0.4^^60.4697,22.22131~60.46693,22.21517~60.46528,22.20514~60.47272,22.19522~60.47605,22.20406~60.47122,22.21328 +undefined^#FF0000,5,1,#ff8800,0.4^^60.4705,22.21951~60.48023,22.22414~60.48044,22.21169~60.47626,22.20483~60.47169,22.21384 +undefined^#FF0000,5,1,#ff8800,0.4^^NaN,NaN +undefined^#FF0000,5,1,#ff8800,0.4^^60.4848,22.22929~60.4745,22.23281~60.47744,22.25101~60.48083,22.25006~60.48293,22.24869~60.48568,22.24715 undefined^#FF0000,5,1,#ff8800,0.4^^60.47431,22.23298~60.4707,22.23392~60.4664,22.2498~60.47087,22.2528~60.47636,22.25137~60.47635,22.24784 undefined^#FF0000,5,1,#ff8800,0.4^^60.48011,22.225~60.48002,22.23015~60.4683,22.23427~60.47094,22.22069 -undefined^#FF0000,5,1,#ff8800,0.4^
Port Arthur
^60.44981,22.24446~60.44765,22.24746~60.44849,22.24963~60.4445,22.25491~60.44364,22.25245~60.43855,22.24272~60.44493,22.23611 -undefined^#FF0000,5,1,#ff8800,0.4^^60.44886,22.24598~60.44968,22.24839~60.44865,22.24984~60.44775,22.24749 -undefined^#FF0000,5,1,#ff8800,0.4^^60.45108,22.24701~60.4446,22.25624~60.44808,22.26877~60.4545,22.26078~60.45179,22.2526~60.45252,22.2517 -undefined^#FF0000,5,1,#ff8800,0.4^
Vanha Suurtori
^60.45191,22.2745~60.44999,22.27746~60.44796,22.2706~60.44837,22.26998~60.44934,22.272 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45191,22.2745~60.44999,22.27746~60.44796,22.2706~60.44837,22.26998~60.44934,22.272 undefined^#FF0000,5,1,#ff8800,0.4^^60.4457,22.19908~60.44249,22.20603~60.43554,22.20629~60.43394,22.19696~60.44188,22.18918 -undefined^#FF0000,5,1,#ff8800,0.4^^60.43173,22.10338~60.41615,22.10006~60.41622,22.08295~60.42873,22.0844 undefined^#FF0000,5,1,#ff8800,0.4^^60.4219,22.10621~60.4208,22.13539~60.40461,22.11823~60.40554,22.10579 -undefined^#FF0000,5,1,#ff8800,0.4^^60.43309,22.10569~60.42267,22.10398~60.42114,22.13985~60.42199,22.17041~60.42716,22.19204~60.43281,22.19683~60.4421,22.18592~60.43862,22.15024~60.437,22.11525 undefined^#FF0000,5,1,#ff8800,0.4^^60.46255,22.1208~60.46094,22.14792~60.45392,22.15324~60.45116,22.13868~60.44198,22.1196~60.4466,22.10751 undefined^#FF0000,5,1,#ff8800,0.4^^60.45366,22.15796~60.45129,22.1614~60.45049,22.16689~60.44892,22.17899~60.4424,22.18543~60.43899,22.15149~60.43804,22.12393~60.44149,22.1198~60.45079,22.13974 undefined^#FF0000,5,1,#ff8800,0.4^^60.45942,22.15127~60.45429,22.15401~60.45399,22.1588~60.4517,22.16222~60.45006,22.17728~60.45513,22.17316~60.4602,22.17171 -undefined^#FF0000,5,1,#ff8800,0.4^^60.45716,22.18431~60.45599,22.18311~60.4547,22.18541~60.45605,22.18904~60.45722,22.18761 -undefined^#FF0000,5,1,#ff8800,0.4^^60.45502,22.18067~60.45494,22.18467~60.45406,22.18612~60.45343,22.18511~60.45311,22.18068 -undefined^#FF0000,5,1,#ff8800,0.4^^60.46026,22.17247~60.46048,22.18955~60.45751,22.18912~60.45739,22.1835~60.45506,22.17994~60.45248,22.17994~60.45248,22.18517~60.45421,22.19041~60.4499,22.19813~60.44596,22.19831~60.44291,22.18622~60.44993,22.179~60.45529,22.17372 undefined^#FF0000,5,1,#ff8800,0.4^^60.42578,22.26521~60.41983,22.26733~60.41353,22.26766~60.41256,22.25922~60.41749,22.25439~60.4231,22.24424 undefined^#FF0000,5,1,#ff8800,0.4^^60.41004,22.26508~60.41744,22.27211~60.41898,22.29023~60.4105,22.29177~60.40538,22.2807~60.4063,22.26891 +undefined^#FF0000,5,1,#ff8800,0.4^^60.46014,22.17238~60.4603,22.18908~60.45502,22.18972~60.45112,22.19633~60.44625,22.19779~60.44274,22.18699~60.4505,22.17996 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45066,22.24616~60.44458,22.25495~60.44369,22.25247~60.43624,22.23858~60.4444,22.23654~60.44471,22.23537~60.4478,22.2407 +undefined^#FF0000,5,1,#ff8800,0.4^^60.48504,22.23244~60.48575,22.24697~60.49033,22.24506~60.49114,22.24283~60.49107,22.24098~60.49086,22.24005~60.49023,22.23753~60.49002,22.23558~60.48981,22.23345~60.491,22.23294~60.48865,22.22914~60.48714,22.22952~60.48611,22.23257 +undefined^#FF0000,5,1,#ff8800,0.4^^60.48987,22.23356~60.49103,22.23309~60.49175,22.23427~60.49312,22.23579~60.49373,22.2346~60.49673,22.23947~60.49728,22.2393~60.49751,22.24406~60.49696,22.24764~60.49359,22.24392~60.49128,22.24289~60.49117,22.24067~60.49032,22.23748 +undefined^#FF0000,5,1,#ff8800,0.4^^60.42207,22.10793~60.43171,22.10878~60.43629,22.11982~60.43677,22.12916~60.43279,22.1408~60.43745,22.15093~60.4402,22.1662~60.44177,22.18809~60.43334,22.19685~60.42639,22.18912~60.42142,22.17058~60.42463,22.15582~60.42085,22.14449 +undefined^#FF0000,5,1,#ff8800,0.4^^60.43186,22.10827~60.4223,22.10735~60.42254,22.10205~60.41546,22.0972~60.41587,22.09045~60.42412,22.0846~60.42765,22.08646 +undefined^#FF0000,5,1,#ff8800,0.4^^60.44991,22.24738~60.45435,22.25976~60.448,22.2675~60.4447,22.25516 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45217,22.26268~60.45381,22.26794~60.45108,22.27178~60.4493,22.26616 +undefined^#FF0000,5,1,#ff8800,0.4^^60.42275,22.24174~60.43039,22.24392~60.43345,22.24115~60.43304,22.23017~60.43182,22.22603~60.4298,22.2295~60.42591,22.23195~60.42344,22.23659 +undefined^#FF0000,5,1,#ff8800,0.4^^60.44096,22.24787~60.43597,22.255~60.43152,22.24341~60.43358,22.2417~60.43332,22.2306~60.43608,22.23889 +undefined^#FF0000,5,1,#ff8800,0.4^^60.48239,22.29941~60.48947,22.30446~60.49533,22.31812~60.48423,22.34836~60.4741,22.3328~60.47605,22.32512~60.47535,22.32003~60.4791,22.30809 +undefined^#FF0000,5,1,#ff8800,0.4^^60.45561,22.3637~60.45679,22.38985~60.45604,22.42422~60.44062,22.42533~60.44181,22.39838~60.43955,22.36977~60.44301,22.36914 +undefined^#FF0000,5,1,#ff8800,0.4^^60.42351,22.24337~60.43036,22.24491~60.43116,22.24466~60.43677,22.259~60.42605,22.26388 +undefined^#FF0000,5,1,#ff8800,0.4^^60.43711,22.25976~60.4297,22.26362~60.43476,22.28431~60.4409,22.27738 +undefined^#FF0000,5,1,#ff8800,0.4^^60.44109,22.27813~60.44283,22.28328~60.43965,22.28611~60.44219,22.29813~60.43711,22.3013~60.43474,22.28554 +undefined^#FF0000,5,1,#ff8800,0.4^^60.44452,22.25624~60.44774,22.26929~60.44727,22.2704~60.4496,22.2777~60.44736,22.2807~60.44634,22.27856~60.44338,22.28208~60.44145,22.27749~60.43898,22.26476 @@@@@@ \ No newline at end of file diff -r 22c22ff63e66 -r 48efa8ca14dd alueet.py --- a/alueet.py Mon Apr 17 22:56:39 2017 +0300 +++ b/alueet.py Tue Apr 18 14:59:18 2017 +0300 @@ -1,17 +1,62 @@ #!/usr/bin/env python3 from pprint import pprint +from PyQt5.QtCore import QPointF, Qt +from PyQt5.QtGui import QPolygonF +from PyQt5.QtWidgets import QApplication +import sys, json +from misc import * + +app = QApplication(sys.argv) + with open('alueet.gmp') as file: - data = file.read() + data = file.read().split('@') -shapes = {} -polygons = data.split('@')[1] -for polygon in polygons.splitlines(): +with open('alue-edustajat.json') as file: + representatives = json.load(file) + +pysäkit = {} + +with open('gtfs/stops.txt') as file: + for rivi in lue_csv(file): + sijainti = QPointF(float(rivi['stop_lat']), float(rivi['stop_lon'])) + tunniste = rivi['stop_id'] + pysäkit[tunniste] = sijainti + +district_shapes = [] +for polygon in data[1].splitlines(): polygon = polygon.split('^') - nimi = polygon[2].rsplit('>', 1)[1] coordinates = [] for point in polygon[3].split('~'): x, y = point.split(',') - coordinates.append((float(x), float(y))) - shapes[nimi.strip().replace('\u200b', '')] = coordinates + coordinates.append(QPointF(float(x), float(y))) + district_shapes.append(QPolygonF(coordinates)) + +districts = {} +bus_stop_districts = {} -pprint(shapes) +for name, stop_id in representatives.items(): + if stop_id is None: + continue + for district_shape in district_shapes: + if district_shape.containsPoint(pysäkit[stop_id], Qt.OddEvenFill): + assert name not in districts + districts[name] = district_shape + district_shapes.remove(district_shape) + bus_stop_districts[stop_id] = name + break + else: + print('cannot find a shape for %r' % name, file = sys.stderr) + +for stop_id, stop_position in pysäkit.items(): + for district, shape in districts.items(): + if shape.containsPoint(stop_position, Qt.OddEvenFill): + bus_stop_districts[stop_id] = district + break + else: + bus_stop_districts[stop_id] = None + +covered = sum(int(bool(k)) for k in bus_stop_districts.values()) +total = len(pysäkit) +print('%.1f%% bus stops covered.' % (covered * 100 / total), file = sys.stderr) + +json.dump(bus_stop_districts, sys.stdout, indent = 2) diff -r 22c22ff63e66 -r 48efa8ca14dd bussit.py --- a/bussit.py Mon Apr 17 22:56:39 2017 +0300 +++ b/bussit.py Tue Apr 18 14:59:18 2017 +0300 @@ -1,19 +1,10 @@ #!/usr/bin/env python3 -import enum +import enum, json +from sys import stderr from datetime import date, time, datetime, timedelta +from misc import * Suunta = enum.Enum('Suunta', [('Taaksepäin', 0), ('Eteenpäin', 1)]) -def lue_csv(tiedosto, muunnokset = None): - import csv - lukija = csv.reader(tiedosto) - otsakkeet = next(lukija) - for rivi in lukija: - tietue = dict(zip(otsakkeet, rivi)) - if muunnokset: - for avain, muunnos in muunnokset.items(): - tietue[avain] = muunnos(tietue[avain]) - yield tietue - def muunna_ajovuoro_tunniste(tunniste): return int(tunniste.split('_')[0]) @@ -53,8 +44,8 @@ return 'palvelut[%r]' % self.tunniste class Pysäkki: - def __init__(self, tunniste, nimi): - self.tunniste, self.nimi = tunniste, nimi + def __init__(self, tunniste, nimi, sijainti): + self.tunniste, self.nimi, self.sijainti = tunniste, nimi, sijainti def __repr__(self): return 'pysäkit[%r]' % self.tunniste def aikataulu(self, määrä = 50): @@ -122,16 +113,16 @@ palvelut = {} pysäkit = {} -print('Ladataan linjat... ', end = '', flush = True) +print('Ladataan linjat... ', file = stderr, end = '', flush = True) with open('gtfs/routes.txt') as tiedosto: for rivi in lue_csv(tiedosto): linja = Linja(rivi) linja.tunniste = linja.tunniste linjat[linja.viite] = linja linjat_per_tunniste[linja.tunniste] = linja -print('%d linjaa' % len(linjat)) +print('%d linjaa' % len(linjat), file = stderr) -print('Ladataan ajot... ', end = '', flush = True) +print('Ladataan ajot... ', file = stderr, end = '', flush = True) with open('gtfs/trips.txt') as tiedosto: for rivi in lue_csv(tiedosto, muunnokset = {'direction_id': lambda k: Suunta(int(k))}): if rivi['service_id'] not in palvelut: @@ -144,7 +135,7 @@ suunta = rivi['direction_id']) assert ajo.nimi not in ajot ajot[ajo.nimi] = ajo -print('%d ajoa' % len(ajot)) +print('%d ajoa' % len(ajot), file = stderr) def lue_päiväys(teksti): return date(int(teksti[:4]), int(teksti[4:6]), int(teksti[6:])) @@ -153,7 +144,7 @@ tunti, minuutti, sekunti = map(int, teksti.split(':')) return timedelta(hours = tunti, minutes = minuutti, seconds = sekunti) -print('Ladataan päiväykset... ', flush = True) +print('Ladataan päiväykset... ', file = stderr, flush = True) viimeinen_käyttöpäivä = date.today() palvelut_per_päivä = {} @@ -173,14 +164,18 @@ if päivä in palvelu.päivät: yield palvelu -print('Ladataan pysäkit... ', end = '', flush = True) +print('Ladataan pysäkit... ', file = stderr, end = '', flush = True) with open('gtfs/stops.txt') as file: for rivi in lue_csv(file): - pysäkki = Pysäkki(rivi['stop_id'], rivi['stop_name']) + sijainti = (float(rivi['stop_lat']), float(rivi['stop_lon'])) + pysäkki = Pysäkki(rivi['stop_id'], rivi['stop_name'], sijainti) pysäkit[pysäkki.tunniste] = pysäkki -print('%d pysäkkiä' % len(pysäkit)) +with open('pysäkkialueet.json') as file: + for pysäkkitunniste, alue in json.load(file).items(): + pysäkit[pysäkkitunniste].alue = alue +print('%d pysäkkiä' % len(pysäkit), file = stderr) -print('Ladataan aikataulut... ', end = '', flush = True) +print('Ladataan aikataulut... ', end = '', flush = True, file = stderr) with open('gtfs/stop_times.txt') as file: rivimäärä = sum(line.count('\n') for line in file) laskettu = 0 @@ -193,5 +188,5 @@ ajo.reitti.append(Pysähdys(saapumisaika, lähtöaika, pysäkki, ajo)) laskettu += 1 if laskettu % 1000 == 0: - print('\rLadataan aikataulut... %.1f%%' % (laskettu * 100 / rivimäärä), end = ' ') -print('\rLadataan aikataulut... ladattu') \ No newline at end of file + print('\rLadataan aikataulut... %.1f%%' % (laskettu * 100 / rivimäärä), end = ' ', file = stderr) +print('\rLadataan aikataulut... ladattu', file = stderr) \ No newline at end of file diff -r 22c22ff63e66 -r 48efa8ca14dd misc.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/misc.py Tue Apr 18 14:59:18 2017 +0300 @@ -0,0 +1,11 @@ + +def lue_csv(tiedosto, muunnokset = None): + import csv + lukija = csv.reader(tiedosto) + otsakkeet = next(lukija) + for rivi in lukija: + tietue = dict(zip(otsakkeet, rivi)) + if muunnokset: + for avain, muunnos in muunnokset.items(): + tietue[avain] = muunnos(tietue[avain]) + yield tietue \ No newline at end of file diff -r 22c22ff63e66 -r 48efa8ca14dd palvelu.py --- a/palvelu.py Mon Apr 17 22:56:39 2017 +0300 +++ b/palvelu.py Tue Apr 18 14:59:18 2017 +0300 @@ -33,18 +33,37 @@ @app.route('/ajovuoro/') def ajoreitti(numero): + from flask import request from bussit import ajot ajovuoro = ajot[numero] + suppea = request.args.get('suppea') is not None reitti = [] + suppea_reitti = [] + käydyt_alueet = set() for pysähdys in ajovuoro.reitti: aika = datetime.combine(date.today(), time()) + pysähdys.saapumisaika + muotoiltu_aika = muotoile_aika(aika, suhteellinen = False) reitti.append({ - 'aika': muotoile_aika(aika, suhteellinen = False), + 'aika': muotoiltu_aika, 'tunniste': pysähdys.pysäkki.tunniste, + 'alue': pysähdys.pysäkki.alue, 'nimi': pysähdys.pysäkki.nimi, }) - return render_template('ajovuoro.html', reitti = reitti, numero = numero, - linja = ajovuoro.linja.viite, selite = ajovuoro.kyltti) + alue = pysähdys.pysäkki.alue + if alue: + if alue not in käydyt_alueet: + suppea_reitti.append({ + 'aika': muotoiltu_aika, + 'alue': alue + }) + käydyt_alueet.add(alue) + sivu = suppea and 'ajovuoro-suppea.html' or 'ajovuoro.html' + return render_template(sivu, reitti = reitti, suppea_reitti = suppea_reitti, + numero = numero, linja = ajovuoro.linja.viite, selite = ajovuoro.kyltti) if __name__ == '__main__': - app.run(debug = True) \ No newline at end of file + from argparse import ArgumentParser + parser = ArgumentParser() + parser.add_argument('-p', '--port', type = int, default = 5000) + args = parser.parse_args() + app.run(debug = True, port = args.port) \ No newline at end of file diff -r 22c22ff63e66 -r 48efa8ca14dd templates/ajovuoro-suppea.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/ajovuoro-suppea.html Tue Apr 18 14:59:18 2017 +0300 @@ -0,0 +1,74 @@ + + + + + + Ajovuoro #{{numero}}: {{linja}} {{selite}} + + +

Ajo {{numero}}: {{linja}} {{selite}}

+ + + + + + {% for rivi in suppea_reitti %} + + + + + {% endfor %} +
AikaAlue
{{rivi['aika']}}{{rivi['alue']}}
+ + \ No newline at end of file diff -r 22c22ff63e66 -r 48efa8ca14dd templates/ajovuoro.html --- a/templates/ajovuoro.html Mon Apr 17 22:56:39 2017 +0300 +++ b/templates/ajovuoro.html Tue Apr 18 14:59:18 2017 +0300 @@ -62,7 +62,8 @@ Aika Viite - Nimi + Nimi + Alue {% for rivi in reitti %} @@ -73,6 +74,9 @@ {{rivi['nimi']}} + + {{rivi['alue'] or ''}} + {% endfor %}