Giter VIP home page Giter VIP logo

leaflet-hash-plus's Introduction

Leaflet Hash Plus

Leaflet mappping plugin for interacting the location hash in the address bar. Allows for you to update the hash and for your code to be notified of changes in the hash (by the user navigating) or manually editing the location hash.

Leaflet-Hash-Plus

This plugin is based on Leaflet-hash. This plugin has seen no activity since 2013 and I'm judging it to abandoned. Out of my own necessity I have I have built Leaflet Hash Plus to support an expanded set of features (some requested for leaflet-hash).

Status

This plugin is current an alpha version: you are welcome to test it but please be aware that the API, names and conventions used within this plugin are liable to change.

Please check the change log for the changes.

Overview

The idea of embedding zoom, latitude and longitude into the location hash is fairly obvious: map.html#13.0000/54.5252/-3.0151 is much better for bookmarking so that when you return to the map it's in the same location/zoom as where you left it, however it doesn't address bookmarking extra map data such as objects, layers and other items that make up the map's state.

Leaflet Hash Plus allows for extra parameters after the zoom/location hash properties, entirely of your choosing.

The approach is low level to allow for it to be used in a wide variety of scenarios. If you want your location hash to reflect enabled layers such as restaurants, shops and transport and the option of showing the weather, you can either encode the data as:

map.html#13.0000/54.5252/-3.0151/layer:restaurants/layer:shops/layer:transport/weather=true

or

map.html#13.0000/54.5252/-3.0151/layers:restaurants,shops,transport/weather=true

The choice is yours. The meta data you pass to the plugin and receive from it is just an array of strings, using the '/' as a delimiter. If the map was loaded using the second link you would receive ['layers:restaurants,shops,transport', 'weather=true'] as the hash meta data.

If your code wanted to update the hash to reflect that the map is now only showing shops and weather is disabled, you would pass this meta data to the plugin ['layers=shops', 'weather=false'].

How does it work?

Documentation and demos can found here.

You can also check out the comments in the source code

leaflet-hash-plus's People

Contributors

gregrobson 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.