This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read_file --> Geopandas library uses fiona library which in turn uses GDAL/OGR | |
world = gpd.read_file("C:/GIS/GIS Data/countries/ne_50m_admin_0_countries.shp") | |
cities = gpd.read_file(gpd.datasets.get_path('naturalearth_cities')) | |
# Ploting to check the shapefile | |
base = world.plot(color='grey') | |
cities.plot(ax=base, marker='*', color='red', markersize=12); | |
plt.show() |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import pandas as pd\n", | |
"import geopandas as gpd\n", |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Read the data- Read Countries --> Geopackage Format | |
shp = '1-introData/countries.gpkg' | |
countries = gpd.read_file(shp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
countries.crs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First 5 rows | |
countries.head() | |
# Rows and columns of the countries data | |
countries.shape | |
# Describtive statistics of the countries data | |
countries.describe() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 2. Read Cities --> Geojson Format | |
cities = gpd.read_file('1-introData/cities.geojson') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot overlayed maps | |
fig, ax = plt.subplots(figsize=(14, 12)) | |
countries.plot(ax=ax) | |
cities.plot(markersize=0.2, color='red',ax=ax) | |
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
countries.crs |
OlderNewer