Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Peihl nickpeihl

View GitHub Profile
@nickpeihl
nickpeihl / index.js
Last active Jul 9, 2021
GBFS to GeoJSON
View index.js
var gbfs2geojson = require("gbfs2geojson-js");
var fs = require("fs");
var autoDiscoveryUrl =
"https://ckan0.cf.opendata.inter.prod-toronto.ca/dataset/2b44db0d-eea9-442d-b038-79335368ad5a/resource/142dfb32-d81b-474b-811a-dfc47560ac26/download/bike-share-json.json";
var data;
gbfs2geojson.getAllData(autoDiscoveryUrl, data, (data, err) => {
if (err) {
View Console
GET _search
{
"query": {
"match_all": {}
}
}
GET openstreetmap-2021.03.10/_mapping
GET openstreetmap-ways/_mapping
@nickpeihl
nickpeihl / custom_patterns
Created Mar 6, 2021
Grok expression for OpenStreetMap OPL format
View custom_patterns
OSMID [n|r|w][0-9]+
NODES (%{OSMID},?)+
MEMBERS (%{OSMID}@(\S+)?,?)+
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Display a map</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.mapbox.com/mapbox-gl-js/v1.7.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.7.0/mapbox-gl.css" rel="stylesheet" />
<style>
body {
@nickpeihl
nickpeihl / make.sh
Created Aug 9, 2019
Convert file to base64 and store in JSON object
View make.sh
jq -Rs @base64 MYFILENAME | jq "{ data: . }" > myobject.json
@nickpeihl
nickpeihl / README.md
Last active May 27, 2022
GDAL and Elasticsearch examples
View README.md

GDAL and Elasticsearch examples

Shapefile

GDAL Shapefile docs

Import shapefile into Elasticsearch

ogr2ogr -f ElasticSearch \
-lco NOT_ANALYZED_FIELDS={ALL} \
http://elastic:changeme@localhost:9200 \
@nickpeihl
nickpeihl / index.js
Last active Dec 12, 2018
Fake NGINX access.log
View index.js
const faker = require('faker');
const moment = require('moment');
const fs = require('fs');
const stream = fs.createWriteStream('./access.log', {
flags: 'a'
});
function writeToStream(n) {
for (; n < 1000000; n++) {
@nickpeihl
nickpeihl / convertKmzToShp.ps1
Created Jan 8, 2018
Powershell script to convert all KMZ files in the current folder to Shapefiles
View convertKmzToShp.ps1
foreach ($f in Get-ChildItem "${PWD}" -Filter *.kmz) {
docker run -it -v ${PWD}:/data geodata/gdal ogr2ogr -f "ESRI Shapefile" $f.Name.Replace('kmz', 'shp') $f.Name
}
@nickpeihl
nickpeihl / index.html
Last active Nov 20, 2019
ags-walk example
View index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Example of using AGSWalk in client JavaScript to list services from an ArcGIS Server URL">
<title>AGSWalk - List ArcGIS Server Rest Services</title>
<link rel="stylesheet" href="https://unpkg.com/tachyons@4.9.0/css/tachyons.min.css"/>
</head>
<body>
@nickpeihl
nickpeihl / index.html
Created Sep 18, 2017
Interactive Choropleth Map - Leaflet Example
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Choropleth Tutorial - Leaflet</title>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon"