This file contains 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
# 国土数値情報から鉄道路線の座標データを抽出する。一定区間の塊を格納先の配列には部分配列として格納する。① | |
import json | |
from google.colab import files | |
# GeoJSONファイルのパス | |
file_path = '/content/drive/MyDrive/国土数値情報_鉄道/N02-22_RailroadSection.geojson' | |
# '東海道新幹線'の座標を保持するリスト | |
east_shinkansen_coords = [] |
This file contains 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
# 羽田からDallasまでの飛行ルートマップ風のアニメーションを描くスクリプト | |
# マジックコマンドを利用してPython上で生成から出力まで実行 | |
%%html | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Great Circle Animation</title> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
This file contains 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
#cartopyを用いて、国土数値情報を利用し特定の路線の経路を地図上に描写するスクリプト | |
import geopandas as gpd | |
import matplotlib.pyplot as plt | |
import cartopy.crs as ccrs | |
# .shpファイルの読み込み | |
shapefile_path = '/content/drive/MyDrive/国土数値情報_鉄道/N02-22_RailroadSection.shp' #shpファイルの場所を指定 | |
railways = gpd.read_file(shapefile_path, encoding='utf-8') |
This file contains 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
# 東海道新幹線のルートを青線で描写し、各駅にマーカーを立てるスクリプト(folium/GeoJSON) | |
import geopandas as gpd | |
import folium | |
# 東海道新幹線の経路データの読み込み | |
geojson_path = '/content/drive/MyDrive/国土数値情報_鉄道/N02-22_RailroadSection.geojson' # N02-22_RailroadSection.geojson の箇所を指定 | |
railways = gpd.read_file(geojson_path) | |
# 東海道新幹線の駅の情報が含まれる GeoJSON ファイルの読み込み |
This file contains 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
import folium | |
import numpy as np | |
#指定した2点間を球体である地球を考慮し最短経路で結ぶスクリプト(日付変更線を横切る) | |
# 球面三角法を使用して大円を計算する関数 | |
def great_circle_points(point1, point2, num_points): | |
lat1, lon1 = np.radians(point1) | |
lat2, lon2 = np.radians(point2) | |
# 球面三角法による角度(ラジアン)を計算 |
This file contains 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
import folium | |
# Dallasの緯度経度情報 | |
dallas_lat = 32.7767 | |
dallas_lon = -96.7970 | |
# 地図を作成(tilesを指定) | |
m = folium.Map(location=[dallas_lat, dallas_lon], zoom_start=10) | |
# m = folium.Map(location=[dallas_lat, dallas_lon], zoom_start=10, tiles='Stamen Terrain') |