Skip to content

Instantly share code, notes, and snippets.

View keum's full-sized avatar

Peter Keum keum

  • King County - Wastewater Treatment Division
  • Seattle, WA
  • 23:45 (UTC -07:00)
View GitHub Profile
@keum
keum / How to: shape2geojson
Last active November 26, 2018 22:49
How to: Converting Shape file into geojson format
WORK FLOW:Convert Shape files into GeoJSON using GDAl library
Two step process.
Step 1.Convert Data in WGS 84 projection --> 2. Convert shp into Geojson using ogr2ogr
STEP 1. Make sure your data is in EPSG 4326 (Geographic projection WGS 84) is NOT Web Mercator projection
(most commonly used projection that can be use to post onto GitHub page is web mercator is EPSG:3857).
Before geoJSON conversion, make sure data isn't in WGS 84 projection already by checking for projection meta using ogrinfo command.
Convert WA State Plane EPSG 2926 to WGS 84 - EPSG 4326 (Geographic Projection WGS 84)
--Use ogrinfo to check the projection of data, example : sewer.shp
@keum
keum / waDOTcamera
Last active November 11, 2018 04:52
WA DOT camera location
{
"type": "FeatureCollection",
"name": "waDotcamera",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "CameraID": 8216, "CameraLocation\/Description": null, "CameraLocation\/Direction": "E", "Latitude": 48.1675, "Longitude": -122.1583, "CameraLocation\/MilePost": 0, "CameraLocation\/RoadName": "Airports", "CameraOwner": null, "Description": null, "DisplayLatitude": 48.1675, "DisplayLongitude": -122.1583, "ImageHeight": 197, "ImageURL": "https:\/\/images.wsdot.wa.gov\/airports\/arlwest.jpg", "ImageWidth": 335, "IsActive": "true", "OwnerURL": null, "Region": "NW", "SortOrder": 5300, "Title": "Arlington Airport Northwest" }, "geometry": { "type": "Point", "coordinates": [ -122.1583, 48.1675 ] } },
{ "type": "Feature", "properties": { "CameraID": 8218, "CameraLocation\/Description": null, "CameraLocation\/Direction": "N", "CameraLocation\/Latitude": 48.1675, "CameraLocation\/Longitude": -122.1583, "CameraLocation\/MilePost":
#!/usr/bin/env bash
# This script uses the concept at https://certbot.eff.org/#ubuntuxenial-other
# but overcomes the problem I consistently have of the server (at eff.org)
# not being able to connect to this machine.
mkdir -p /tmp/www
cd /tmp/www
sudo python -m SimpleHTTPServer 80 &
http_pid=$!
@keum
keum / .block
Created September 10, 2017 23:20
Basic D3 map (live mods) d3v4
license: mit
@keum
keum / .block
Created September 10, 2017 22:36
Leaflet starter
license: mit
@keum
keum / .block
Last active September 9, 2017 23:46
fresh block
license: mit
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
CREATE OR REPLACE FUNCTION public.dbs_ned_z(
IN text,
IN text,
OUT text)
RETURNS text AS
$BODY$
#!/bin/sh
url="http://ned.usgs.gov/epqs/pqs.php?output=json&x=$1&y=$2"; /usr/bin/curl -s $url
$BODY$
LANGUAGE plsh VOLATILE
@keum
keum / How to: Paul's gist on ogr_geojson
Last active January 1, 2016 19:29 — forked from mccombsp-kingco/gist:8185605
How To: Gdal using ogr for geojson
Install gdal http://giscollective.org/installing-gdal-mac/
use github http://www.thinkful.com/learn/a-guide-to-using-github-pages/start/existing-project/user-page/
git add .
551 git commit -a -m "testing GeoJSON format"
552 git config --global user.name "mccombsp-kingco"
553 git config --global user.emal mccombs@imperium.org
554 git commit --amend --reset-author
555 git push
@keum
keum / How to: geojson-conversion.sh
Last active December 31, 2015 04:59 — forked from benbalter/geojson-conversion.sh
How to: Bulk conversion Shape to Geojson
# Bulk convert shapefiles to geojson using ogr2ogr
# For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/
# Note: Assumes you're in a folder with one or more zip files containing shape files
# and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere)
#geojson conversion
function shp2geojson() {
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp"
}