Skip to content

Instantly share code, notes, and snippets.

@tyrasd
tyrasd / index.js
Last active March 7, 2024 12:05
osm cuisine values by count
const key = 'cuisine';
fetch(`https://taginfo.openstreetmap.org/api/4/key/overview?key=${key}`)
.then(x => x.json())
.then(d => Math.ceil(d.data.counts[0].values / 999))
.then(numPages => Array.from({length: numPages}, (_, i) => i + 1))
.then(pages => Promise.all(pages
.map(i => `https://taginfo.openstreetmap.org/api/4/key/values?key=${key}&page=${i}&rp=999&sortname=count_all&sortorder=desc`)
.map(p => fetch(p).then(x => x.json())))
.then(data => {
@tyrasd
tyrasd / index.md
Created August 19, 2022 13:00
iD releases playground
@tyrasd
tyrasd / index.js
Created June 8, 2021 09:02
overpass turbo URL shortener
var http = require('http');
var url = require('url');
var redis = require('redis');
var base62 = require('base62');
var db = redis.createClient("/var/run/redis/redis-server.sock");
http.createServer(function (req, res) {
if (req.method == "OPTIONS") {
res.writeHead(200, {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@font-face {
font-family: 'Rubik';
font-style: normal;
font-weight: 400;
src:
local('Rubik'),
local('Rubik-Regular'),
url('./rubik-v4-latin-regular.woff2') format('woff2'),
url('./rubik-v4-latin-regular.woff') format('woff');
}
@tyrasd
tyrasd / index.html
Last active June 18, 2022 13:35
minimal Overpass Leaflet example
<!DOCTYPE html>
<html>
<head>
<title>Example: Overpass-API with Leaflet.js</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
<style>
body {
padding: 0;
@tyrasd
tyrasd / index.html
Created April 12, 2017 19:14 — forked from anonymous/index.html
Empty Style
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Empty Style Preview</title>
<link rel="stylesheet" type="text/css" href="https://api.mapbox.com/mapbox-gl-js/v0.28.0/mapbox-gl.css" />
<script src="https://api.mapbox.com/mapbox-gl-js/v0.28.0/mapbox-gl.js"></script>
<style>
@tyrasd
tyrasd / index.html
Last active April 17, 2017 07:12 — forked from anonymous/index.html
st flurnamen
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>st-flurnamen Preview</title>
<link rel="stylesheet" type="text/css" href="https://api.mapbox.com/mapbox-gl-js/v0.35.1/mapbox-gl.css" />
<script src="https://api.mapbox.com/mapbox-gl-js/v0.35.1/mapbox-gl.js"></script>
<style>
body { margin:0; padding:0; background-color:black; }
@tyrasd
tyrasd / index.html
Last active March 23, 2023 18:53 — forked from milkbread/index.html
JavaScript: Convert GeoJSON Polygon to WKT
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title>Convert GeoJSON</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="poly.js"></script>
</head>
@tyrasd
tyrasd / _results-20161205.csv
Last active January 9, 2017 10:24
list of descending timestamps between ascending versions of an osm object (based on history-161205.osm.pbf)
type id version
node 334489687 3
node 354919611 5
node 1138179775 4
node 1429840833 5
node 1470794747 2
node 1472871495 2
node 1478934528 2
node 1485196779 2
node 1487705069 2