Git Product home page Git Product logo

cityshademapper's Introduction

CityShadeMapper

R-CMD-check Codecov test coverage Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. HitCount HitCount

CityShadeMapper is an open source R package that generates high-resolution insolation or shade maps from remote sensing (LiDAR) data. Free LiDAR data are now available for many countries (e.g. Spain). Shade maps can be generated for every hour of the year and every square meter of entire cities (e.g. see https://www.mapasdesombra.org).

Installation

# install.packages("remotes")
remotes::install_github("Pakillo/CityShadeMapper")

Usage

An example using LiDAR data from Sevilla, Spain (provided by IGN):

library("CityShadeMapper")

# Read LiDAR data
lidar <- read_lidar(system.file("extdata", "catedral.laz", package = "CityShadeMapper"))

# Calculate heights from LiDAR data
heights <- calc_heights_from_lidar(lidar)

# Calculate shade maps for 30 April (all day)
shade <- make_shademap(heights, date = "2022-04-30", hour = 8:21)

plot_shademap(shade, legend = FALSE, animate = TRUE, smooth = TRUE)

See https://www.mapasdesombra.org for a more developed application of shade maps at both the canopy and ground level for Sevilla city in southern Spain.

How it works

CityShadeMapper builds upon wonderful open source packages (e.g. lidR, solartime, rayshader, terra, GDAL, etc) that make it possible. CityShadeMapper uses the LiDAR point cloud to build a detailed height map of the city, including trees and buildings. From this height information, and knowing the sun position at every time of year given the geographic coordinates of the city, CityShadeMapper calculates the amount of solar rays hitting every pixel of the surface (either at the roof/canopy or the ground level).

Limitations

Shade intensity under tree canopies is currently fixed at a low (5% illumination) value. If there is information available about vegetation type, density, etc, it could be used to refine the calculation of shade intensities below tree canopies, i.e. at the ground level. Illumination calculations at the canopy/roof level is unaffected by this.

Citation

If you found CityShadeMapper useful we’d love to know. Please do get in touch. And please cite CityShadeMapper whenever you use it:

citation("CityShadeMapper")
To cite CityShadeMapper use:

  Francisco Rodríguez-Sánchez & Jesús Sánchez-Dávila. CityShadeMapper:
  Generate High Resolution Shade Maps and Shaded Routes from Remote
  Sensing Data. https://pakillo.github.io/CityShadeMapper

A BibTeX entry for LaTeX users is

  @Manual{,
    title = {CityShadeMapper: Generate High Resolution Shade Maps and Shaded Routes from Remote Sensing Data},
    author = {Francisco Rodríguez-Sánchez and Jesús Sánchez-Dávila},
    year = {2022},
    url = {https://pakillo.github.io/CityShadeMapper},
  }

Funding

The development of this software has been funded by Fondo Europeo de Desarrollo Regional (FEDER) and Consejería de Transformación Económica, Industria, Conocimiento y Universidades of Junta de Andalucía (proyecto US-1381388 led by Francisco Rodríguez Sánchez, Universidad de Sevilla).

cityshademapper's People

Contributors

jesus-davila avatar pakillo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cityshademapper's Issues

Datos de elevación

Del PNOA:

  • Nubes de puntos (resolución >= 0.5 puntos/m2). 1ª cobertura: 2009-2015. 2ª cobertura (aún no disponible para todo el territorio): 2015-2020.

  • Modelo Digital del Terreno: altura del suelo, generado por interpolación de puntos clase 2 (terreno), con resolución de 5 m (1ª cobertura) o 2 m (2ª cobertura).

  • Modelo Digital de Superficies: alturas sobre el terreno, generado a partir de puntos de clase 2 (terreno), 3, 4, 5 (vegetación) y 6 (edificaciones), con resolución de 5 m (1ª cobertura). También disponibles MDS de vegetación y edificaciones (por separado), con resolución de 2.5 m (1ª cobertura).

  • Mapa Lidar: Modelo Digital de Superficies sombreado, distinguiendo vegetación de edificaciones, con resolución de 2.5 m


OSM Buildings


(Catastro tiene información sobre número de plantas, pero no alturas)

Time zones

Time zones together with Daylight Savings Times are complicated...

The time difference between local time and UTC/solar time at late March or late October (i.e. after DST) depends on the particular year

We're going to model a 'standard' year, so let's assume that all days from November to March, both included, have winter time (i.e. 1 hour ahead of UTC/solar), and all days between April and October (both included) have summer time (i.e. 2 hours ahead of UTC/solar)

P.S. Here is a base R solution to find time difference at any given date

Postprocess shade map to obtain shade at street level

Remove pixels occupied by buildings. Probably water too
That is, leave pixels that are outdoors (streets, open spaces), either vegetated or not, to calculate shade statistics across districts, etc
We can do this using lidar points classes (see #2 (comment))
Vegetation <1m should probably be discarded

add example datasets

  • single small tree

  • single big tree (same as several small trees together)

  • square building with open area inside

Planning shade routes

We need to find the best route between two points (ideally, two addresses or geoplaces as in Google Maps or Openstreetmap) with the conditions that

  • route must follow streets (ideally from OSM), i.e. not being a direct line between the two points. Must be possible to make it walking

  • route must minimize cost, in terms of selecting the most shaded routes as coming from the shade raster for that date and time

rayshader uses height matrix filled by column, not by rows

library(terra)
#> terra 1.5.21
library(raster)
#> Loading required package: sp

r = rast(nrows = 3, ncols = 3, xmin = 0, xmax = 3, ymin = 0, ymax = 3, 
         resolution = 1, vals = 1:9)
plot(r)

raster <- raster(r)

m <- matrix(raster::extract(raster, raster::extent(raster)), 
              nrow = ncol(raster), ncol = nrow(raster))

m
#>      [,1] [,2] [,3]
#> [1,]    1    4    7
#> [2,]    2    5    8
#> [3,]    3    6    9

See https://github.com/tylermorganwall/rayshader/blob/7d19e315c8f171f88bc11eb30f7c464ebc672cdd/R/raster_to_matrix.R#L33

Need to transpose resulting matrix in terra_to_matrix

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.