Skip to content

Instantly share code, notes, and snippets.

View MappingKat's full-sized avatar

Katrina Engelsted MappingKat

  • Glenwood Springs, CO
View GitHub Profile
function fetchRecords() {
var formId = "a8245687-0373-432e-98a2-b53074708ac9";
var response = "https://api.fulcrumapp.com/api/v2/records.json?form_id=" + formId + "&token=" + fulcrumAPIkey;
var options = {
"method": "GET",
"contentType": "application/json"
};
var recordJSON = UrlFetchApp.fetch(response, options);
var records = JSON.parse(recordJSON).records;
loopThrough(records);
var sample = $sample_size;
var zones = [
{"sample":"2", "critical":0},
{"sample":"3", "critical":0},
{"sample":"5", "critical":0},
{"sample":"8", "critical":1},
{"sample":"13", "critical":1},
{"sample":"20", "critical":2},
{"sample":"32", "critical":3},
@MappingKat
MappingKat / script.js
Created June 30, 2016 21:42
Update Field Value
var fulcrumAPIkey = -----;
function updateField (recordID) {
var url = "https://api.fulcrumapp.com/api/v2/records/" + recordID + ".json?token="+fulcrumAPIkey;
var options = {
"method": "GET",
"contentType": "application/json"
};
var recordJSON = UrlFetchApp.fetch(url, options);
import csv
from fulcrum import Fulcrum
from fulcrum.exceptions import NotFoundException
api_key = 'your-api-key'
form_id = 'your-form-id'
fulcrum = Fulcrum(key=api_key)
updates = csv.reader(open('record-updates.csv'), delimiter=',')
# skip header
cat projects.csv | while read -r line; do curl -s -XPOST -H "X-ApiToken: 6427aa7a24d47a643d01601ec1dfebf3c27d624de30e9df27cb86fb4de6289eaf814b06aed5ec402" -H "Content-Type: application/json" -d "{\"project\": {\"name\": \"$(echo $line | cut -d, -f1)\"}}" https://api.fulcrumapp.com/api/v2/projects.json; done
@MappingKat
MappingKat / index.html
Last active September 28, 2015 22:51
Basic Leaflet map
<!DOCTYPE html>
<html>
<head>
<title>Simple Leaflet Map</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
</head>
<body>
<div id="map" style="width: 1100px; height: 800px"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
@MappingKat
MappingKat / Bash Code
Last active August 29, 2015 14:11
Converting Shapefiles to Geojson
// create an array of folders you would like to cd into
dirs=(dir1 dir2 dir3 dir4)
// create a function that takes all of the shapefile in the folder and converts them to geojson (sharing same name)
function shp2geojson() {
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp"
}
// create a loop to go into the folder, convert to geojson and cd out
for dir in "${dirs[@]}"; do
@MappingKat
MappingKat / app.js
Last active August 29, 2015 14:06
testing
var NPMap = {
baseLayers: [
"nps-parkTiles"
],
"center": {
lat: 36.70806354647625,
lng: -118.46145629882811
},
description: "Wilderness Character Rasters",
div: "map",
@MappingKat
MappingKat / spot.xml
Created September 10, 2014 19:46
SPOT data
<?xml version="1.0" encoding="UTF-8"?>
<response>
<feedMessageResponse>
<count>10</count>
<feed>
<id>03XHH0sPyTiYUsYD2TVJ4q7CzEH89HBhG</id>
<name>OneAtATime</name>
<description>OneAtATime</description>
<status>ACTIVE</status>
<usage>0</usage>
@MappingKat
MappingKat / index.html
Last active August 29, 2015 14:06
bear-parks.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<div id="map" style="height:500px;width:500px;">
</div>
<script>
var App, NPMap;