Skip to content

Instantly share code, notes, and snippets.

View nickpeihl's full-sized avatar

Nick Peihl nickpeihl

View GitHub Profile
@nickpeihl
nickpeihl / arcsdeVersionedViews.py
Last active January 27, 2022 11:06
Expose and Edit an ArcSDE 10.1 Versioned View in PostgreSQL using Django
## Tested using ArcSDE 10.1 and PostgreSQL 9.1/PostGIS 2.0
## Other database types and software versions need testing.
## Prior to use you must create the Versioned View on the
# feature class you want to edit. You must also create the
# ArcSDE version you want to use for the edits.
# In Settings.py
# ...
DATABASES = {
@nickpeihl
nickpeihl / geoservices-js
Last active August 29, 2015 13:58
Error using simplest example from geoservices-js docs.
O:\Workspace\Nick\Public Works\Citizen Engagement\nodejs>node server.js
O:\Workspace\Nick\Public Works\Citizen Engagement\nodejs\node_modules\geoservice
s\lib\featureservice.js:61
this.get();
^
TypeError: Object #<Geoservices> has no method 'get'
at Geoservices.FeatureService (O:\Workspace\Nick\Public Works\Citizen Engage
ment\nodejs\node_modules\geoservices\lib\featureservice.js:61:8)
at Object.<anonymous> (O:\Workspace\Nick\Public Works\Citizen Engagement\nod
@nickpeihl
nickpeihl / contributions_totals.json
Last active August 29, 2015 14:05
San Juan County Political Contributions Visualized
{
"name": "2013 Contribution Totals",
"children" : [
{
"rID" : "0194b2d1d3db739c1ef2144a7754f890",
"name" : "WA ST NATL ORG FOR WOMEN PAC",
"year" : 2013,
"amount" : 10
},
{
@nickpeihl
nickpeihl / expenditure-tree.html
Last active August 29, 2015 14:06
Public Works Budget Bubbles
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<style>
.node circle {
fill: rgba(220,80,255,1);
stroke: rgba(147,2,183,1);
stroke-width: 3px;
}
@nickpeihl
nickpeihl / index.html
Last active August 29, 2015 14:07 — forked from d3noob/.block
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Collapsible Tree Example</title>
<style>
.node circle {
@nickpeihl
nickpeihl / README.md
Last active August 29, 2015 14:10 — forked from mbostock/.block

A demo of TopoJSON on a U.S. counties shapefile from the U.S. census bureau. The same TopoJSON file can also be used to show states.

@nickpeihl
nickpeihl / index.html
Last active December 5, 2017 16:53
Debug custom geocoder without Arcgis Online Geocode Service
<!DOCTYPE html>
<html>
<head>
<title>Esri Leaflet Geocoder</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
<!-- Load Leaflet from their CDN -->
<link rel="stylesheet" href="../node_modules/leaflet/dist/leaflet.css" />
<script src="../node_modules/leaflet/dist/leaflet-src.js"></script>
@nickpeihl
nickpeihl / README.md
Last active September 25, 2017 16:55
Take your basemaps offline with Geopaparazzi and your Android device

San Juan County Web Maps in Geopaparazzi

Geopaparazzi is an open source Android application that can be used to collect notes, GPS tracks and points while in the field. It includes the ability to load custom tiled basemaps.

The .mapurl files in this directory point to two San Juan County basemaps that can be loaded into Geopaparazzi.

Usage

  1. Install Geopaparazzi from the Google Play Store.
@nickpeihl
nickpeihl / testTiff.js
Created August 31, 2015 20:48
GeoTIFF Test for Mapnik-Omnivore
var fs = require('fs');
fs.open('CW.tif', 'r', function(err, fd) {
var buf = new Buffer(100);
fs.read(fd, buf, 0, 100, null, function(err, bytesRead, buffer) {
var head = buffer.slice(0, 100).toString();
if((head.slice(0,2).toString() === 'II' || head.slice(0,2).toString() == 'MM') && ((buffer[2] === 42) || buffer[3] === 42)) {
console.log('file matches GeoTiff');
} else {
console.log('head-slice is ', head.slice(0,2).toString(), ' and buffer[2] equals ', buffer[2], ' and buffer[3] equals ', buffer[3]);
}
@nickpeihl
nickpeihl / flip.py
Created September 9, 2015 23:45
Flip line directions with arcpy
def flipLine(myFeatureClass, myQuery):
try:
lines=arcpy.UpdateCursor(myFeatureClass, myQuery)
dsc=arcpy.Describe(myFeatureClass)
lc=0
for ln in lines:
if ln.shape.partCount > 1:
print "Warning: multiple parts! extra parts are automatically trimmed!"
lp= ln.shape.getPart(0)
rPnts=arcpy.Array()