Suppose we want to interpolate a number of points along each line in a layer:
We have a column called stations
that specifies how many points to
interpolate on each line:
fast_extract <- function(x, y, ...) { | |
## BEWARE no extract options are respected | |
raster::extract(x, sfpoly_cells(x, y)) | |
} | |
sfpoly_cells <- function(rast, sfpoly) { | |
## BEWARE, could be a big-data, this is not | |
## sparsely specified, so it's wasteful on memory, but fast (if you have the mem) | |
which(!is.na(fasterize::fasterize(sfpoly, rast)[])) | |
} |
# -*- coding: utf-8 -*- | |
""" | |
/*************************************************************************** | |
Name : XYZ manager | |
Description : Script to save/load/wipe WYZ sources in QGIS 3.0 | |
Date : February 27, 2017 | |
copyright : (C) 2017 by Thomas Gratier | |
email : thomas.gratier@webgeodatavore.com |
library(tidycensus) | |
library(tmap) | |
library(tmaptools) | |
library(sf) | |
library(tigris) | |
library(magick) | |
library(tidyverse) | |
options(tigris_use_cache = TRUE) | |
ctys <- c("Dallas", "Tarrant", "Collin County", "Denton", |
license: mit |
NYC had an import of over 1 million building footprints and 900,000 addresses in 2014 from the New York City Department of Information Technology and Telecommunications (DoITT). The DoITT GIS releases an updated shapefile of the footprints every quarter, and the latest version can be accessed here: Building footprints | Address points
Open datasets like these are a great opportunity to explore how OSM can be used as a bridge between authoritative information and that crowdsourced by citizens. Two years after the import, it is interesting to see how the OSM data compares with the latest official footprints. The interesting questions to ask is:
$ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
$ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
CREATE TABLE public.testpolygons1 | |
( | |
gid serial PRIMARY KEY, | |
geom geometry(Polygon,3857) | |
); | |
CREATE TABLE public.testpolygons2 | |
( | |
gid serial PRIMARY KEY, | |
geom geometry(Polygon,3857) |