In [ ]:
pip install geopandas
Requirement already satisfied: geopandas in /usr/local/lib/python3.12/dist-packages (1.1.1) Requirement already satisfied: numpy>=1.24 in /usr/local/lib/python3.12/dist-packages (from geopandas) (2.0.2) Requirement already satisfied: pyogrio>=0.7.2 in /usr/local/lib/python3.12/dist-packages (from geopandas) (0.11.1) Requirement already satisfied: packaging in /usr/local/lib/python3.12/dist-packages (from geopandas) (25.0) Requirement already satisfied: pandas>=2.0.0 in /usr/local/lib/python3.12/dist-packages (from geopandas) (2.2.2) Requirement already satisfied: pyproj>=3.5.0 in /usr/local/lib/python3.12/dist-packages (from geopandas) (3.7.2) Requirement already satisfied: shapely>=2.0.0 in /usr/local/lib/python3.12/dist-packages (from geopandas) (2.1.2) Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.12/dist-packages (from pandas>=2.0.0->geopandas) (2.9.0.post0) Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.12/dist-packages (from pandas>=2.0.0->geopandas) (2025.2) Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.12/dist-packages (from pandas>=2.0.0->geopandas) (2025.2) Requirement already satisfied: certifi in /usr/local/lib/python3.12/dist-packages (from pyogrio>=0.7.2->geopandas) (2025.10.5) Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.12/dist-packages (from python-dateutil>=2.8.2->pandas>=2.0.0->geopandas) (1.17.0)
In [ ]:
pip install geodatasets
Collecting geodatasets Downloading geodatasets-2024.8.0-py3-none-any.whl.metadata (5.4 kB) Requirement already satisfied: pooch in /usr/local/lib/python3.12/dist-packages (from geodatasets) (1.8.2) Requirement already satisfied: platformdirs>=2.5.0 in /usr/local/lib/python3.12/dist-packages (from pooch->geodatasets) (4.5.0) Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.12/dist-packages (from pooch->geodatasets) (25.0) Requirement already satisfied: requests>=2.19.0 in /usr/local/lib/python3.12/dist-packages (from pooch->geodatasets) (2.32.4) Requirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.12/dist-packages (from requests>=2.19.0->pooch->geodatasets) (3.4.4) Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.12/dist-packages (from requests>=2.19.0->pooch->geodatasets) (3.11) Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.12/dist-packages (from requests>=2.19.0->pooch->geodatasets) (2.5.0) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.12/dist-packages (from requests>=2.19.0->pooch->geodatasets) (2025.10.5) Downloading geodatasets-2024.8.0-py3-none-any.whl (20 kB) Installing collected packages: geodatasets Successfully installed geodatasets-2024.8.0
In [ ]:
import pandas as pd
import geopandas
import matplotlib.pyplot as plt
from geodatasets import get_path
from osgeo import gdal
gdal.SetConfigOption('SHAPE_RESTORE_SHX', 'YES')
In [ ]:
df1 = pd.read_csv('geo_data.csv')
df1.head()
Out[ ]:
| Unnamed: 0 | City | Country | Latitude | Longitude | |
|---|---|---|---|---|---|
| 0 | 0 | Buenos Aires | Argentina | -34.58 | -58.66 |
| 1 | 1 | Brasilia | Brazil | -15.78 | -47.91 |
| 2 | 2 | Santiago | Chile | -33.45 | -70.66 |
| 3 | 3 | Bogota | Colombia | 4.60 | -74.08 |
| 4 | 4 | Caracas | Venezuela | 10.48 | -66.86 |
In [ ]:
gdf= geopandas.GeoDataFrame(df1, geometry=geopandas.points_from_xy(df1.Longitude, df1.Latitude))
gdf
Out[ ]:
| Unnamed: 0 | City | Country | Latitude | Longitude | geometry | |
|---|---|---|---|---|---|---|
| 0 | 0 | Buenos Aires | Argentina | -34.58 | -58.66 | POINT (-58.66 -34.58) |
| 1 | 1 | Brasilia | Brazil | -15.78 | -47.91 | POINT (-47.91 -15.78) |
| 2 | 2 | Santiago | Chile | -33.45 | -70.66 | POINT (-70.66 -33.45) |
| 3 | 3 | Bogota | Colombia | 4.60 | -74.08 | POINT (-74.08 4.6) |
| 4 | 4 | Caracas | Venezuela | 10.48 | -66.86 | POINT (-66.86 10.48) |
In [ ]:
world = geopandas.read_file(get_path('naturalearth.land'))
Downloading file 'ne_110m_land.zip' from 'https://naciscdn.org/naturalearth/110m/physical/ne_110m_land.zip' to '/root/.cache/geodatasets'.
In [ ]:
#extract south america
ax = world.clip([-90, -55, -25, 15]).plot(color='#caf0f8', edgecolor='mediumspringgreen')
In [ ]:
ax = world.clip([-90, -55, -25, 15]).plot(color='#caf0f8', edgecolor='mediumspringgreen')
gdf.plot(ax=ax, color= 'hotpink', marker='D', markersize=80, alpha= 0.5)
for x, y, label in zip(gdf.geometry.x, gdf.geometry.y, gdf['City']):
ax.text(x+ 0.5, y+0.5, label, fontsize=9, color='blue')
plt.show()
In [ ]:
In [ ]:
!jupyter nbconvert --to html bana310_103025.ipynb
[NbConvertApp] Converting notebook bana310_final.ipynb to html [NbConvertApp] WARNING | Alternative text is missing on 14 image(s). [NbConvertApp] Writing 963726 bytes to bana310_final.html