A Leaflet TileLayer with getColor(latLng)
HTML JavaScript
Switch branches/tags
Nothing to show
Clone or download
Latest commit e4444fa Mar 21, 2017
Permalink
Failed to load latest commit information.
LICENSE Initial commit Mar 15, 2017
README.md Fix typo Mar 21, 2017
elevation.html Secondary commit Mar 21, 2017
index.html Secondary commit Mar 21, 2017
leaflet-tilelayer-colorpicker.js Secondary commit Mar 21, 2017
mapbox-terrain-rgb.html Secondary commit Mar 21, 2017
package.json add package.json Mar 21, 2017

README.md

leaflet-tilelayer-colorpicker

A Leaflet TileLayer with getColor(latLng)

API

// factory
var layer = L.tilelayer.colorPicker(cors_enabled_url_template,options);
layer.addTo(map);

// getColor(latLng) returns Uint8Array ([r,g,b,a]) or null
var color = layer.getColor(map.getCenter());
var red = color[0];
var green = color[1];
var blue = color[2];

Preconditions

  • CORS enabled Tiles are required.
  • crossOrigin option is set to anonymous by default, DO NOT set to false manually.

Demo : display color under cursor

Demo : display elevation under cursor using Mapbox Terrain-RGB

See also : https://www.mapbox.com/blog/terrain-rgb/

Demo : display elevation under cursor using GSI's DEM PNG Tile

See also : http://maps.gsi.go.jp/development/demtile.html