Skip to content

Instantly share code, notes, and snippets.

View rowanwins's full-sized avatar
🌐
Making maps

Rowan Winsemius rowanwins

🌐
Making maps
  • Canberra, Australia
View GitHub Profile
@rowanwins
rowanwins / data.geojson
Created August 25, 2020 23:57
GeoJson saved from geojson-editor
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rowanwins
rowanwins / data.geojson
Created August 12, 2020 12:07
GeoJson saved from geojson-editor
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import React, {createRef, Component} from 'react';
import {render} from 'react-dom';
import {StaticMap} from 'react-map-gl';
import DeckGL, {TileLayer, BitmapLayer} from 'deck.gl';
import {interpolateViridis, interpolateInferno} from 'd3-scale-chromatic'
import Pbf from 'pbf'
const MAPBOX_TOKEN = '...'
let INITIAL_VIEW_STATE = {
latitude: -25.734968,
function crossProduct (a, b) {
return (a.x * b.y) - (a.y * b.x)
}
const ab = crossProduct(A, B)
const ac = crossProduct(A, C)
const bd = crossProduct(B, D)
const cd = crossProduct(C, D)
function radiansToDegrees (radians) {
return radians * (180 / Math.PI)
}
function angleToPoint (p, otherPoint) {
const angleRadians = Math.atan2(otherPoint.y - p.y, otherPoint.x - p.x)
return radiansToDegrees(angleRadians)
}
function scenario1 (anglePrev, angleNext, currentPBearing) {
@rowanwins
rowanwins / script.turf-sandbox
Created April 23, 2020 04:29
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map!
const p = turf.point([0,0])
return p
@rowanwins
rowanwins / data.geojson
Created April 2, 2020 10:42
GeoJson saved from geojson-editor
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"comments": "Matching takes place in the order defined in this file. Place code matches before name matches, and smaller regions before larger ones.",
"regionWmsMap": {
"SPC_EEC_CODE": {
"layerName": "SPC_EEC",
"server": "https://tile-test.terria.io/SPC_EEC/{z}/{x}/{y}.pbf",
"serverType": "MVT", <---- This specifies we'll use mapbox vector tiles
"regionIdsFile": "/data/regionids/region_map-SPC_EEC_CODE_SPC_EEC.json",
"regionProp": "country_id", <----- this is the field in your geographic data containing the unique code
"nameProp": "country_name", <----- this is the field in your geographic data containing a name for the region
@rowanwins
rowanwins / data.geojson
Created December 17, 2019 03:33
GeoJson saved from geojson-editor
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rowanwins
rowanwins / sample.geojson
Created February 28, 2019 02:18
Matching Base Z
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.