Skip to content

Instantly share code, notes, and snippets.

@sevko sevko/
Last active Aug 29, 2015

What would you like to do?
How to add a map to any webpage without Google Maps.

adding a map to any website

Rendering a web-map without resorting to Google Maps is surprisingly trivial. The following example uses the incredible open-source Leaflet library and map tiles provided by OpenStreetMap. Check it out on rawgit.

<link rel="stylesheet" href="" />
<script src=""></script>
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
body {
margin: 0;
padding: 0;
<div id="map"></div>
var map ="map").setView([40.7259, -73.9806], 5);
var tileUrl = "http://{s}{z}/{x}/{y}.png";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.