npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@myeasyfarm/leaflet-geotiff

v0.3.1

Published

A LeafletJS plugin for displaying geoTIFF raster data.

Downloads

236

Readme

leaflet-geotiff

A LeafletJS plugin for displaying geoTIFF raster data. Data can drawn as colored rasters or directon arrows. The layer can be clipped using a polygon.

DEMO

Sample

Instructions

1. Include the JavaScript file and dependencies

    <script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
    <script src="https://unpkg.com/[email protected]/dist/main.js"></script>
    <script src="https://unpkg.com/[email protected]/src/plotty.js"></script>
    <script src="leaflet-geotiff.js"></script>
    <!-- Load any renderer you need -->
    <script src="leaflet-geotiff-plotty.js"></script>
    <script src="leaflet-geotiff-vector.js"></script>

2. Add a geoTIFF layer

// Create map
var layer = L.leafletGeotiff(url, options).addTo(map);

Parameters:

  • url - GeoTIFF file URL. Currently only EPSG:4326 files are supported.
  • options:
    • bounds - (optional) An array specifying the corners of the data, e.g. [[40.712216, -74.22655], [40.773941, -74.12544]]. If omitted the image bounds will be read from the geoTIFF file.
    • band - (optional, default = 0) geoTIFF band to read.
    • image - (optional, default = 0) geoTIFF image to read.
    • clip - (optional, default = undefined) Clipping polygon, provided as an array of [lat,lon] coordinates. Note that this is the Leaflet [lat,lon] convention, not geoJSON [lon,lat].
    • renderer - Renderer to use (see below).

Renderer

Raster data rendered using Plotty: L.LeafletGeotiff.plotty(options) Options:

  • displayMin - (optional, default = 0) Minimum values to plot.
  • displayMax - (optional, default = 1) Maximum values to plot.
  • clampLow, clampHigh - (optional, default = true) If true values outside displayMin to displayMax will be rendered as if they were valid values.
  • colorScale - (optional, default = "viridis"). Plotty color scale used to render the image.

New color scales can be created using plotty's addColorScale method.

Vector data rendered as arrows: L.LeafletGeotiff.vectorArrows(options) Options:

  • arrowSize - (optional, default = 20) Size in pixels of direction arrows for vector data.

Advanced usage options

  1. Data values can be extracted using the getValueAtLatLng(lat,lng) method.
  2. Custom renderer can be implemented by extending L.LeafletGeotiffRenderer.

Dependencies