Skip to content

John905/Leaflet.DistortableImage

 
 

Repository files navigation

Leaflet.DistortableImage

Build Status

A Leaflet extension to distort images -- "rubbersheeting" -- for the MapKnitter.org (src) image georectification service by Public Lab. Leaflet.DistortableImage allows for perspectival distortions of images, client-side, using CSS3 transformations in the DOM.

Advantages include:

  • it can handle over 100 images smoothly, even on a smartphone.
  • images can be right-clicked and downloaded individually in their original state
  • CSS3 transforms are GPU-accelerated in most (all?) browsers, for a very smooth UI
  • no need to server-side generate raster GeoTiffs, tilesets, etc in order to view distorted imagery layers
  • images use DOM event handling for real-time distortion

Download as zip or clone to get a copy of the repo.

This plugin has basic functionality, and is in production as part of MapKnitter, but there are plenty of outstanding issues to resolve. Please consider helping out!

The recommended Google satellite base layer can be integrated using this Leaflet plugin: https://gitlab.com/IvanSanchez/Leaflet.GridLayer.GoogleMutant

Here's a screenshot:

screenshot

Check out this simple demo.

Download as zip or clone to get a copy of the Repo.

To test the code, open index.html in your browser and click and drag the markers on the edges of the image. The image will show perspectival distortions.


Setup

  1. From the root directory, run npm install or sudo npm install
  2. Open examples/index.html in a browser

Contributing

  1. This project uses grunt to do a lot of things, including concatenate source files from /src/ to /DistortableImageOverlay.js. But you may need to install grunt-cli: npm install -g grunt-cli first.
  2. Run grunt in the root directory, and it will watch for changes and concatenate them on the fly.

Contributors

More at https://github.com/publiclab/Leaflet.DistortableImage/graphs/contributors

Packages

No packages published

Languages

  • JavaScript 100.0%