Giter Site home page Giter Site logo

leaflet-osm's Introduction

leaflet-osm is a Leaflet plugin for rendering tile and vector data from openstreetmap.org.

For example, the openstreetmap.org website could use it to highlight a particular way or node on the base map.

Usage Examples

Tile Layers

new L.OSM.Mapnik().addTo(map);

// L.OSM.CycleMap and L.OSM.TransportMap require an API key:
// http://www.thunderforest.com/blog/apikeys-now-available/
new L.OSM.CycleMap({apikey: '...'}).addTo(map);
new L.OSM.TransportMap({apikey: '...'}).addTo(map);

Data Layer

$.ajax({
  url: "http://www.openstreetmap.org/api/0.6/node/164979149",
  // or "http://www.openstreetmap.org/api/0.6/way/52477381/full"
  dataType: "xml",
  success: function (xml) {
    var layer = new L.OSM.DataLayer(xml).addTo(map);
    map.fitBounds(layer.getBounds());
  }
});

Contributing

leaflet-osm is tested with node.js using mocha and chai:

$ npm install -g mocha
$ npm install
$ mocha

License

Copyright 2012 John Firebaugh

BSD License (see the BSD-LICENSE file)

Portions derived from OpenLayers. See BSD-LICENSE for details.

leaflet-osm's People

Contributors

jfirebaugh avatar tomhughes avatar grischard avatar gravitystorm avatar frodrigo avatar bagage avatar iooi-sqar avatar tyrasd avatar mortonfox avatar pnorman avatar johnjohndoe avatar jocelynj avatar

Watchers

James Cloos 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.