Skip to content

Instantly share code, notes, and snippets.

@alexandre-mbm
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandre-mbm/11278226 to your computer and use it in GitHub Desktop.
Save alexandre-mbm/11278226 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Minas Gerais — Brasil</title>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&amp;sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
<!-- <script src="https://raw.githubusercontent.com/shramov/leaflet-plugins/master/layer/tile/Bing.js"></script>-->
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" />
<style>
body {
margin:0;
padding:0;
font-family: helvetica
}
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
var map = L.map('map');
oms_attr = "<a href='http://openstreetmap.org'>OpenStreetMap</a>";
ibge_attr = "<a href='ftp://geoftp.ibge.gov.br/mapas_estatisticos/censo_2010/mapas_de_setores_censitarios'>Mapas de Setores Censitários (2010)</a> by <a href='http://www.ibge.gov.br'>IBGE</a>, hosted by <a href='http://mapbox.com'>Mapbox</a>";
map.setView([-18.50,-44.70], 7);
var ibge_rural = new L.tileLayer(
"https://{s}.tiles.mapbox.com/v3/tmpsantos.i00mo1kj/{z}/{x}/{y}.png",
{maxNativeZoom: 13, opacity: 0.75, attribution: ibge_attr}
);
var ibge_urbano = new L.tileLayer(
"https://{s}.tiles.mapbox.com/v3/tmpsantos.hgda0m6h/{z}/{x}/{y}.png",
{maxZoom: 19, opacity: 0.75, attribution: ibge_attr}
);
var osm = new L.tileLayer(
"http://tile.openstreetmap.org/{z}/{x}/{y}.png",
{attribution: oms_attr}
);
var gmaps = new L.Google('ROADMAP');
var gmaps_hyb = new L.Google("HYBRID");
var gmaps_sat = new L.Google('SATELLITE');
// var bing = new L.BingLayer("Anqm0F_JjIZvT0P3abS6KONpaBaKuTnITRrnYuiJCE0WOhH6ZbE4DzeT6brvKVR5");
map.addLayer(ibge_rural, true);
map.addLayer(ibge_urbano, true);
map.addLayer(osm);
map.addLayer(gmaps);
map.addLayer(gmaps_hyb);
map.addLayer(gmaps_sat);
// map.addLayer(bing);
map.addControl(
new L.Control.Layers(
{
'IBGE ‒ Mapa de Setor Rural': ibge_rural,
'IBGE ‒ Mapa de Setor Urbano': ibge_urbano,
'OpenStreetMap (Mapnik)': osm,
'Google Maps': gmaps,
'Google Hybrid': gmaps_hyb,
'Google Imagery': gmaps_sat,
// 'Bing': bing
},
undefined,
{
'collapsed': false,
'autoZIndex': true
}
)
);
$("#map").fadeOut();
// <input class="leaflet-control-layers-selector" name="leaflet-base-layers" checked="checked" type="radio">
$(window).load(function(){
$("#map").fadeIn();
$('input:radio[name=leaflet-base-layers]')[0].click();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment