0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

wslでelixir その180

Posted at

概要

wsl(wsl2じゃない)で、elixirやってみた。
練習問題やってみた。

練習問題

Livebookで、データフレームを使え。
新幹線の駅と路線の地図描いて見てみましょう。

参考にしたページ

写真

image.png

サンプルコード

df2 = Explorer.DataFrame.filter(df, 開業 == "1964-10-01")
df2 = Explorer.DataFrame.distinct(df2, ["駅名"])
map = Explorer.DataFrame.to_series(df2)
eki = Explorer.Series.to_list(map["駅名"])

line_coordinates = for i <- eki do
 	Oz.put(i)
 	m = Explorer.DataFrame.filter(df, 駅名 == Oz.get)
 	{
     Explorer.Series.to_list(m["経度"])
     |> Enum.at(0),
     Explorer.Series.to_list(m["緯度"])
     |> Enum.at(0)	
  }
end

MapLibre.new(center: {137.1, 34.9}, zoom: 6, style: :street)

|> MapLibre.add_source("route", type: :geojson, data: [type: "Feature", geometry: [type: "LineString",
      coordinates: line_coordinates]])

|> MapLibre.add_layer(id: "route", type: :line, source: "route", layout: [line_join: "round", line_cap: "round"],
  paint: [line_color: "#c22", line_width: 4])


以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?