Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simply return a valid GeoJSON and it will be rendered on the map! | |
const p = turf.point([0,0]) | |
return p |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.