All Projects → IHCantabria → Leaflet.canvaslayer.field

IHCantabria / Leaflet.canvaslayer.field

Licence: gpl-3.0
Load and style Raster files in Leaflet (geotiff & asciigrid)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Leaflet.canvaslayer.field

georaster-layer-for-leaflet
Display GeoTIFFs and soon other types of raster on your Leaflet Map
Stars: ✭ 168 (+31.25%)
Mutual labels:  leaflet, raster
Gdal2tiles Leaflet
Generate raster image tiles for use with leaflet.
Stars: ✭ 338 (+164.06%)
Mutual labels:  raster, leaflet
Heatmap.js
🔥 JavaScript Library for HTML5 canvas based heatmaps
Stars: ✭ 5,685 (+4341.41%)
Mutual labels:  leaflet, canvas
Pixelfarm
From Vectors to (sub) Pixels, C# 2D Rendering Library
Stars: ✭ 120 (-6.25%)
Mutual labels:  canvas
Zigzagview
a zigzag view for using for ticket or invoice
Stars: ✭ 121 (-5.47%)
Mutual labels:  canvas
Xsound
Web Audio API Library for Synthesizer, Effects, Visualization, Multi-Track Recording, Audio Streaming, Visual Audio Sprite ...
Stars: ✭ 123 (-3.91%)
Mutual labels:  canvas
Flutter map
A Flutter map widget inspired by Leaflet
Stars: ✭ 1,886 (+1373.44%)
Mutual labels:  leaflet
Canvas grab
🌐 One-click script to synchronize files from Canvas LMS.
Stars: ✭ 118 (-7.81%)
Mutual labels:  canvas
Responsive Sketchpad
A completely responsive, HTML5 canvas sketchpad for use on desktop and mobile browsers
Stars: ✭ 125 (-2.34%)
Mutual labels:  canvas
Wfplayer
🌊 WFPlayer.js is an audio waveform generator
Stars: ✭ 124 (-3.12%)
Mutual labels:  canvas
Wxdraw
A lightweight canvas library which providing 2d draw for weapp 微信小程序2d动画库 😎 🐼
Stars: ✭ 1,625 (+1169.53%)
Mutual labels:  canvas
Mp canvas drawer
🚀 微信小程序上canvas绘制图片助手,一个json就制作分享朋友圈图片
Stars: ✭ 1,611 (+1158.59%)
Mutual labels:  canvas
Kepler
The open source full-stack geosocial network platform
Stars: ✭ 125 (-2.34%)
Mutual labels:  leaflet
Bubbly Bg
Beautiful bubbly backgrounds in less than 1kB (750 bytes gzipped)
Stars: ✭ 1,554 (+1114.06%)
Mutual labels:  canvas
Zfont
💬 Text plugin for Zdog - works with any .ttf font!
Stars: ✭ 126 (-1.56%)
Mutual labels:  canvas
Freeciv Web
Freeciv-web is an Open Source strategy game implemented in HTML5 and WebGL, which can be played online against other players, or in single player mode against AI opponents.
Stars: ✭ 1,626 (+1170.31%)
Mutual labels:  canvas
G2
📊 A highly interactive data-driven visualization grammar for statistical charts.
Stars: ✭ 11,020 (+8509.38%)
Mutual labels:  canvas
Hilo3d
Hilo3d, a WebGL Rendering Engine.
Stars: ✭ 123 (-3.91%)
Mutual labels:  canvas
Gil
Boost.GIL - Generic Image Library | Requires C++11 since Boost 1.68
Stars: ✭ 122 (-4.69%)
Mutual labels:  raster
Elm Canvas
A canvas drawing library for Elm
Stars: ✭ 124 (-3.12%)
Mutual labels:  canvas

IH.Leaflet.CanvasLayer.Field

A plugin for LeafletJS that adds layers to visualize fields (aka Rasters) from ASCIIGrid or GeoTIFF files (EPSG:4326).

Warning! New url for npm install

npm install ih-leaflet-canvaslayer-field

Leaflet.CanvasLayer.Field EXAMPLES

Travis CI npm version

It includes:

  • L.CanvasLayer.ScalarField - a "typical" raster layer (from scalars such as DTM, temperature...) that can be rendered with different color scales and arrows.
  • L.CanvasLayer.VectorFieldAnim - an animated layer representing a vector field (wind, currents...), based on the excellent earth by Cameron Becarrio

This plugin extends L.CanvasLayer Leaflet Plugin by Stanislav Sumbera and uses geotiff.js by Fabian Schindler. For the 'arrow' renderer, it includes a modified portion of leaflet-geotiff by Stuart Matthews.

Demo

The figures below show the results for three basic layers, showing Currents in the Bay of Santander (Spain)

Example

Example

Example

The following animation shows the usage of the built-in Layers Player controller to display an hypothetical precipitation event in the North American Great Lakes region.

Example

If you want to have a quick testing environment, have a look at these snippets at codepen.io:

Instructions

Basic Usage

  1. Get the JavaScript file. You can grab a copy from ongoing work at leaflet.canvaslayer.field.js. If you prefer to work locally with npm, then go with npm install ih-leaflet-canvaslayer-field --save. Every version is automatically published to unpkg CDN (last version at: https://unpkg.com/leaflet-canvaslayer-field/dist/leaflet.canvaslayer.field.js)

  2. Include the JavaScript dependencies in your page:

    <!-- CDN references -->
    <script src="//npmcdn.com/[email protected]/dist/leaflet.js"></script>
    
    <script src="//d3js.org/d3.v4.min.js"></script>
    <script src="//npmcdn.com/[email protected]/dist/geotiff.js"></script> <!-- optional -->

    <!-- Plugin -->
    <script src="https://ihcantabria.github.io/Leaflet.CanvasLayer.Field/dist/leaflet.canvaslayer.field.js"></script>
  1. Prepare a Raster File with your favourite GIS tool, using EPSG:4326 (ASCII Grid or GeoTIFF format)

  2. Create a ScalarField layer and add it to the map, using your raster files as source (e.g. this .asc)

d3.text("https://ihcantabria.github.io/Leaflet.CanvasLayer.Field/data/Bay_Speed.asc", function (asc) {
    var s = L.ScalarField.fromASCIIGrid(asc);
    var layer = L.canvasLayer.scalarField(s).addTo(map);

    map.fitBounds(layer.getBounds());
});
  1. Or try the VectorFieldAnim layer, adding also a popup (previously you have to prepare 2 raster files, with 'u' and 'v' components in 'm/s'):
d3.text('https://ihcantabria.github.io/Leaflet.CanvasLayer.Field/data/Bay_U.asc', function(u) {
    d3.text('https://ihcantabria.github.io/Leaflet.CanvasLayer.Field/data/Bay_V.asc', function(v) {
        let vf = L.VectorField.fromASCIIGrids(u, v);
        let layer = L.canvasLayer.vectorFieldAnim(vf).addTo(map);
        map.fitBounds(layer.getBounds());

        layer.on('click', function(e) {
            if (e.value !== null) {
                let vector = e.value;
                let v = vector.magnitude().toFixed(2);
                let d = vector.directionTo().toFixed(0);
                let html = (`<span>${v} m/s to ${d}&deg</span>`);
                let popup = L.popup()
                    .setLatLng(e.latlng)
                    .setContent(html)
                    .openOn(map);
            }
        });
    });
});

Developers

  • This plugin works with Leaflet >=v1.0.0
  • node & npm are needed to build and test the plugin, and it uses webpack 2 as module bundler. To use it just:
npm install
npm run start
  • Navigate to docs/index.html for some examples.

License

Licensed under the GNU General Public License v3.0

This software currently depends a copy of:

At runtime it uses:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].