Skip to content

Instantly share code, notes, and snippets.

@manuelroth
manuelroth / index.js
Last active May 18, 2023 07:51
A very simple node.js server for serving vector tiles from an mbtiles file
var express = require("express"),
app = express(),
MBTiles = require('mbtiles'),
p = require("path");
// Enable CORS and set correct mime type/content encoding
var header = {
"Access-Control-Allow-Origin":"*",
"Access-Control-Allow-Headers":"Origin, X-Requested-With, Content-Type, Accept",
"Content-Type":"application/x-protobuf",
@manuelroth
manuelroth / index.html
Last active July 27, 2016 11:26
Display a map with custom map style
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>MapBox GL JS with osm2vectortiles Example</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='//api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.js'></script>
<link href='//api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@manuelroth
manuelroth / bright-v9.json
Last active May 23, 2016 20:16
Mapbox GL Style with custom sources for vector tiles, sprites and glyphs
{
"version": 8,
"name": "Bright",
"sources": {
"mapbox": {
"type": "vector",
"tiles": [
"http://localhost:8080/data/osm2vectortiles/{z}/{x}/{y}.pbf"
],
"maxzoom": 14
@manuelroth
manuelroth / bright.html
Last active July 27, 2016 11:23
Mapbox GL JS example with bright style
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>OSM2VectorTiles with Bright style</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@manuelroth
manuelroth / basic.html
Last active July 27, 2016 11:22
Mapbox GL JS example with basic style
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>OSM2VectorTiles with Basic style</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
@manuelroth
manuelroth / gist:962eb299e6d59b038779e7857cd64b3f
Created March 5, 2018 21:26
Vega: Projection property fit "Unsupported parameter object" error
{
"$schema": "https://vega.github.io/schema/vega/v3.json",
"width": 960,
"height": 500,
"autosize": "none",
"data": [
{
"name": "unemp",
"url": "data/unemployment.tsv",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
[
{
"stadtquartier": "4",
"amount": 1
},
{
"stadtquartier": "6",
"amount": 1
},
{
[
{
"stadtkreis": 1,
"amount": 130
},
{
"stadtkreis": 2,
"amount": 673
},
{
@manuelroth
manuelroth / bundle-esm.js
Last active September 21, 2018 15:46
ES Module loading with fallback to SystemJS for IE11
function noop(){}function assign(t,e){for(var a in e)t[a]=e[a];return t}function assignTrue(t,e){for(var a in e)t[a]=1;return t}function callAfter(t,e){return 0===e&&t(),function(){--e||t()}}function run(t){t()}function append(t,e){t.appendChild(e)}function insert(t,e,a){t.insertBefore(e,a)}function detachNode(t){t.parentNode.removeChild(t)}function createElement(t){return document.createElement(t)}function createSvgElement(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function createText(t){return document.createTextNode(t)}function createComment(){return document.createComment("")}function addListener(t,e,a){t.addEventListener(e,a,!1)}function removeListener(t,e,a){t.removeEventListener(e,a,!1)}function setAttribute(t,e,a){t.setAttribute(e,a)}function setData(t,e){t.data=""+e}function setStyle(t,e,a){t.style.setProperty(e,a)}function destroyBlock(t,e){t.d(1),e[t.key]=null}function outroAndDestroyBlock(t,e){t.o(function(){destroyBlock(t,e)})}function updateKeyedEach(t,e,a,r,n,s,i,o,c,l,u