Skip to content

Instantly share code, notes, and snippets.

Andy Teucher ateucher

Block or report user

Report or block ateucher

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bar.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ateucher
ateucher / Dockerfile
Created Jul 30, 2019
Attempt at Dockerfile with filegdb write support
View Dockerfile
##
# osgeo/gdal:ubuntu-full
# This file is available at the option of the licensee under:
# Public domain
# or licensed under X/MIT (LICENSE.TXT) Copyright 2019 Even Rouault <even.rouault@spatialys.com>
# ACT: Copied from https://raw.githubusercontent.com/OSGeo/gdal/master/gdal/docker/ubuntu-full/Dockerfile
ARG PROJ_INSTALL_PREFIX=/usr/local
View rle_eg.md
values <- runif(100)

# get runs where values > 0.75 (these are TRUE/FALSE)
runs <- rle(values > 0.75)

# Mask out the runs with lengths < 3
runs$values[runs$lengths < 3] <- FALSE

# Get a vector of positions that meet the run criteria
View RStudio_bcmaps_unititled_0C2B9F8D
values <- runif(100)
# get runs where values > 0.75 (these are TRUE/FALSE)
runs <- rle(values > 0.75)
# Mask out the runs with lengths < 3
runs$values[runs$lengths < 3] <- FALSE
# Get a vector of positions that meet the run criteria
masked <- inverse.rle(runs)
View bcdata_fwa_example.md
# remotes::install_github("bcgov/bcdata", ref = "promise")
library(bcdata)
library(ggplot2)

Use bcdc_get_data() to get an entire dataset. I wouldn't recommend this for really large datasets like the FWA:

View habc_api.md
library(rgdal)
#> Loading required package: sp
#> rgdal: version: 1.4-3, (SVN revision 828)
#>  Geospatial Data Abstraction Library extensions to R successfully loaded
#>  Loaded GDAL runtime: GDAL 2.1.3, released 2017/20/01
#>  Path to GDAL shared files: /Users/ateucher/Rlibrary/rgdal/gdal
#>  GDAL binary built with GEOS: FALSE 
#>  Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
#>  Path to PROJ.4 shared files: /Users/ateucher/Rlibrary/rgdal/proj
View RStudio_air-zone-reports_assign_time.R
library(dplyr)
library(lubridate)
# sample table
foo <- tibble(
a = rnorm(5),
date = seq(Sys.Date(), by = "1 day", length.out = 5),
he = 1:5
)
View bc_wms_tiles.R
library(bcmaps)
library(leaflet)
library(sf)
st_transform(bc_bound(), 4326) %>%
leaflet() %>%
#add basemap
#addpolygons and make it show in three different layers, by risk level
addPolygons() %>%
addProviderTiles(providers$CartoDB.DarkMatter,
View cake.R
library(datasauRus)
library(ggplot2)
library(ggrepel)
library(viridisLite)
is_equal <- function(x, y, ...) {
vapply(x, function(i) identical(all.equal(i, y, ...), TRUE), FUN.VALUE = logical(1))
}
up <- 12
View pa_analysis_with_dl.sql
-- Before running, load ecoregions, ecosections, bec, nr regions
-- to the db with the same schema.table name as in bcgw
-- This assumes using ogr2ogr for the load, it creates the objectid columns
-- ----------------------------
-- first, overlay designatedlands with nr regions
-- ----------------------------
DROP TABLE IF EXISTS nr_sub;
CREATE TABLE nr_sub AS
You can’t perform that action at this time.