From 69156584798b413dd45e1ef2a3f260d7e3944dca Mon Sep 17 00:00:00 2001 From: eudson7 <72505552+Eudson7@users.noreply.github.com> Date: Sat, 8 Jan 2022 17:32:31 -0300 Subject: [PATCH] Criado usando o Colaboratory --- ...mles_com_ponto_e_linha_usando_folium.ipynb | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 Mapa_interativo_muito_simles_com_ponto_e_linha_usando_folium.ipynb diff --git a/Mapa_interativo_muito_simles_com_ponto_e_linha_usando_folium.ipynb b/Mapa_interativo_muito_simles_com_ponto_e_linha_usando_folium.ipynb new file mode 100644 index 00000000..e3d2099f --- /dev/null +++ b/Mapa_interativo_muito_simles_com_ponto_e_linha_usando_folium.ipynb @@ -0,0 +1,121 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Mapa interativo muito simles com ponto e linha usando folium.ipynb", + "provenance": [], + "collapsed_sections": [], + "authorship_tag": "ABX9TyP1AUMp9HO8sf9i9c6FHvHE", + "include_colab_link": true + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "source": [ + "\n", + "Segue local da documentação da biblioteca folium: https://python-visualization.github.io/folium/" + ], + "metadata": { + "id": "O2zgACChVcNJ" + } + }, + { + "cell_type": "markdown", + "source": [ + "Primeiro deve-se instalar o biblioteca Folium" + ], + "metadata": { + "id": "kLZK2-FWUiJL" + } + }, + { + "cell_type": "code", + "metadata": { + "id": "NbgXqo2jcrms" + }, + "source": [ + "!pip install folium" + ], + "execution_count": null, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 763 + }, + "id": "w8vQquS4cZWS", + "outputId": "af85f8d3-e23b-4d30-d29a-66a386d0da41" + }, + "source": [ + "# importar biblioteca folium\n", + "import folium\n", + "\n", + "# criar lista de pontos em coordenadas latitude e longitude\n", + "#points = [[37.4601928, 126.4476917], [37.4593108, 126.4406957], [37.4611508, 126.4432957], [37.4641108, 126.4423957]]\n", + "points = [[-2.493696, -44.263902],[-2.494768, -44.261961],[-2.499173, -44.262842],[-2.499068, -44.267026],[-2.498071, -44.271961],[-2.494834, -44.271929]]\n", + "\n", + "# centro das coordenadas (calculo simples aproximado)\n", + "l = len(points)\n", + "l1=0\n", + "l2=0\n", + "for index,r in enumerate(points):\n", + " l1 = (points[index][0]+l1)\n", + " l2 = (points[index][1]+l2)\n", + "centro = [l1/l,l2/l]\n", + "\n", + "# criar mapa, indicar centro e o nivel de zoom\n", + "m = folium.Map(location=centro, zoom_start=15)\n", + "\n", + "# inserir pontos (maker)\n", + "for index,r in enumerate(points):\n", + " folium.Marker(points[index],\n", + " popup=('Ponto{} da lista'.format(index)),\n", + " icon = folium.Icon(color='green',icon='plus')).add_to(m)\n", + "\n", + "# inserir linhas\n", + "folium.PolyLine(points, color='red').add_to(m)\n", + "\n", + "# visualizar mapa\n", + "m" + ], + "execution_count": 267, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "execution_count": 267 + } + ] + } + ] +} \ No newline at end of file