{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## 畫出目前所在地" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "相關資料:\n", "\n", "* https://github.com/python-visualization/folium\n", "* https://github.com/DenisCarriere/geocoder\n", "* https://www.openstreetmap.org/" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip install -q folium\n", "!pip install -q geocoder" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 載入需要的模組\n", "import geocoder\n", "import folium" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 使用 geocoder 取得特定住址的 GPS 座標\n", "location = geocoder.osm('國立高雄師範大學').latlng" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# 顯示 GPS 座標\n", "location" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m = folium.Map(location=location, zoom_start=16)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "folium.Marker(location=location, popup='國立高雄師範大學').add_to(m)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "m" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }