Skip to content

Instantly share code, notes, and snippets.

@matteblair
matteblair / StyleParameterTemplates.cpp
Last active April 19, 2018 23:25
Playing with style parameter access using templates
#include <cassert>
#include <cstdint>
#include <cstdio>
#include <string>
#include <vector>
enum class StyleKey : uint8_t {
anchor,
angle,
buffer,
@matteblair
matteblair / PackedTileAddress.cpp
Created May 17, 2017 19:54
Packing a map tile address into a cozy little 64-bit integer
#include <cassert>
#include <cstdio>
#include <cstdint>
struct TileAddress {
int x = 0;
int y = 0;
int z = 0;
int s = 0;
};
global:
default_order: function() { return feature.sort_key || 0; }
scene:
background:
color: '#8db7d5'
cameras:
iso-camera:
# Manhattan
position: [-74.00976419448854, 40.70532700869127, 16]
type: isometric
@matteblair
matteblair / TileGlob.py
Created June 27, 2016 16:59
Grab some mapzen vector tiles!
import os
import urllib2
# This is a library of tile tools from Mapbox. Install with 'pip install mercantile'.
import mercantile
# Set the bounds of the area you want to download. (West, South, East, North)
bounds = (-105, 39.99, -104.99, 40)
zooms = [14]
# USAGE
# python pngpixelbleed.py input_file [output_file]
#
# input_file: path from the call site to the input image file; supports
# png, jpg, tiff, gif, and psd formats
# output_file: optional path from the call site to the desired output
# image file; supports all input formats except psd; if omitted,
# output will be written to the input file
#
# This script requires the the Pillow python module: