80 solar
Uncomment the following line to install leafmap if needed.
In [ ]:
Copied!
# %pip install -U leafmap
# %pip install -U leafmap
In [ ]:
Copied!
import os
import leafmap
import os
import leafmap
Set Google API key. Get one from https://developers.google.com/maps/documentation/solar/get-api-key
You also need to enable the Google Solar API at https://console.cloud.google.com/google/maps-apis/api-list
In [ ]:
Copied!
os.environ["GOOGLE_API_KEY"] = "YOUR-API-KEY"
os.environ["GOOGLE_API_KEY"] = "YOUR-API-KEY"
Set download directory.
In [ ]:
Copied!
out_dir = os.path.expanduser("~/Downloads")
out_dir = os.path.expanduser("~/Downloads")
Download Solar data from Google's Solar API.
In [ ]:
Copied!
lat = 50.97579908646006
lon = 11.023334842349778
radiusMeters = 50
view = "FULL_LAYERS"
requiredQuality = "HIGH"
pixelSizeMeters = 0.1
lat = 50.97579908646006
lon = 11.023334842349778
radiusMeters = 50
view = "FULL_LAYERS"
requiredQuality = "HIGH"
pixelSizeMeters = 0.1
In [ ]:
Copied!
files = leafmap.get_solar_data(
lat, lon, radiusMeters, view, requiredQuality, pixelSizeMeters, out_dir=out_dir
)
files
files = leafmap.get_solar_data(
lat, lon, radiusMeters, view, requiredQuality, pixelSizeMeters, out_dir=out_dir
)
files
Create an interactive map and add the Solar data.
In [ ]:
Copied!
m = leafmap.Map()
m.add_raster(files["rgb"], layer_name="RGB")
m.add_raster(files["mask"], layer_name="Mask")
m.add_raster(files["dsm"], colormap="terrain", layer_name="DSM", visible=False)
m.add_raster(files["annualFlux"], colormap="plasma", layer_name="annualFlux")
m.add_raster(
files["monthlyFlux"],
colormap="plasma",
band=[7],
layer_name="monthlyFlux",
visible=False,
)
m.add_colormap(cmap="terrain", vmin=190, vmax=250, label="Elevation (m)")
m.add_colormap(cmap="plasma", vmin=500, vmax=1000, label="Annual flux (kWh/kW/year)")
m
m = leafmap.Map()
m.add_raster(files["rgb"], layer_name="RGB")
m.add_raster(files["mask"], layer_name="Mask")
m.add_raster(files["dsm"], colormap="terrain", layer_name="DSM", visible=False)
m.add_raster(files["annualFlux"], colormap="plasma", layer_name="annualFlux")
m.add_raster(
files["monthlyFlux"],
colormap="plasma",
band=[7],
layer_name="monthlyFlux",
visible=False,
)
m.add_colormap(cmap="terrain", vmin=190, vmax=250, label="Elevation (m)")
m.add_colormap(cmap="plasma", vmin=500, vmax=1000, label="Annual flux (kWh/kW/year)")
m