Skip to content

Instantly share code, notes, and snippets.

View yuletide's full-sized avatar
🤘

Alex Yule yuletide

🤘
View GitHub Profile
@yuletide
yuletide / .block
Last active April 5, 2022 17:44 — forked from alexmacy/.block
Projection Transitions v4
license: gpl-3.0
@yuletide
yuletide / get_defs.php
Last active January 19, 2023 17:29
EPSG postgis scraper for `node-proj4js-defs`
<?php
/* from http://lists.osgeo.org/pipermail/openlayers-users/2010-June/017976.html */
$conn_string = "host=localhost port=5432
dbname=mydatabase_with_postgis_activated user=my_user password=my_password";
$link = pg_connect($conn_string) or die("Could not connect");
$start_epsg = 'Proj4js.defs["EPSG:';
$end_epsg_start_proj4js = '"] = "';
$end_proj4js ='";';
@yuletide
yuletide / getStyleComponents.js
Last active February 23, 2023 20:52
Get a list of all mapbox layer ids grouped by feature component for easy toggling of mapbox streets layers
#!/usr/bin/env node
// usage node getStyleComponents.js > groups.json
// looks for a style named style.json, rename to match or use process.argv if you want
// then save these ids to an array and toggle with:
// layers?.forEach(lyr => map.setLayoutProperty(lyr, "visibility", value));
const style = require("./style.json");
const components = style.layers.reduce((map, lyr) => {