Skip to content

Instantly share code, notes, and snippets.

@jbranigan
jbranigan / index.html
Last active May 25, 2023 18:35
Find the nearest point on a highway to the mouse cursor
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Get nearest highway to the mouse pointer</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" />
<style>
body {
@jbranigan
jbranigan / index.html
Last active October 12, 2020 16:46
Join attribute data to Mapbox tiles
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>St Louis Tax Parcels and Zoning</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.mapbox.com/mapbox-gl-js/v1.11.1/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.11.1/mapbox-gl.css" rel="stylesheet" />
<script
@jbranigan
jbranigan / index.html
Last active October 12, 2020 16:47
Find and zoom to nearest N points with Mapbox GL JS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Add a vector tile source</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.12.0/mapbox-gl.css" rel="stylesheet" />
<script src="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.5.1/mapbox-gl-geocoder.min.js"></script>
@jbranigan
jbranigan / index.html
Last active October 1, 2020 15:49
Mapbox single country label and road filtering using iso_3166_1 and match
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Draw GeoJSON points</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.10.1/mapbox-gl.css" rel="stylesheet" />
<style>
body { margin: 0; padding: 0; }
@jbranigan
jbranigan / index.html
Created May 28, 2020 15:46
Mapbox Lunchbox: Optimization API
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Mapbox Optimization Lunchbox</title>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<script src="https://api.mapbox.com/mapbox-gl-js/v1.10.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v1.10.0/mapbox-gl.css" rel="stylesheet" />
<style>
body {
@jbranigan
jbranigan / hospitals.geojson
Created March 13, 2019 12:43
National hospital dataset
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbranigan
jbranigan / index.html
Last active March 8, 2019 18:17
Example search with JSON supplementary data
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>Supplement forward geocoding search results from another data source</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.53.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }