GithubHelp home page GithubHelp logo

isabella232 / leaflet.graticule Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leaflet/leaflet.graticule

0.0 0.0 0.0 158 KB

Lat/Lon Graticule for Leaflet map

HTML 19.11% JavaScript 80.89%

leaflet.graticule's Introduction

leaflet.latlng-graticule

Create a Canvas as ImageOverlay to draw the Lat/Lon Graticule, and show the grid tick label at the edges of the map.

Check out the demo.

Usage example

    L.latlngGraticule({
        showLabel: true,
        zoomInterval: [
            {start: 2, end: 3, interval: 30},
            {start: 4, end: 4, interval: 10},
            {start: 5, end: 7, interval: 5},
            {start: 8, end: 10, interval: 1}
        ]
    }).addTo(map);

Options

  • showLabel: Show the grid tick label at the edges of the map. Default true
  • opacity: Opacity of the Graticule and Label. Default 1
  • weight: The width of the graticule lines. Default 0.8
  • color: The color of the graticule lines. Default #aaa
  • font: Font Style for the tick label. Default 12px Verdana
  • fontColor: Color of the tick label. Default #aaa
  • zoomInterval: Use different intervals in different zoom levels. You can set for both latitude and longitude lines as the example, or set different intervals for latitude and longitude like below:
  zoomInterval: {
    latitude: [
      {start: 4, end: 6, interval: 5},
      {start: 7, end: 20, interval: 1}
    ],
    longitude: [
      {start: 4, end: 6, interval: 10},
      {start: 7, end: 20, interval: 2}
    ]
  }
  • Default:
  zoomInterval: [
    {start: 2, end: 2, interval: 40},
    {start: 3, end: 3, interval: 20},
    {start: 4, end: 4, interval: 10},
    {start: 5, end: 7, interval: 5},
    {start: 8, end: 20, interval: 1}
  ]

Special Options

Some of the projections (like Lambert) is no straight line, set those options to draw a polyline graticule.

  • lngLineCurved: Interval of polyline. Deafult 0
  • latLineCurved: Interval of polyline. Deafult 0

Check out the Lambert projection example.

leaflet.graticule's People

Contributors

lwsu avatar ivansanchez 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.