728x90
kibana๋ฅผ ํ์ฉํ์ฌ ์์ธ์ ๊ณต๊ณต๋ฐ์ดํฐ ์๊ฐํ
โ ์ฌ์ฉํ ๊ณต๊ณต๋ฐ์ดํฐ
https://data.seoul.go.kr/dataList/OA-20883/S/1/datasetView.do
์ด๋ฆฐ๋ฐ์ดํฐ๊ด์ฅ ๋ฉ์ธ
๋ฐ์ดํฐ๋ถ๋ฅ,๋ฐ์ดํฐ๊ฒ์,๋ฐ์ดํฐํ์ฉ
data.seoul.go.kr
ํด๋น ๊ณต๊ณต๋ฐ์ดํฐ์ Open API๋ฅผ ํ์ฉํ๋ค.
์ธ์ฆํค๋ฅผ ๋ฐ๊ธ๋ฐ๋๋ค.
โ ํ์ด์ฌ์ ์ด์ฉํ Open API ์คํ
requests ๋ชจ๋ ์ค์น
sudo apt install python3-pip
pip install requests
bulk API๋ฅผ ํ์ฉํ๋ ํ์ด์ฌ ํ์ผ ์์ฑ
import urllib.request
from xml.etree.ElementTree import fromstring, ElementTree
from elasticsearch import Elasticsearch, helpers
es = Elasticsearch()
docs = []
for i in range (1, 21):
iStart = (i-l)*1000 + 1
iEnd = i*1000
url = 'http://openapi.seoul.go.kr: 8088/(((์ธ์ฆํค)))/xml/TbPublicWifiInfo/'+str(iStart)+'/'+str(iEnd)+'/'
response = urllib.request.urlopen(url)
xml_str = response.read().decode('utf-8')
tree = ElementTree(fromstring(xml_str))
root = tree.getroot()
for row in root.iter("row"):
gu_nm = row.find('X_SWIFI_WRDOFC').text
place_nm = row.find('X_SWIFI_MAIN_NM').text
place_x = float(row.find('LAT').text)
place_y = float(row. find(' LNT'). text)
doc = {
".index": "seoulwifi2",
"_source": {
"gu_nm": gu_nm,
"place_nm": place_nm,
"instl_xy": {
"lat": piace_x,
"lon": place_y
}
}
}
docs.append(doc)
print("END", iStart, "~"๏ผiEnd)
res = helpers.bulk(es, docs)
print("END")
๋ณธ์ธ์ ์ธ์ฆํค๋ฅผ url์ ๋ฃ์ด์ ์์ฑํ๋ค.
โ ํ์ด์ฌ์ elasticsearch client ์ค์น
pip install elasticsearch
โ ํ๊ธ ๋ถ์๊ธฐ, ์๊ฒฝ๋ ๋ฐ์ดํฐ ํ์ ์ด์ฉํ๊ธฐ ์ํ ์ธ๋ฑ์ค ๋งคํ
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-nori
sudo systemctl restart elasticsearch
nori ์ค์น ๋ฐ es ์ฌ์คํ
โ elastic์์ ๋ฏธ๋ฆฌ ์ธ๋ฑ์ค๋ฅผ ์์ฑ

PUT seoulwifi2
{
"settings": {
"analysis": {
"analyzer": {
"korean":{
"tokenizer": "nori_tokenizer"
}
}
}
},
"mappings": {
"properties": {
"gu_nm": {"type": "keyword"},
"place_nm": {"type": "text", "analyzer": "korean"},
"instl_xy": {"type": "geo_point"}
}
}
}
โ ์ธ๋ฑ์ค ํจํด ์์ฑ
elastic - Stack Manager - Index Patterns - Create New Pattern

seoulwifi* ๋ก ์ธ๋ฑ์ค ํจํด ์์ฑ
โ Dev tools ์ GET์ผ๋ก ํ์ธ


๊ฐ์๊ฐ ์ข ๋ถ์กฑํ๋ค....
โ ์๊ฐํ
elastic - Visualize Library - Create visualize - Explore options - Coordinate Map



์์ฑํ ์ธ๋ฑ์ค ํจํด์ ํ์ฉํ์ฌ ์์ฑ

์๊ฐํ๋ ๋๋ค....
728x90
'Linux' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [Linux] ๋ ธ๋์ CPU ์ฌ์ฉ๋ฅ ๋น๊ตํ๊ธฐ (sar ๋ช ๋ น์ด) (2) | 2024.01.08 |
|---|---|
| [Linux] ๊ฐ์ ๋คํธ์ํฌ & ๊ฐ์๋จธ์ ์์ฑ (0) | 2024.01.02 |
| [Linux] ๊ฐ์๋จธ์ ์ปค์คํฐ๋ง์ด์ง (๊ณต๊ฐํค ssh ์ ์) (0) | 2024.01.01 |
| [Linux] OpenStack์ผ๋ก ํด๋ผ์ฐ๋ ํ๊ฒฝ ๊ตฌ์ฑํ๊ธฐ (Ubuntu) (1) | 2023.12.20 |
| [Linux] OpenStack์ผ๋ก ํด๋ผ์ฐ๋ ํ๊ฒฝ ๊ตฌ์ฑํ๊ธฐ (CentOS7) (1) | 2023.12.20 |