Skip to content

Instantly share code, notes, and snippets.

@paleolimbot
paleolimbot / # gdal - 2022-11-09_14-53-50.txt
Created November 9, 2022 18:58
gdal on macOS 12 - Homebrew build logs
Homebrew build logs for gdal on macOS 12
Build date: 2022-11-09 14:53:50
FROM rocker/r-devel:latest
RUN apt update && apt install -y git flex
RUN git clone git://gcc.gnu.org/git/gcc.git gcc11
RUN cd gcc11 && ./contrib/download_prerequisites
RUN mkdir gcc-build && cd gcc-build && ../gcc11/configure -disable-multilib --enable-languages=c,c++,fortran
RUN cd gcc-build && make -j4 && make install
RUN echo 'LD_LIBRARY_PATH="/usr/local/lib64:${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}"' >> /usr/lib/R/etc/ldpaths
RUN mkdir ~/.R && echo 'CXX11=/usr/local/bin/g++' > ~/.R/Makevars && echo 'CXX=/usr/local/bin/g++' >> ~/.R/Makevars && echo 'CC=/usr/local/bin/gcc' >> ~/.R/Makevars
library(tidyverse)
library(argodata) # remotes::install_github("paleolimbot/argodata")
argodata:::use_dev_cache()
urls <- argo_global_prof() %>%
head(100) %>%
argo_url()
dir <- tempfile()
dir.create(dir)
stream_file <- "~/Dropbox/delineatens/dem/streams.shp"
# full read by OGR/sf
system.time(streams_sf <- sf::read_sf(stream_file))
# feature-level summaries by OGR/vapour
system.time(
stream_ext_vapour <-
vapour::vapour_read_extent(dirname(stream_file), layer = "streams")
)
FROM rocker/r-ubuntu:18.04
# RStudio Package Manager cache of June 3, 2020
ENV RSPM https://packagemanager.rstudio.com/all/__linux__/bionic/290
# system dependencies for R packages
RUN apt-get update && apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev
# install R package dependencies
RUN Rscript -e "install.packages('remotes')"
poly_df <- read.csv(
url("https://gist.github.com/will-r-chase/ac1c1b3ba96a761a7d8d70af860bf663/raw/97c68537ad35254721ed55b12b696af6e424cd4d/overlapping_polys.csv")
)
# geos approach
poly_geos <- geos::geos_make_polygon(
poly_df$x, poly_df$y,
feature_id = poly_df$id
)
## Emacs, make this -*- mode: sh; -*-
## start with the Docker 'base R' Debian-based image
FROM r-base:latest
## This handle reaches Carl and Dirk
MAINTAINER "Carl Boettiger and Dirk Eddelbuettel" rocker-maintainers@eddelbuettel.com
## Remain current
RUN apt-get update -qq \
library(sf)
library(geos)
states <- readRDS(url("https://biogeo.ucdavis.edu/data/gadm3.6/Rsf/gadm36_USA_1_sf.rds"))
counties <- readRDS(url("https://biogeo.ucdavis.edu/data/gadm3.6/Rsf/gadm36_USA_2_sf.rds"))
states_sfc <- states$geometry %>% st_set_crs(NA)
states_wkb <- st_as_binary(states_sfc)
states_geos <- geos_read_wkb(states_wkb)
# loading in this order causes sf to crash if libgeos links to system GEOS
# remotes::install_github("paleolimbot/libgeos", configure.vars = "USE_SYSTEM_GEOS=YES")
library(libgeos)
library(sf)
nc <- read_sf(system.file("shape/nc.shp", package = "sf"))
nc1 <- nc[1, , drop = FALSE]
st_intersects(nc, nc1)
library(dplyr)
library(sf)
library(s2) # remotes::install_github("r-spatial/s2")
counties_sf <- readRDS(url("https://biogeo.ucdavis.edu/data/gadm3.6/Rsf/gadm36_USA_2_sf.rds")) %>%
select(state = NAME_1, county = NAME_2) %>%
# USA atlas projection
st_transform(2163)
counties_s2 <- counties_sf %>%