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 unproject(point, zoom) { | |
return { | |
lng: xLng(point.x, zoom), | |
lat: yLat(point.y, zoom) | |
}; | |
} | |
function xLng(x, zoom) { | |
return x * 360 / Math.pow(2, zoom) - 180; | |
} |
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 createTileIntersect from './testTileIntersection'; | |
/** | |
* @param {string} id The source id | |
* @param {object} options The source options object | |
* @param {object} boundingBox Format: {sw: {lng, lat}, ne: {lng, lat}} | |
* @param {mapbox.Map} map The map to add the source to | |
*/ | |
export default function addSourceWithBounds(id, options, boundingBox, map) { | |
map.addSource(id, options); |
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
'use strict'; | |
const Point = require('point-geometry'); | |
const LngLat = require('../geo/lng_lat'); | |
const LngLatBounds = require('../geo/lng_lat_bounds'); | |
const intersect = require('turf-intersect'); | |
const bboxPolygon = require('turf-bbox-polygon'); | |
module.exports = createTileIntersect(); |
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
#include <node.h> | |
#include <string> | |
#include "Sources/Classes.hpp" | |
namespace nnselector { | |
using v8::FunctionCallbackInfo; | |
using v8::Isolate; | |
using v8::Local; | |
using v8::Object; |
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
#ifdef GL_ES | |
precision mediump float; | |
#else | |
#define lowp | |
#define mediump | |
#define highp | |
#endif | |
// the grey scale raster tile as a texture | |
uniform sampler2D u_image0; |
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
/** | |
* @param {array} valueMap The mapping between grey and data values | |
* @param {function} colorFunction The color mapping function, which defaults to returning a transparent color | |
*/ | |
function createColorTexture(valueMap, colorFunction = () => 'transparent') { | |
const canvas = document.createElement('canvas'); | |
const context = canvas.getContext('2d'); | |
const width = 256; // number of possible pixel color values, 0..255 | |
const height = 1; |
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
// from https://github.com/mapbox/mapbox-gl-shaders/blob/master/src/raster.fragment.glsl | |
void main() { | |
// lookup color from tile texture | |
vec4 color0 = texture2D(u_image0, v_pos0); | |
// lookup color from parent tile texture | |
vec4 color1 = texture2D(u_image1, v_pos1); | |
// cross-fade tile and parent colors based on zoom | |
vec4 color = color0 * u_opacity0 + color1 * u_opacity1; | |
vec3 rgb = color.rgb; |
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
{ | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"plugins": [ | |
"react" | |
], |
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
/* style.css */ | |
.title { | |
font-weight: 700; | |
} | |
/* js-file */ | |
import styles from './style.css'; | |
//... | |
titleElement.className = styles.title; |
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 MeteoGroupInteractiveMap(domElement, options) { | |
constructor(domElement, options) { | |
// Do we want to hide this? | |
// We might need to hide this in closures for map functionalities (zoom, pan etc.) | |
// IMO we should definitly hide it. | |
this.map = new google.maps.Map(domElement, options); | |
// better: | |
const map = new google.maps.Map(domElement, options); | |
this.setupMapControls(map); | |