Skip to content

Add new GIS example: Solar Adoption model#381

Open
ShreyasN707 wants to merge 7 commits intomesa:mainfrom
ShreyasN707:feature/solar-adoption-example
Open

Add new GIS example: Solar Adoption model#381
ShreyasN707 wants to merge 7 commits intomesa:mainfrom
ShreyasN707:feature/solar-adoption-example

Conversation

@ShreyasN707
Copy link
Contributor

This PR adds a new Solar Adoption example to the gis/ directory to demonstrate how raster data and vector agents can be used together with mesa-geo.

The model simulates how households decide to adopt solar panels based on two geographic factors:

  • Economic viability (raster data): Each household is linked to a solar radiation value from a RasterLayer. Locations with higher radiation make adoption more likely.

  • Social influence (vector neighbors): Households are influenced by nearby households. Agents use GeoSpace.get_neighbors_within_distance() to calculate local adoption and model peer effects.

What this example demonstrates

  • Using GeoSpace to manage spatial relationships between agents

  • Loading environmental data with RasterLayer.from_file()

  • Creating agents from GeoJSON using AgentCreator

  • Visualizing the simulation with a Solara dashboard using make_geospace_component, where households change color as they adopt solar

Implementation notes

A data/generate_data.py script generates synthetic households.geojson and solar_radiation.tif files so the example can run without external datasets.

The code follows the standard Mesa example structure and uses the built-in random generator.

The example runs successfully with the existing test_gis_examples.py test suite.

Screenshot from 2026-03-12 18-38-55 Screenshot from 2026-03-12 18-40-11 Screenshot from 2026-03-12 18-40-34 Screenshot from 2026-03-12 18-40-39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant