Skip to content

Commit

Permalink
Merge pull request #31 from SGCODEX/open-source-gis-tool
Browse files Browse the repository at this point in the history
 [25] - Added Area Served for 3+ Facilities & Updated Readme File
  • Loading branch information
SGCODEX authored Sep 24, 2024
2 parents 3878d2a + 3c7ca43 commit a69d0ae
Show file tree
Hide file tree
Showing 30 changed files with 1,652 additions and 746 deletions.
17 changes: 0 additions & 17 deletions Open-Source-GIS-Tool/Python_Code/Readme.md

This file was deleted.

341 changes: 341 additions & 0 deletions Open-Source-GIS-Tool/Python_Code/Trial.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,341 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"&lt;!DOCTYPE html&gt;\n",
"&lt;html&gt;\n",
"&lt;head&gt;\n",
" \n",
" &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;\n",
" \n",
" &lt;script&gt;\n",
" L_NO_TOUCH = false;\n",
" L_DISABLE_3D = false;\n",
" &lt;/script&gt;\n",
" \n",
" &lt;style&gt;html, body {width: 100%;height: 100%;margin: 0;padding: 0;}&lt;/style&gt;\n",
" &lt;style&gt;#map {position:absolute;top:0;bottom:0;right:0;left:0;}&lt;/style&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://code.jquery.com/jquery-1.12.4.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js&quot;&gt;&lt;/script&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css&quot;/&gt;\n",
" \n",
" &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
" &lt;style&gt;\n",
" #map_1a45a7666ffea91f9a3955544c2729b7 {\n",
" position: relative;\n",
" width: 100.0%;\n",
" height: 100.0%;\n",
" left: 0.0%;\n",
" top: 0.0%;\n",
" }\n",
" .leaflet-container { font-size: 1rem; }\n",
" &lt;/style&gt;\n",
" \n",
"&lt;/head&gt;\n",
"&lt;body&gt;\n",
" \n",
" \n",
" &lt;div class=&quot;folium-map&quot; id=&quot;map_1a45a7666ffea91f9a3955544c2729b7&quot; &gt;&lt;/div&gt;\n",
" \n",
"&lt;/body&gt;\n",
"&lt;script&gt;\n",
" \n",
" \n",
" var map_1a45a7666ffea91f9a3955544c2729b7 = L.map(\n",
" &quot;map_1a45a7666ffea91f9a3955544c2729b7&quot;,\n",
" {\n",
" center: [0, 0],\n",
" crs: L.CRS.EPSG3857,\n",
" zoom: 1,\n",
" zoomControl: true,\n",
" preferCanvas: false,\n",
" }\n",
" );\n",
"\n",
" \n",
"\n",
" \n",
" \n",
" var tile_layer_c1a9c8ff890f61c16ac0abe5866a8a9b = L.tileLayer(\n",
" &quot;https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
" {&quot;attribution&quot;: &quot;Data by \\u0026copy; \\u003ca target=\\&quot;_blank\\&quot; href=\\&quot;http://openstreetmap.org\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e, under \\u003ca target=\\&quot;_blank\\&quot; href=\\&quot;http://www.openstreetmap.org/copyright\\&quot;\\u003eODbL\\u003c/a\\u003e.&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 18, &quot;maxZoom&quot;: 18, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
" ).addTo(map_1a45a7666ffea91f9a3955544c2729b7);\n",
" \n",
" \n",
" var rectangle_89e7a7351d6406fc8249382d06dbcdec = L.rectangle(\n",
" [[28.6477626, 77.2250592], [28.6642405, 77.2434511]],\n",
" {&quot;bubblingMouseEvents&quot;: true, &quot;color&quot;: &quot;#3388ff&quot;, &quot;dashArray&quot;: null, &quot;dashOffset&quot;: null, &quot;fill&quot;: false, &quot;fillColor&quot;: &quot;#3388ff&quot;, &quot;fillOpacity&quot;: 0.2, &quot;fillRule&quot;: &quot;evenodd&quot;, &quot;lineCap&quot;: &quot;round&quot;, &quot;lineJoin&quot;: &quot;round&quot;, &quot;noClip&quot;: false, &quot;opacity&quot;: 1.0, &quot;smoothFactor&quot;: 1.0, &quot;stroke&quot;: true, &quot;weight&quot;: 3}\n",
" ).addTo(map_1a45a7666ffea91f9a3955544c2729b7);\n",
" \n",
"&lt;/script&gt;\n",
"&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
"<folium.folium.Map at 0x19b3e100220>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import folium\n",
"\n",
"# Create a map\n",
"m = folium.Map()\n",
"\n",
"# Create a rectangle object\n",
"bbox = folium.Rectangle([\n",
" [28.6477626, 77.2250592],\n",
" [28.6642405, 77.2434511]\n",
"])\n",
"\n",
"# Add the rectangle to the map\n",
"m.add_child(bbox)\n",
"\n",
"# Display the map\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b2896959c4af469f99f4a9ab3d60bb6f",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[28.6561681, 77.2342614], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title…"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import leafmap.foliumap\n",
"import folium\n",
"\n",
"\n",
"latitude = float(28.6561681)\n",
"longitude = float(77.2342614)\n",
"center_point = (latitude, longitude)\n",
"m = leafmap.Map(center=center_point, zoom=16)\n",
"\n",
"kw = {\n",
" \"color\": \"blue\",\n",
" \"line_cap\": \"round\",\n",
" \"fill\": True,\n",
" \"fill_color\": \"red\",\n",
" \"weight\": 5,\n",
" \"popup\": \"Tokyo, Japan\",\n",
" \"tooltip\": \"<strong>Click me!</strong>\",\n",
"}\n",
"\n",
"# Create a rectangle object\n",
"bbox = folium.Rectangle(\n",
" bounds=[[28.6477626, 77.2250592],[28.6642405, 77.2434511]],\n",
" **kw,\n",
" )\n",
"\n",
"# Add the rectangle to the map\n",
"m.add(bbox)\n",
"\n",
"# Display the map\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "fe54214e045c4bec83316b443899eae0",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m = leafmap.Map(zoom=1)\n",
"source = {\n",
" \"type\": \"geojson\",\n",
" \"data\": {\n",
" \"type\": \"Feature\",\n",
" \"properties\": {\"color\":\"#4dbd9a\"},\n",
" \"geometry\": {\n",
" \"type\": \"Polygon\",\n",
" \"coordinates\": [[[28.6477626, 77.2250592],[28.6642405, 77.2434511]]],\n",
" },\n",
" },\n",
"}\n",
"m.add_geojson(source)\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "85320d32f799409e8c83475b7e0133a2",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import leafmap\n",
"\n",
"# Define the polygon data\n",
"source = {\n",
" \"type\": \"geojson\",\n",
" \"data\": {\n",
" \"type\": \"Feature\",\n",
" \"properties\": {},\n",
" \"geometry\": {\n",
" \"type\": \"Polygon\",\n",
" \"coordinates\": [[[-30, -25], [-30, 35], [30, 35], [30, -25], [-30, -25]]],\n",
" },\n",
" },\n",
"}\n",
"\n",
"# Create a map\n",
"m = leafmap.Map(zoom=1)\n",
"\n",
"# Add the polygon with style options\n",
"style_options = {\n",
" \"color\": \"blue\", # Change this to your desired color\n",
" \"fill\": True, # Set fill to True to fill the polygon\n",
" \"fillColor\": \"lightblue\", # Change this to your desired fill color\n",
" \"weight\": 2, # Adjust the line weight\n",
" \"opacity\": 0.7 # Adjust the opacity of the polygon\n",
"}\n",
"\n",
"m.add_geojson(source, style_options=style_options)\n",
"\n",
"# Display the map\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b309b5ba81364914adb7f5507605e645",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Map(center=[46.7808, -96.0156], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'z…"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m = leafmap.Map(\n",
" center=[46.7808, -96.0156], zoom=12, toolbar_control=False, layers_control=True\n",
")\n",
"m.add_osm_from_point(\n",
" center_point=(46.7808, -96.0156),\n",
" tags={\"natural\": \"water\"},\n",
" dist=10000,\n",
" layer_name=\"Lakes\",\n",
")\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(\"Please enter the coordinates. Eg: For New Delhi (28.645307, 77.224662)\")\n",
"#Taking the map from the user\n",
"#latitude = float(input(\"Enter latitude: \"))\n",
"#longitude = float(input(\"Enter longitude: \"))\n",
"latitude = float(28.6561681)\n",
"longitude = float(77.2342614)\n",
"print(\"Entered:\",latitude, longitude)\n",
"center_point = (latitude, longitude)\n",
"G = ox.graph_from_point(center_point, dist=900, network_type='all')\n",
"nodes, edges = ox.graph_to_gdfs(G)\n",
"#gdf = ox.graph_to_gdfs(G)\n",
"bbox = edges.total_bounds\n",
"bbox1 = nodes.total_bounds\n",
"print(bbox)\n",
"print(bbox1)"
]
}
],
"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.10.9"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Open-Source-GIS-Tool/Python_Code/coordinates.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
latitude,longitude
28.6576419,77.2292175
28.6538828,77.2319103
28.6570721,77.2352708
Loading

0 comments on commit a69d0ae

Please sign in to comment.