Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
検証!会津は本当に地盤が硬いのか?
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
noharu36
December 01, 2025
Programming
42
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
検証!会津は本当に地盤が硬いのか?
noharu36
December 01, 2025
More Decks by noharu36
See All by noharu36
皆さんはHaskellをご存知です_しかし皆さんはHaskellが読めません_.pdf
noharu36
0
54
自作オブジェクトストレージをRustで
noharu36
0
89
ファミコンに思いを馳せる〜エミュレータ自作を添えて〜
noharu36
0
46
shell自作した話
noharu36
0
41
Rustを布教したい
noharu36
0
58
neofetchよ、永遠に
noharu36
0
43
ISSの軌道計算をRustで
noharu36
0
44
Other Decks in Programming
See All in Programming
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
280
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
350
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
contenteditable と日本語入力に向き合う
colorful12
0
200
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
[JA] Domain Modeling with Vanilla Rails: 「操作」から再考するRailsの設計論
yasaichi
3
440
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
35
17k
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
710
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
180
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Workers Cache を知る
syumai
0
370
Featured
See All Featured
How to Ace a Technical Interview
jacobian
280
24k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.8k
A Soul's Torment
seathinner
8
3.8k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
430
The Curse of the Amulet
leimatthew05
3
16k
4 Signs Your Business is Dying
shpigford
187
23k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
520
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
730
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.2k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
950
The Curious Case for Waylosing
cassininazir
1
570
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
940
Transcript
検証!会津は本当に地盤が硬いのか? 学部2年 harukun
自己紹介 { name: 能島明希 handle: harukun origin: 広島->岡山->大阪->東京->会津 tech: {
front-end: React+TS backend: Rust, Go etc: Rust, Haskell Rust: Rust } favorites: Game, Tobacco, BoyScout, Rust, Neovim Twitter(x): https://twitter.com/pieceofharuki Blog: https://zenn.dev/haru_blog }
会津、地盤硬いってよく言われる気がする ... それ本当?
技術スタック
[dependencies] reqwest = { version = "0.12.9", features = ["json"]
} tokio = { version = "1.41.1", features = ["full"] } serde = { version = "1.0.215", features = ["derive"] } serde_json = "1.0.133" chrono = {version = "0.4.38", features = ["serde"] } scraper = "0.21.0" plotters = "0.3.7" geojson = "0.24.1" geo-types = "0.7.14" 使用した外部クレート
説明 • requwest: HTTPリクエストを送信するためのライブラリ • tokio: 非同期処理をするためのライブラリ • serde, serde_json:
シリアライズ、デシリアライズを行うためのライブラリ • chrono: 時刻を扱うライブラリ • scraper: スクレイピングをするためのライブラリ • plotters:いわゆる描画ライブラリ。いろんな形式をサポートしている • geojson: GeoJsonを読み込むためのライブラリ • geo-types: Rustで地理空間情報を扱うための基本的なデータ型と構造体を提供するライブラリ
やりたいこと (それなりの大きさの)地震は複数の観測点を持つ 同じ震度を観測した観測点は(概ね)(例外はあるが)(一概には言えないが)扇形の弧のように並ぶはず 同じ震度の点を繋いで、その線の内側を震度ごとに色分けして、複数の地震の情報を重ねてあげれば、地震が 多い||強い揺れをよく観測する地域は濃い色に、地震が少ない ||小さな揺れのみを観測している地域は薄い色 になるはず 色分けは、単純に震度で考えると間違っているので(震度6は震度3の倍の強さではない) Galで計算してあげれ ば論理的に色分けできる気がする
いめーじ
が... 扇形の弧、どうやって求めんねん! 作れたとしても、その弧どうやって描画すんねん! 弧の内側どうやって描画すんねん! となったので一旦断念 とりあえず都道府県ごとに色付けしてみることにする
気象庁の地震速報 参考: https://www.p2pquake.net/develop/json_api_v2 async fn main() -> Result<(), Box<dyn std::error::Error>>
{ create_point_list().await?; let url = "https://api.p2pquake.net/v2/jma/quake"; let params = [ ("limit", "100"), ("order", "-1"), ("quake_type", "ScalePrompt"), ("min_scale", "20"), ]; let client = reqwest::Client::new(); let response = client .get(url) .query(¶ms) .header("accept", "application/json") .send() .await?; let json: serde_json::Value = response.json().await?; let quakes = parse_json(json)?; Ok(()) } apiを叩いて、とってきたJsonをstructに変換する
震度観測点と座標の変換 地震速報では震度観測点名称しかわからないので、気象庁のサ イトをスクレイピングして震度間測定名と座標を対応づける 変換した値はグローバル変数で保持 #[derive(Debug, Default, Deserialize, Clone)] pub struct
Addr { pub addr: String, pub latitude: f64, pub longitude: f64, } pub static POINT_MAP: OnceLock<HashMap<String, Addr>> = OnceLock::new();
{ "quakes": [ "Quake": { "time": "2024-12-09T21:00:00", "points": [ {
"location": { "addr": "九戸郡洋野町種市第23地割27(洋野町役場種市庁舎)", "latitude": 40.40833333333333, "longitude": 141.71833333333333 }, "scale": 30 }, { "location": { "addr": "八幡平市大更第35地割62(旧八幡平市役所西根総合支所)", "latitude": 39.92666666666667, "longitude": 141.095 }, "scale": 30 } ] } ] } #[derive(Deserialize, Debug)] pub struct Quake { #[serde(deserialize_with = "deserialize_naive_date_time_from_str")] pub time: NaiveDateTime, #[serde(deserialize_with = "create_point")] pub points: Vec<Point>, } #[derive(Deserialize, Debug)] pub struct Point { pub location: Addr, pub scale: usize, } 取得したデータの例→
日本地図の描画 geojsonという形式のデータを持ってきて、それを描画ライブラリでこねこねすると (理論上)日本地図が描画できてかつ都道府県と描画エリア(ポリゴン)を対応づけられる
なんかうまくいかない ...
なんとか解決しようと試みるも ... なんだか小島のあたりで縦線が沢山生じているので描画方法を変えてみた → うまく行きそうなので小島かどうかの判別(描画方法の決定) をする関数を書いた fn decide_area_or_line(v: &Vec<(f64, f64)>)
-> bool { let (min_x, max_x, min_y, max_y) = v.iter().fold( (f64::INFINITY, f64::NEG_INFINITY, f64::INFINITY, f64::NEG_INFINITY), |(acc_min_x, acc_max_x, acc_min_y, acc_max_y), &(x, y)| { ( acc_min_x.min(x), acc_max_x.max(x), acc_min_y.min(y), acc_max_y.max(y), ) }, ); let diff_x = max_x - min_x; let diff_y = max_y - min_y; if diff_x >= 1.0 || diff_y >= 1.0 { return true } false }
うまくいかない ... 小島はうまく描画できているっぽい? 東京近辺と大阪近辺で描画が失敗している
今後の展望 なんとかうまいこと日本地図を描画できるようにしたい →それができればとってきた地震のデータを描画して、都道府県に紐づけるのは簡単 とりあえず都道府県ごとに色分けして表示できるようにしたい 大LTまでに完成させるかも。でも浮気して別のことやるかも