Created
May 3, 2021 08:46
-
-
Save idshklein/917e1166a883b227eb1e325135763455 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(sf) | |
# library(nngeo) | |
df <- st_read("D:/idos_shit/tlv_struc.gpkg") %>% | |
st_transform(2039) | |
has_year <- df %>% filter(!is.na(year),year != 0) | |
hasnt_year <- df %>% filter(is.na(year) | year == 0) | |
# st_nn(hasnt_year,has_year) | |
shp <- has_year %>% | |
st_cast("GEOMETRYCOLLECTION") %>% | |
st_cast("MULTIPOLYGON") | |
bool <- st_point(c(179300,664400)) %>% | |
st_sfc(crs = 2039) %>% | |
st_buffer(1000) %>% | |
st_intersects(shp,sparse = F) %>% | |
as.vector() | |
fin <- shp %>% | |
filter(bool) %>% | |
mutate(year1 = year - (year %% 5 ), | |
year2 = ordered(paste0(year1," - ", year1 + 4))) | |
ggplot() + | |
geom_sf(data = fin, mapping = aes(fill = year2),lwd = 0) + | |
scale_fill_discrete() + | |
theme(panel.background = element_rect(fill="black"), | |
panel.grid = element_blank(), | |
plot.background = element_rect(fill="black"), | |
legend.background = element_rect(fill="black"), | |
legend.text = element_text(color = "white"), | |
legend.title = element_blank(), | |
axis.text = element_blank(), | |
text = element_text(color = "white")) + | |
labs(title = "Tel aviv", | |
caption = "Source: TLV gis") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment