Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 논문 리뷰
- convex
- numpy
- DCM
- 안전교육
- journal club
- python#yaml#가상환경#파이썬
- Expectation Maximization
- lccm
- latex#티스토리#tistory#대학원#논문#논문정리
- regret-minimization
- 닫힌 해
- 카이스트
- 옌센 부등식
- 젠센 부등식
- 티스토리챌린지
- em알고리즘#expectation maximization#algorithm
- 통계
- 볼록 함수
- Python
- EM 알고리즘
- 윤리 및 안전
- Closed Form
- discrete choice model
- jensen's inequality
- 대학원
- 연구
- 넘파이
- choice model
- 나비에 스토크스
Archives
- Today
- Total
대학원생 리암의 블로그
실제 도로 시각화 - OSMnx 본문
OSMnx는 Open Source Map networkx의 약자로 opensource map의 네트워크 정보를 networkx라는 파이썬 라이브러리를 통해 활용할 수 있게 해주는 library이다. 예제로 Piedmont의 데이터를 불러와서 두 점을 찍고 차로 이동할 수 있는 최단 거리를 계산하고 시각화 해보았다.
import networkx as nx
import osmnx as ox
# you can make query an unambiguous dict to help the geocoder find it
place = {"city": "Piedmont", "state": "California", "country": "USA"}
G = ox.graph_from_place(place, network_type="drive", truncate_by_edge=True)
# impute missing edge speeds and calculate edge travel times with the speed module
G = ox.routing.add_edge_speeds(G)
G = ox.routing.add_edge_travel_times(G)
# get the nearest network nodes to two lat/lng points with the distance module
orig = ox.distance.nearest_nodes(G, X=-122.245846, Y=37.828903)
dest = ox.distance.nearest_nodes(G, X=-122.215006, Y=37.812303)
# find the shortest path between nodes, minimizing travel time, then plot it
route = ox.shortest_path(G, orig, dest, weight="travel_time")
fig, ax = ox.plot_graph_route(G, route, node_size=0)
결과물은 다음과 같다.
공식 홈페이지에 추가 예제 코드들이 많아서 추후에 더 공부해보면 좋을 것 같다.
https://github.com/gboeing/osmnx-examples/tree/main/notebooks
'코딩' 카테고리의 다른 글
Selenium을 이용한 맛집 크롤링 (2) | 2024.11.30 |
---|---|
[최단거리 알고리즘] Bellman Ford, Floyd-Warshall, Dijkstra (1) | 2024.10.23 |
기본 numpy 함수들 (0) | 2024.09.05 |
[Expectation Maximization 알고리즘 직관적 이해] (1) | 2024.08.30 |
Python 가상 환경 빌드/import/export 하기 (1) | 2024.08.27 |