Last active
June 1, 2025 07:07
-
-
Save deton/8c4bd41faa4060dfa4a68066a5403be3 to your computer and use it in GitHub Desktop.
Display GTFS stop_times.txt using gtfs_kit and kepler.gl Trip Layer, pydeck TripsLayer, or folium TimestampedGeoJson
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Display GTFS stop_times.txt using folium TimestampedGeoJson\n", | |
"https://colab.research.google.com/drive/16eMpKeD2IJ45hAwNRm52G25BFNOI4LUz?usp=sharing" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"%pip install gtfs_kit" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>indicator</th>\n", | |
" <th>value</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>agencies</td>\n", | |
" <td>[ハマちゃんバス]</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>timezone</td>\n", | |
" <td>Asia/Tokyo</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>start_date</td>\n", | |
" <td>20230601</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>end_date</td>\n", | |
" <td>20260331</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>num_routes</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>num_trips</td>\n", | |
" <td>12</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>6</th>\n", | |
" <td>num_stops</td>\n", | |
" <td>31</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>num_shapes</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>8</th>\n", | |
" <td>sample_date</td>\n", | |
" <td>20230608</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>9</th>\n", | |
" <td>num_routes_active_on_sample_date</td>\n", | |
" <td>3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>10</th>\n", | |
" <td>num_trips_active_on_sample_date</td>\n", | |
" <td>12</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>11</th>\n", | |
" <td>num_stops_active_on_sample_date</td>\n", | |
" <td>20</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" indicator value\n", | |
"0 agencies [ハマちゃんバス]\n", | |
"1 timezone Asia/Tokyo\n", | |
"2 start_date 20230601\n", | |
"3 end_date 20260331\n", | |
"4 num_routes 3\n", | |
"5 num_trips 12\n", | |
"6 num_stops 31\n", | |
"7 num_shapes 3\n", | |
"8 sample_date 20230608\n", | |
"9 num_routes_active_on_sample_date 3\n", | |
"10 num_trips_active_on_sample_date 12\n", | |
"11 num_stops_active_on_sample_date 20" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"import gtfs_kit as gk\n", | |
"\n", | |
"# https://bustime.jp/GtfsAgency/gtfs_list?p1=14\n", | |
"url = 'https://api.gtfs-data.jp/v2/organizations/yokosukacity/feeds/hamachanbus/files/feed.zip'\n", | |
"feed = gk.read_feed(url, dist_units='m')\n", | |
"feed.describe()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"week = feed.get_first_week()\n", | |
"date = week[0] # Monday" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>stop_id</th>\n", | |
" <th>stop_name</th>\n", | |
" <th>platform_code</th>\n", | |
" <th>stop_lat</th>\n", | |
" <th>stop_lon</th>\n", | |
" <th>zone_id</th>\n", | |
" <th>location_type</th>\n", | |
" <th>parent_station</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>S1_1</td>\n", | |
" <td>追浜東団地集会所</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.309189</td>\n", | |
" <td>139.629466</td>\n", | |
" <td>S1_1</td>\n", | |
" <td>0</td>\n", | |
" <td>S1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>S1_2</td>\n", | |
" <td>追浜東団地集会所</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.309189</td>\n", | |
" <td>139.629466</td>\n", | |
" <td>S1_2</td>\n", | |
" <td>0</td>\n", | |
" <td>S1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>S2_1</td>\n", | |
" <td>パークハウス</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.310473</td>\n", | |
" <td>139.628737</td>\n", | |
" <td>S2_1</td>\n", | |
" <td>0</td>\n", | |
" <td>S2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>5</th>\n", | |
" <td>S2_2</td>\n", | |
" <td>パークハウス</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.310473</td>\n", | |
" <td>139.628737</td>\n", | |
" <td>S2_2</td>\n", | |
" <td>0</td>\n", | |
" <td>S2</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>7</th>\n", | |
" <td>S3_1</td>\n", | |
" <td>浜見台1丁目</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.309822</td>\n", | |
" <td>139.626619</td>\n", | |
" <td>S3_1</td>\n", | |
" <td>0</td>\n", | |
" <td>S3</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" stop_id stop_name platform_code stop_lat stop_lon zone_id \\\n", | |
"1 S1_1 追浜東団地集会所 <NA> 35.309189 139.629466 S1_1 \n", | |
"2 S1_2 追浜東団地集会所 <NA> 35.309189 139.629466 S1_2 \n", | |
"4 S2_1 パークハウス <NA> 35.310473 139.628737 S2_1 \n", | |
"5 S2_2 パークハウス <NA> 35.310473 139.628737 S2_2 \n", | |
"7 S3_1 浜見台1丁目 <NA> 35.309822 139.626619 S3_1 \n", | |
"\n", | |
" location_type parent_station \n", | |
"1 0 S1 \n", | |
"2 0 S1 \n", | |
"4 0 S2 \n", | |
"5 0 S2 \n", | |
"7 0 S3 " | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"dfstops = feed.get_stops(date)\n", | |
"dfstops.head()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"features = []\n", | |
"for st in dfstops.to_dict(orient='records'):\n", | |
" features.append({\n", | |
" 'type': 'Feature',\n", | |
" 'properties': {\n", | |
" 'name': f\"{st['stop_id']} {st['stop_name']}\",\n", | |
" 'icon': 'circle',\n", | |
" 'iconstyle': {\n", | |
" 'color': '#ff00ff',\n", | |
" 'radius': 4,\n", | |
" }\n", | |
" },\n", | |
" 'geometry': {\n", | |
" 'type': 'Point',\n", | |
" 'coordinates': [st['stop_lon'], st['stop_lat']],\n", | |
" }\n", | |
" })" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>trip_id</th>\n", | |
" <th>arrival_time</th>\n", | |
" <th>departure_time</th>\n", | |
" <th>stop_id</th>\n", | |
" <th>stop_sequence</th>\n", | |
" <th>stop_headsign</th>\n", | |
" <th>pickup_type</th>\n", | |
" <th>drop_off_type</th>\n", | |
" <th>stop_name</th>\n", | |
" <th>platform_code</th>\n", | |
" <th>stop_lat</th>\n", | |
" <th>stop_lon</th>\n", | |
" <th>zone_id</th>\n", | |
" <th>location_type</th>\n", | |
" <th>parent_station</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>R3+0+平日+1</td>\n", | |
" <td>10:29:00</td>\n", | |
" <td>10:29:00</td>\n", | |
" <td>S1_1</td>\n", | |
" <td>1</td>\n", | |
" <td><NA></td>\n", | |
" <td>0</td>\n", | |
" <td>1</td>\n", | |
" <td>追浜東団地集会所</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.309189</td>\n", | |
" <td>139.629466</td>\n", | |
" <td>S1_1</td>\n", | |
" <td>0</td>\n", | |
" <td>S1</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>R3+0+平日+1</td>\n", | |
" <td>10:32:00</td>\n", | |
" <td>10:32:00</td>\n", | |
" <td>S3_1</td>\n", | |
" <td>2</td>\n", | |
" <td><NA></td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>浜見台1丁目</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.309822</td>\n", | |
" <td>139.626619</td>\n", | |
" <td>S3_1</td>\n", | |
" <td>0</td>\n", | |
" <td>S3</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>R3+0+平日+1</td>\n", | |
" <td>10:34:00</td>\n", | |
" <td>10:34:00</td>\n", | |
" <td>S4_1</td>\n", | |
" <td>3</td>\n", | |
" <td><NA></td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>浜見台2丁目A</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.306984</td>\n", | |
" <td>139.628112</td>\n", | |
" <td>S4_1</td>\n", | |
" <td>0</td>\n", | |
" <td>S4</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>R3+0+平日+1</td>\n", | |
" <td>10:35:00</td>\n", | |
" <td>10:35:00</td>\n", | |
" <td>S5_1</td>\n", | |
" <td>4</td>\n", | |
" <td><NA></td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>浜見台2丁目B</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.306837</td>\n", | |
" <td>139.629605</td>\n", | |
" <td>S5_1</td>\n", | |
" <td>0</td>\n", | |
" <td>S5</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>R3+0+平日+1</td>\n", | |
" <td>10:36:00</td>\n", | |
" <td>10:36:00</td>\n", | |
" <td>S6_1</td>\n", | |
" <td>5</td>\n", | |
" <td><NA></td>\n", | |
" <td>0</td>\n", | |
" <td>0</td>\n", | |
" <td>ケアセンター</td>\n", | |
" <td><NA></td>\n", | |
" <td>35.308191</td>\n", | |
" <td>139.630542</td>\n", | |
" <td>S6_1</td>\n", | |
" <td>0</td>\n", | |
" <td>S6</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" trip_id arrival_time departure_time stop_id stop_sequence stop_headsign \\\n", | |
"0 R3+0+平日+1 10:29:00 10:29:00 S1_1 1 <NA> \n", | |
"1 R3+0+平日+1 10:32:00 10:32:00 S3_1 2 <NA> \n", | |
"2 R3+0+平日+1 10:34:00 10:34:00 S4_1 3 <NA> \n", | |
"3 R3+0+平日+1 10:35:00 10:35:00 S5_1 4 <NA> \n", | |
"4 R3+0+平日+1 10:36:00 10:36:00 S6_1 5 <NA> \n", | |
"\n", | |
" pickup_type drop_off_type stop_name platform_code stop_lat stop_lon \\\n", | |
"0 0 1 追浜東団地集会所 <NA> 35.309189 139.629466 \n", | |
"1 0 0 浜見台1丁目 <NA> 35.309822 139.626619 \n", | |
"2 0 0 浜見台2丁目A <NA> 35.306984 139.628112 \n", | |
"3 0 0 浜見台2丁目B <NA> 35.306837 139.629605 \n", | |
"4 0 0 ケアセンター <NA> 35.308191 139.630542 \n", | |
"\n", | |
" zone_id location_type parent_station \n", | |
"0 S1_1 0 S1 \n", | |
"1 S3_1 0 S3 \n", | |
"2 S4_1 0 S4 \n", | |
"3 S5_1 0 S5 \n", | |
"4 S6_1 0 S6 " | |
] | |
}, | |
"metadata": {}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"dfst = feed.get_stop_times(date)\n", | |
"dfst = dfst.merge(dfstops)\n", | |
"display(dfst.head())\n", | |
"tripsdict = dfst.groupby('trip_id').apply(lambda x: x.to_dict(orient='records'), include_groups=False).to_dict()\n", | |
"#tripsdict" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import datetime\n", | |
"datesec = int(datetime.datetime.fromisoformat(date).timestamp())\n", | |
"for trip_id, stop_times_list in tripsdict.items():\n", | |
" coords = []\n", | |
" times = []\n", | |
" stop_times_list.sort(key=lambda x: x['arrival_time'])\n", | |
" for st in stop_times_list:\n", | |
" timesec = datesec + gk.helpers.timestr_to_seconds(st['arrival_time'])\n", | |
" coords.append([st['stop_lon'], st['stop_lat']])\n", | |
" times.append(timesec * 1000)\n", | |
" if st.get('departure_time') and st['departure_time'] != st['arrival_time']:\n", | |
" timesec = datesec + gk.helpers.timestr_to_seconds(st['departure_time'])\n", | |
" coords.append([st['stop_lon'], st['stop_lat']])\n", | |
" times.append(timesec * 1000)\n", | |
" features.append({\n", | |
" 'type': 'Feature',\n", | |
" 'properties': {\n", | |
" 'name': trip_id,\n", | |
" 'times': times,\n", | |
" \"icon\": \"marker\",\n", | |
" \"iconstyle\": {\n", | |
" \"iconUrl\": 'https://deton.github.io/folium_tripslayer/bus.svg',\n", | |
" \"iconSize\": [24, 24],\n", | |
" \"iconAnchor\": [12, 12]\n", | |
" },\n", | |
" \"style\": {\n", | |
" \"color\": \"#ff00ff\",\n", | |
" },\n", | |
" 'tooltip': trip_id,\n", | |
" 'popup': trip_id,\n", | |
" },\n", | |
" 'geometry': {\n", | |
" 'type': 'LineString',\n", | |
" 'coordinates': coords,\n", | |
" }\n", | |
" })\n", | |
"geojson = {\n", | |
" 'type': 'FeatureCollection',\n", | |
" 'features': features,\n", | |
"}\n", | |
"#geojson" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import json\n", | |
"with open('gtfsStopsTimestamped.geojson', 'w', encoding='utf-8') as f:\n", | |
" json.dump(geojson, f, ensure_ascii=False)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"%pip install git+https://github.com/deton/folium_tripslayer.git" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"<!DOCTYPE html>\n", | |
"<html>\n", | |
"<head>\n", | |
" \n", | |
" <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\n", | |
" \n", | |
" <script>\n", | |
" L_NO_TOUCH = false;\n", | |
" L_DISABLE_3D = false;\n", | |
" </script>\n", | |
" \n", | |
" <style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>\n", | |
" <style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>\n", | |
" <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js"></script>\n", | |
" <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>\n", | |
" <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>\n", | |
" <script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>\n", | |
" <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css"/>\n", | |
" <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"/>\n", | |
" <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css"/>\n", | |
" <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css"/>\n", | |
" <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>\n", | |
" <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>\n", | |
" \n", | |
" <meta name="viewport" content="width=device-width,\n", | |
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />\n", | |
" <style>\n", | |
" #map_249907cf333f26e7f55cb8611e5fa199 {\n", | |
" position: relative;\n", | |
" width: 100.0%;\n", | |
" height: 100.0%;\n", | |
" left: 0.0%;\n", | |
" top: 0.0%;\n", | |
" }\n", | |
" .leaflet-container { font-size: 1rem; }\n", | |
" </style>\n", | |
" \n", | |
" <script src="https://cdn.jsdelivr.net/npm/[email protected]/iso8601.min.js"></script>\n", | |
" <script src="https://deton.github.io/Leaflet.TimeDimension/dist/leaflet.timedimension.min.js"></script>\n", | |
" <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>\n", | |
" <script src="https://deton.github.io/folium_tripslayer/leaflet.timedimension.layer.geojsonwhole.js"></script>\n", | |
" <script src="https://deton.github.io/folium_tripslayer/leaflet.timedimension.layer.trips.js"></script>\n", | |
" <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css"/>\n", | |
" <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.timedimension.control.css"/>\n", | |
"</head>\n", | |
"<body>\n", | |
" \n", | |
" \n", | |
" <div class="folium-map" id="map_249907cf333f26e7f55cb8611e5fa199" ></div>\n", | |
" \n", | |
"</body>\n", | |
"<script>\n", | |
" \n", | |
" \n", | |
" var map_249907cf333f26e7f55cb8611e5fa199 = L.map(\n", | |
" "map_249907cf333f26e7f55cb8611e5fa199",\n", | |
" {\n", | |
" center: [35.3091888465196, 139.629465989449],\n", | |
" crs: L.CRS.EPSG3857,\n", | |
" ...{\n", | |
" "zoom": 15,\n", | |
" "zoomControl": true,\n", | |
" "preferCanvas": false,\n", | |
"}\n", | |
"\n", | |
" }\n", | |
" );\n", | |
"\n", | |
" \n", | |
"\n", | |
" \n", | |
" \n", | |
" var tile_layer_be2bce1bfccdef0f95098478c5877c4a = L.tileLayer(\n", | |
" "https://tile.openstreetmap.org/{z}/{x}/{y}.png",\n", | |
" {\n", | |
" "minZoom": 0,\n", | |
" "maxZoom": 19,\n", | |
" "maxNativeZoom": 19,\n", | |
" "noWrap": false,\n", | |
" "attribution": "\\u0026copy; \\u003ca href=\\"https://www.openstreetmap.org/copyright\\"\\u003eOpenStreetMap\\u003c/a\\u003e contributors",\n", | |
" "subdomains": "abc",\n", | |
" "detectRetina": false,\n", | |
" "tms": false,\n", | |
" "opacity": 1,\n", | |
"}\n", | |
"\n", | |
" );\n", | |
" \n", | |
" \n", | |
" tile_layer_be2bce1bfccdef0f95098478c5877c4a.addTo(map_249907cf333f26e7f55cb8611e5fa199);\n", | |
" \n", | |
" \n", | |
" L.Control.TimeDimensionCustom = L.Control.TimeDimension.extend({\n", | |
" _getDisplayDateFormat: function(date){\n", | |
" var newdate = new moment(date);\n", | |
" //console.log(newdate)\n", | |
" return newdate.format("YYYY-MM-DD HH:mm:ss");\n", | |
" }\n", | |
" });\n", | |
" map_249907cf333f26e7f55cb8611e5fa199.timeDimension = L.timeDimension(\n", | |
" {\n", | |
" period: "PT1M",\n", | |
" }\n", | |
" );\n", | |
" var timeDimensionControl = new L.Control.TimeDimensionCustom(\n", | |
" {"auto_play": true, "loop_button": false, "max_speed": 10, "min_speed": 0.1, "player_options": {"loop": false, "startOver": true, "transitionTime": 400}, "position": "bottomleft", "speed_slider": true, "time_slider_drag_update": false}\n", | |
" );\n", | |
" map_249907cf333f26e7f55cb8611e5fa199.addControl(this.timeDimensionControl);\n", | |
"\n", | |
" var tripsLayer = L.timeDimension.layer.trips();\n", | |
" tripsLayer.addTripsLayers(\n", | |
" map_249907cf333f26e7f55cb8611e5fa199,\n", | |
" {"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"name": "S1_1 \\u8ffd\\u6d5c\\u6771\\u56e3\\u5730\\u96c6\\u4f1a\\u6240", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.629465989449, 35.3091888465196]}}, {"type": "Feature", "properties": {"name": "S1_2 \\u8ffd\\u6d5c\\u6771\\u56e3\\u5730\\u96c6\\u4f1a\\u6240", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.629465989449, 35.3091888465196]}}, {"type": "Feature", "properties": {"name": "S2_1 \\u30d1\\u30fc\\u30af\\u30cf\\u30a6\\u30b9", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.628736833672, 35.3104734056088]}}, {"type": "Feature", "properties": {"name": "S2_2 \\u30d1\\u30fc\\u30af\\u30cf\\u30a6\\u30b9", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.628736833672, 35.3104734056088]}}, {"type": "Feature", "properties": {"name": "S3_1 \\u6d5c\\u898b\\u53f0\\uff11\\u4e01\\u76ee", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.626618982737, 35.3098223806385]}}, {"type": "Feature", "properties": {"name": "S3_2 \\u6d5c\\u898b\\u53f0\\uff11\\u4e01\\u76ee", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.626618982737, 35.3098223806385]}}, {"type": "Feature", "properties": {"name": "S4_1 \\u6d5c\\u898b\\u53f0\\uff12\\u4e01\\u76ee\\uff21", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.628112024185, 35.306984196272]}}, {"type": "Feature", "properties": {"name": "S4_2 \\u6d5c\\u898b\\u53f0\\uff12\\u4e01\\u76ee\\uff21", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.628112024185, 35.306984196272]}}, {"type": "Feature", "properties": {"name": "S5_1 \\u6d5c\\u898b\\u53f0\\uff12\\u4e01\\u76ee\\uff22", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.629604959444, 35.3068366829395]}}, {"type": "Feature", "properties": {"name": "S5_2 \\u6d5c\\u898b\\u53f0\\uff12\\u4e01\\u76ee\\uff22", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.629604959444, 35.3068366829395]}}, {"type": "Feature", "properties": {"name": "S6_1 \\u30b1\\u30a2\\u30bb\\u30f3\\u30bf\\u30fc", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.630542326811, 35.3081907229082]}}, {"type": "Feature", "properties": {"name": "S6_2 \\u30b1\\u30a2\\u30bb\\u30f3\\u30bf\\u30fc", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.630542326811, 35.3081907229082]}}, {"type": "Feature", "properties": {"name": "S7_1 \\u8ffd\\u6d5c\\u6771\\u753a\\uff11\\u4e01\\u76ee", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.63248650319, 35.3108206884306]}}, {"type": "Feature", "properties": {"name": "S7_2 \\u8ffd\\u6d5c\\u6771\\u753a\\uff11\\u4e01\\u76ee", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.63248650319, 35.3108206884306]}}, {"type": "Feature", "properties": {"name": "S8_1 \\u30eb\\u30cd\\u8ffd\\u6d5c", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.633111386316, 35.3124437872117]}}, {"type": "Feature", "properties": {"name": "S8_2 \\u30eb\\u30cd\\u8ffd\\u6d5c", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.633111386316, 35.3124437872117]}}, {"type": "Feature", "properties": {"name": "S9_1 \\u8ffd\\u6d5c\\u99c5\\uff08\\u964d\\u8eca\\uff09", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.62708642052743, 35.31633967944443]}}, {"type": "Feature", "properties": {"name": "S9_2 \\u8ffd\\u6d5c\\u99c5\\uff08\\u4e57\\u8eca\\uff09", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.62641987091095, 35.316293190801034]}}, {"type": "Feature", "properties": {"name": "S10_1 \\u6a2a\\u6d5c\\u5357\\u5171\\u6e08\\u75c5\\u9662", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.62203561756, 35.3204373901619]}}, {"type": "Feature", "properties": {"name": "S11_1 \\u8ffd\\u6d5c\\u9280\\u5ea7\\u901a\\u308a\\u5546\\u5e97\\u4f1a", "icon": "circle", "iconstyle": {"color": "#ff00ff", "radius": 4}}, "geometry": {"type": "Point", "coordinates": [139.628424113353, 35.3167226977435]}}, {"type": "Feature", "properties": {"name": "R1+0+\\u5e73\\u65e5+1", "times": [1685920980000, 1685921040000, 1685921220000, 1685921340000, 1685921400000, 1685921460000, 1685921520000, 1685921700000, 1685922000000, 1685922360000, 1685922720000, 1685922780000, 1685922960000, 1685923080000, 1685923140000, 1685923200000, 1685923260000, 1685923380000, 1685923560000, 1685923620000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R1+0+\\u5e73\\u65e5+1", "popup": "R1+0+\\u5e73\\u65e5+1"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.628736833672, 35.3104734056088], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.633111386316, 35.3124437872117], [139.62708642052743, 35.31633967944443], [139.62203561756, 35.3204373901619], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R1+0+\\u5e73\\u65e5+2", "times": [1685923680000, 1685923740000, 1685923920000, 1685924040000, 1685924100000, 1685924160000, 1685924220000, 1685924400000, 1685924700000, 1685925120000, 1685925540000, 1685925600000, 1685925780000, 1685925900000, 1685925960000, 1685926020000, 1685926080000, 1685926200000, 1685926380000, 1685926440000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R1+0+\\u5e73\\u65e5+2", "popup": "R1+0+\\u5e73\\u65e5+2"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.628736833672, 35.3104734056088], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.633111386316, 35.3124437872117], [139.62708642052743, 35.31633967944443], [139.62203561756, 35.3204373901619], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R2+0+\\u5e73\\u65e5+1", "times": [1685926860000, 1685926920000, 1685926980000, 1685927040000, 1685927220000, 1685927520000, 1685927580000, 1685927640000, 1685927820000, 1685927940000, 1685928000000, 1685928060000, 1685928120000, 1685928240000, 1685928420000, 1685928480000, 1685926500000, 1685926560000, 1685926740000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R2+0+\\u5e73\\u65e5+1", "popup": "R2+0+\\u5e73\\u65e5+1"}, "geometry": {"type": "LineString", "coordinates": [[139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.633111386316, 35.3124437872117], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196], [139.629465989449, 35.3091888465196], [139.628736833672, 35.3104734056088], [139.626618982737, 35.3098223806385]]}}, {"type": "Feature", "properties": {"name": "R2+0+\\u5e73\\u65e5+2", "times": [1685930580000, 1685930640000, 1685930820000, 1685930940000, 1685931000000, 1685931060000, 1685931120000, 1685931300000, 1685931600000, 1685931660000, 1685931720000, 1685931900000, 1685932020000, 1685932080000, 1685932140000, 1685932200000, 1685932320000, 1685932500000, 1685932560000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R2+0+\\u5e73\\u65e5+2", "popup": "R2+0+\\u5e73\\u65e5+2"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.628736833672, 35.3104734056088], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.633111386316, 35.3124437872117], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R2+0+\\u5e73\\u65e5+3", "times": [1685937960000, 1685938020000, 1685938200000, 1685938320000, 1685938380000, 1685938440000, 1685938500000, 1685938680000, 1685938980000, 1685939040000, 1685939100000, 1685939280000, 1685939400000, 1685939460000, 1685939520000, 1685939580000, 1685939640000, 1685939820000, 1685939880000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R2+0+\\u5e73\\u65e5+3", "popup": "R2+0+\\u5e73\\u65e5+3"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.628736833672, 35.3104734056088], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.633111386316, 35.3124437872117], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R2+0+\\u5e73\\u65e5+4", "times": [1685939940000, 1685940000000, 1685940180000, 1685940300000, 1685940360000, 1685940420000, 1685940480000, 1685940660000, 1685940960000, 1685941020000, 1685941080000, 1685941260000, 1685941380000, 1685941440000, 1685941500000, 1685941560000, 1685941620000, 1685941800000, 1685941860000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R2+0+\\u5e73\\u65e5+4", "popup": "R2+0+\\u5e73\\u65e5+4"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.628736833672, 35.3104734056088], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.633111386316, 35.3124437872117], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R2+0+\\u5e73\\u65e5+5", "times": [1685944080000, 1685944140000, 1685944320000, 1685944440000, 1685944500000, 1685944560000, 1685944620000, 1685944800000, 1685945100000, 1685945160000, 1685945220000, 1685945400000, 1685945520000, 1685945580000, 1685945640000, 1685945700000, 1685945760000, 1685945940000, 1685946000000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R2+0+\\u5e73\\u65e5+5", "popup": "R2+0+\\u5e73\\u65e5+5"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.628736833672, 35.3104734056088], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.633111386316, 35.3124437872117], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R2+0+\\u5e73\\u65e5+6", "times": [1685948220000, 1685948280000, 1685948460000, 1685948580000, 1685948640000, 1685948700000, 1685948760000, 1685948940000, 1685949240000, 1685949300000, 1685949360000, 1685949540000, 1685949660000, 1685949720000, 1685949780000, 1685949840000, 1685949900000, 1685950080000, 1685950140000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R2+0+\\u5e73\\u65e5+6", "popup": "R2+0+\\u5e73\\u65e5+6"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.628736833672, 35.3104734056088], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.633111386316, 35.3124437872117], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R3+0+\\u5e73\\u65e5+1", "times": [1685928540000, 1685928720000, 1685928840000, 1685928900000, 1685928960000, 1685929020000, 1685929320000, 1685929380000, 1685929440000, 1685929620000, 1685929740000, 1685929800000, 1685929860000, 1685929920000, 1685930040000, 1685930220000, 1685930280000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R3+0+\\u5e73\\u65e5+1", "popup": "R3+0+\\u5e73\\u65e5+1"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R3+0+\\u5e73\\u65e5+2", "times": [1685932620000, 1685932800000, 1685932920000, 1685932980000, 1685933040000, 1685933100000, 1685933400000, 1685933460000, 1685933520000, 1685933700000, 1685933820000, 1685933880000, 1685933940000, 1685934000000, 1685934120000, 1685934300000, 1685934360000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R3+0+\\u5e73\\u65e5+2", "popup": "R3+0+\\u5e73\\u65e5+2"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R3+0+\\u5e73\\u65e5+3", "times": [1685942100000, 1685942280000, 1685942400000, 1685942460000, 1685942520000, 1685942580000, 1685942880000, 1685942940000, 1685943000000, 1685943180000, 1685943300000, 1685943360000, 1685943420000, 1685943480000, 1685943540000, 1685943720000, 1685943780000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R3+0+\\u5e73\\u65e5+3", "popup": "R3+0+\\u5e73\\u65e5+3"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}, {"type": "Feature", "properties": {"name": "R3+0+\\u5e73\\u65e5+4", "times": [1685946240000, 1685946420000, 1685946540000, 1685946600000, 1685946660000, 1685946720000, 1685947020000, 1685947080000, 1685947140000, 1685947320000, 1685947440000, 1685947500000, 1685947560000, 1685947620000, 1685947680000, 1685947860000, 1685947920000], "icon": "marker", "iconstyle": {"iconUrl": "https://deton.github.io/folium_tripslayer/bus.svg", "iconSize": [24, 24], "iconAnchor": [12, 12]}, "style": {"color": "#ff00ff"}, "tooltip": "R3+0+\\u5e73\\u65e5+4", "popup": "R3+0+\\u5e73\\u65e5+4"}, "geometry": {"type": "LineString", "coordinates": [[139.629465989449, 35.3091888465196], [139.626618982737, 35.3098223806385], [139.628112024185, 35.306984196272], [139.629604959444, 35.3068366829395], [139.630542326811, 35.3081907229082], [139.63248650319, 35.3108206884306], [139.62708642052743, 35.31633967944443], [139.62641987091095, 35.316293190801034], [139.628424113353, 35.3167226977435], [139.633111386316, 35.3124437872117], [139.63248650319, 35.3108206884306], [139.630542326811, 35.3081907229082], [139.629604959444, 35.3068366829395], [139.628112024185, 35.306984196272], [139.626618982737, 35.3098223806385], [139.628736833672, 35.3104734056088], [139.629465989449, 35.3091888465196]]}}]},\n", | |
" "PT4M",\n", | |
" "PT1M",\n", | |
" false,\n", | |
" false\n", | |
" );\n", | |
" \n", | |
" \n", | |
" tile_layer_be2bce1bfccdef0f95098478c5877c4a.addTo(map_249907cf333f26e7f55cb8611e5fa199);\n", | |
" \n", | |
"</script>\n", | |
"</html>\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>" | |
], | |
"text/plain": [ | |
"<folium.folium.Map at 0x2096aedf410>" | |
] | |
}, | |
"execution_count": 9, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"import folium\n", | |
"import folium.plugins\n", | |
"from folium_tripslayer import TripsLayer\n", | |
"\n", | |
"latlon = [dfst.at[0, 'stop_lat'], dfst.at[0, 'stop_lon']]\n", | |
"m = folium.Map(location=latlon, zoom_start=15)\n", | |
"\n", | |
"TripsLayer(geojson, loop=False, period=\"PT1M\", duration=\"PT4M\").add_to(m)\n", | |
"m.save('gtfsStopsTime.html')\n", | |
"m" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": ".venv", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.11.9" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
View raw
(Sorry about that, but we can’t show files that are this big right now.)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment