Skip to content

bily/leaflet-osm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leaflet-osm is a Leaflet plugin for rendering 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 Example

$.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(xml).addTo(map);
    map.fitBounds(layer.getBounds());
  }
});

Well, this would work if openstreetmap.org's API supported CORS. Right now it'll only work if your code is running on openstreetmap.org itself.

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.

About

OpenStreetMap plugin for Leaflet

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published