knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
suppressWarnings(library(SfSpHelpers))
suppressWarnings(library(dplyr))
suppressWarnings(library(ggplot2))

Data

shpBuildings <- cache_csv_sf_wrapper('eval_fonciere_mtl', 
                                       fun = get_zipped_remote_shapefile,
                                       url = 'https://data.montreal.ca/dataset/4ad6baea-4d2c-460f-a8bf-5d000db498f7/resource/43c2cccf-a439-429b-a3c8-5d4ebce53e1b/download/uniteevaluationfonciere.zip',
                                       id_name='ID_UEV')


#Sample
shpBuildings %<>% sample_frac(size=0.001) 

#Clean up 
shpBuildings %<>% mutate( ANNEE_CONS = plyr::mapvalues(ANNEE_CONS, from=9999, to=NA) )

Map

shpVoronoi <- getVoronoiInterpolation(shpBuildings,  'ANNEE_CONS')

 ggplot() +
    geom_sf(data=shpVoronoi, aes(fill=ANNEE_CONS), alpha=0.2, , lwd=0.1) +
    geom_sf(data=shpBuildings %>% sf::st_centroid(), lwd=0.2, alpha=0.2) +
    viridis::scale_fill_viridis() +
    ggtitle('Building year') +
    labs(subtitle="Montreal",
         caption = 'Source: City of Montreal - assessor data')


cgauvi/sfSpHelpers documentation built on June 30, 2023, 10:48 p.m.