Skip to content

Instantly share code, notes, and snippets.

View tormi's full-sized avatar
🇪🇪
Working from home

Tormi Tabor tormi

🇪🇪
Working from home
View GitHub Profile
#!/bin/bash
# Convert dwg to projected geojson
ogr2ogr -f GeoJSON -s_srs epsg:2154 -t_srs epsg:4326 building.json building.dwg
@tormi
tormi / geojson_to_index.js
Created November 2, 2020 12:30 — forked from thomasneirynck/geojson_to_index.js
Ingest geojson file into Elasticsearch index. Each feature in the FeatureCollection corresponds to a document in Elasticsearch.
const fs = require("fs");
const elasticsearch = require('elasticsearch');
const oboe = require('oboe');
const geojsonInput = process.argv[2] || 'feature_collection.geojson';
const indexname = process.argv[3] || geojsonInput.split('.')[0] || 'feature_collection';
const geometryFieldName = 'geometry';
const shape_type = process.argv[4] || 'geo_shape';
if (shape_type !== 'geo_point' && shape_type !== 'geo_shape') {
@tormi
tormi / script.js
Last active April 2, 2019 19:27 — forked from jmolivas/script.js
Trigger Netlify build from a Google Spreadsheet for Gatsby site
# From your Google Spreadsheet, select the menu item Tools > Script editor.
# Copy and paste this code.
# Replace uuid with the build_hooks uuid from your Netlify project.
# https://twitter.com/jmolivas/status/1112765435206787072
function onOpen() {
SpreadsheetApp.getUi()
.createMenu('Scripts')
.addItem('Build', 'build')
.addToUi();
@tormi
tormi / website-checker.sh
Created November 5, 2018 16:26 — forked from dominic-p/website-checker.sh
This is a shell script to check a provided list of URLs to see if the websites are working or not. It was based on the answers provided to this question: http://stackoverflow.com/q/21391776/931860
#!/bin/sh
# ---- website-checker.sh ----
# Pings a list of websites using cURL to see if they are up and
# there are no errors. If there are problems, we send an email using mailx
# to let ourselves know about the problem.
################################################################################
# Recipient of the errors email
admin_email=youremail@host.com
@tormi
tormi / leaflet.fullhash.js
Created September 14, 2017 12:12 — forked from relet/leaflet.fullhash.js
leaflet.fullhash.js
(function(window) {
var HAS_HASHCHANGE = (function() {
var doc_mode = window.documentMode;
return ('onhashchange' in window) &&
(doc_mode === undefined || doc_mode > 7);
})();
L.Hash = function(map, options) {
this.onHashChange = L.Util.bind(this.onHashChange, this);
@tormi
tormi / overpass.geojson
Created May 26, 2017 11:30 — forked from anonymous/overpass.geojson
data exported by overpass turbo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tormi
tormi / proxy.php
Created December 4, 2016 18:49 — forked from bmcbride/proxy.php
Simple PHP proxy
<?php
$ch = curl_init($_GET['url']);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
?>
@tormi
tormi / leaflet-custom-map.html
Created December 3, 2016 16:23 — forked from MarZab/leaflet-custom-map.html
Leaflet with latlng scale in meters and Control.Scale to match
<!DOCTYPE html>
<html>
<head>
<title>Leaflet Custom Simple Map Example</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-1.0.0-b1/leaflet.css" />
<link rel="stylesheet" href="https://cdn.rawgit.com/ardhi/Leaflet.MousePosition/master/src/L.Control.MousePosition.css">
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tormi
tormi / geojson-conversion.sh
Created October 27, 2016 15:32 — forked from benbalter/geojson-conversion.sh
Bulk convert shapefiles to geojson using ogr2ogr
# 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"
}