Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
HusainRizvi786 authored Sep 16, 2021
0 parents commit 87095fc
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions web mapping.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 33,
"id": "4fff107e",
"metadata": {},
"outputs": [],
"source": [
"import folium\n",
"import pandas as pd\n",
"data = pd.read_csv(\"Volcanoes.txt\")\n",
"lat = list(data[\"LAT\"])\n",
"lon = list(data[\"LON\"])\n",
"elev = list(data[\"ELEV\"])\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "095370cb",
"metadata": {},
"outputs": [],
"source": [
"def color_producer(elevation):\n",
" if elevation <1500:\n",
" return 'red'\n",
" elif 1500 <= elevation < 3000:\n",
" return 'blue'\n",
" else:\n",
" return 'green'\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "b6f0b805",
"metadata": {},
"outputs": [],
"source": [
"map = folium.Map(location=[38.58, -99.08], zoom_start=6, titles=\"mapbox\")\n",
"fg = folium.FeatureGroup(name=\"My Map\")\n",
"\n",
"for lt, ln, el in zip(lat, lon, elev):\n",
" \n",
" fg.add_child(folium.Marker(location=[lt, ln], popup=str(el)+\"m\", icon=folium.Icon(color=color_producer(el))))\n",
"map.add_child(fg)\n",
"map.save(\"Map1.html\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "84d8b154",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.9.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 87095fc

Please sign in to comment.