Giter VIP home page Giter VIP logo

leaflet.imagetransform's Introduction

Leaflet.imageTransform

Leaflet plugin to work with tansformed images. Transformation is defined by four anchor points on map, that correspond to corners of the image. Additionally image can be clipped by arbitrary polygon.

##Demos

##Usage

// TopLeft, TopRight, BottomRight, BottomLeft
var anchors = [
        [56.344, 136.595], 
        [56.344, 137.878],
        [55.613, 137.878],
        [55.613, 136.595]],
    clipCoords = [
        [56.301, 136.905],
        [56.150, 137.839],
        [55.639, 137.531],
        [55.788, 136.609],
        [56.301, 136.905]],
    transformedImage = L.imageTransform('img/image.jpg', anchors, { clip: clipCoords });
    
    transformedImage.addTo(map);

L.ImageTransform extends L.ImageOverlay.

###Constructor

new L.ImageTransform(url, anchors, options)
  • url - image URL
  • anchors - 4-elements array of <L.LatLng> points
  • options:
    • clip - array of <L.LatLng> points to clip transformed image. This polygon will be transformed along with image tranformation
    • disableSetClip - <boolean> if true setClip method disabled for performance (Default false).

###Methods

setAnchors(newAnchors)

Recalculate image transformation using new anchors. newAnchors is array with 4 L.LatLng points.

setClip(newClipPoints)

Update clip polygon. newClipPoints is array of L.latLng points. (Only for options.disableSetClip != true)

getClip()

Returns coordinates of current clip polygon (array of L.LatLng). This array will be modified if image transform is changed.

###License

The MIT License (MIT)

leaflet.imagetransform's People

Contributors

originalsin avatar aparshin avatar embreinhardt avatar

Watchers

James Cloos avatar gabssnake avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.