Environmental Data Mapping
Swipe to show menu
Environmental geospatial datasets play a crucial role in understanding and managing natural and urban environments. These datasets often include information about parks, rivers, green spaces, pollution sources, and other environmental features, each with attributes like location coordinates, type, area, and quality indicators. Analyzing such data allows you to identify patterns, monitor changes, and inform decision-making in urban planning, conservation, and public health.
However, working with environmental datasets can present challenges, such as:
- Inconsistent attribute naming;
- Varying coordinate reference systems;
- Missing or outdated records.
Careful preprocessing and validation are essential for producing reliable and meaningful maps that accurately reflect the environmental situation.
123456789101112131415161718192021import geopandas as gpd import matplotlib.pyplot as plt # Load parks (protected areas) and rivers datasets from valid GeoJSON URLs parks_url = "https://raw.githubusercontent.com/datasets/geo-boundaries-world-110m/master/countries.geojson" # Example: country boundaries as protected areas rivers_url = "https://raw.githubusercontent.com/nvkelso/natural-earth-vector/master/geojson/ne_10m_rivers_lake_centerlines.geojson" parks = gpd.read_file(parks_url) rivers = gpd.read_file(rivers_url) # Align both datasets to the same CRS (EPSG:4326) parks = parks.to_crs("EPSG:4326") rivers = rivers.to_crs("EPSG:4326") # Plot rivers as blue lines and parks as green polygons fig, ax = plt.subplots(figsize=(10, 6)) rivers.plot(ax=ax, color="blue", linewidth=1, label="Rivers") parks.plot(ax=ax, color="green", edgecolor="black", alpha=0.5, label="Parks") ax.set_title("Environmental Features: Parks and Rivers") ax.legend() plt.show()
The code loads parks and rivers datasets from public GeoJSON URLs using geopandas.read_file.
Both datasets are set to the same coordinate reference system (EPSG:4326) to ensure accurate overlay.
The code uses matplotlib to plot rivers as blue lines and parks as green points on a single map, adding a title and legend for clarity.
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat