1
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?

More than 1 year has passed since last update.

概要

paiza.ioでelixirやってみた。
api叩いて、住所から、緯度経度、求めてみた。

サンプルコード


:inets.start
:ssl.start


query = URI.encode_query(%{q: "山形県東置賜郡川西町"})
url = "https://msearch.gsi.go.jp/address-search/AddressSearch?" <> query
url = String.to_charlist(url)
{:ok, {_status, _headers, body}} = :httpc.request(url)
body
body = IO.iodata_to_binary(body)
body = String.replace(body, "\\", " ")
Regex.scan(~r/:\[(.+?)\]/, body)
#|> IO.inspect
|> Enum.map(fn [_, v] -> 
    IO.puts("( #{v})")
end)


実行結果

( 140.053177,38.005203)

成果物

以上。

1
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
1
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?