carto.js/examples/internal/search-geocode.html
2020-06-13 18:34:34 +08:00

78 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Base example | CARTO</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
<!--Include carto styles -->
<link rel="stylesheet" href="../../dist/internal/themes/css/cartodb.css" />
<!-- Include Leaflet -->
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<!-- Include cartodb.js Library -->
<script src="../../dist/internal/cartodb.uncompressed.js"></script>
<!-- Custom Map styles -->
<style>
html,
body,
#map {
font-family: "Open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
height: 100%;
padding: 0;
margin: 0;
background: #162945;
position: relative;
}
</style>
<style>
nav {
padding: 15px;
display: flex;
flex-direction: row;
background: white;
color: #162945;
border-bottom: 1px solid #eee;
font-size: 13px;
}
input {
background: none;
border: none;
}
button {
color: #FFF;
padding: 5px 10px;
background-color: #1785FB;
border-radius: 3px;
}
.CDB-OverlayContainer {
z-index: 999;
}
</style>
<script>
window.mapboxApiKey = 'pk.eyJ1IjoiY2FydG8tdGVhbSIsImEiOiJjamNseTl3ZzQwZnFkMndudnIydnJoMXZxIn0.HycQBkaaV7ZwLkHm5hEmfg';
function loadVizJson(name) {
let url = 'viz/' + name;
fetch(url)
.then(data => data.json())
.then(vizjson => {
cartodb.createVis('map', vizjson)
.done(console.log)
.error(console.error);
});
}
</script>
</head>
<body onload="loadVizJson('003.json')">
<div id="map"></div>
</body>
</html>