Skip to content

Instantly share code, notes, and snippets.

View bdevoe's full-sized avatar

Bill DeVoe bdevoe

View GitHub Profile
@bdevoe
bdevoe / R_package_autoloader.R
Last active May 14, 2019 19:57
R package autoloader/installer
#' @title Package autoloader/installer
#'
#' @author Bill DeVoe, \email{William.DeVoe@@maine.gov}
#'
#' @description This function takes a vector of package names and loads each
#' package if it is already installed, or installs and then loads the package
#' if it is not installed.
#'
#' @rdname package_loader
#' @param packages Character vector of packages to be loaded.
@bdevoe
bdevoe / spatial_intersections_example.js
Last active May 8, 2019 12:32
Offline spatial intersections in JS
//Example of using GeoJSON polygon data to do basic spatial intersections in iFormBuilder
//input GeoJSON data for zones, in WGS84 lat lon projection
var zones = JSON.parse('{"displayFieldName":"","fieldAliases":{"OBJECTID":"OBJECTID","ZONEID":"ZONEID","Shape_Length":"Shape_Length","Shape_Area":"Shape_Area"},"geometryType":"esriGeometryPolygon","spatialReference":{"wkid":4269,"latestWkid":4269},"fields":[{"name":"OBJECTID","type":"esriFieldTypeOID","alias":"OBJECTID"},{"name":"ZONEID","type":"esriFieldTypeString","alias":"ZONEID","length":1},{"name":"Shape_Length","type":"esriFieldTypeDouble","alias":"Shape_Length"},{"name":"Shape_Area","type":"esriFieldTypeDouble","alias":"Shape_Area"}],"features":[{"attributes":{"OBJECTID":1,"ZONEID":"E","Shape_Length":4.0017220697931037,"Shape_Area":0.53018362362028371},"geometry":{"rings":[[[-69.430220952146556,44.442686473390495],[-69.514982657468863,43.831301610109222],[-69.505937590331087,43.836423752441988],[-69.500000001218723,43.801660000000993],[-69.5000000012187