|
<!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"> |
|
<link rel="shortcut icon" href=//carto.com/favicon.ico> |
|
<title>Airship + CARTO VL + Vue.JS</title> |
|
|
|
<!-- Airship CSS--> |
|
<link rel="stylesheet" href="https://libs.cartocdn.com/airship-style/v1.0.3/airship.css"> |
|
<link rel="stylesheet" href="https://libs.cartocdn.com/airship-icons/v1.0.3/icons.css"> |
|
|
|
<!-- Mapbox CSS --> |
|
<link href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.50.0/mapbox-gl.css" rel="stylesheet" /> |
|
<link href="https://carto.com/developers/carto-vl/examples/maps/style.css" rel="stylesheet"> |
|
|
|
<!-- Application CSS--> |
|
<link rel="stylesheet" href="styles.css"> |
|
</head> |
|
|
|
<body class="as-app-body"> |
|
<div id="app" class="as-app"> |
|
<as-responsive-content> |
|
<aside class="as-sidebar as-sidebar--left" data-name="Widgets"> |
|
<div class="as-container as-container--border"> |
|
<section class="as-box" :class="{ 'as-color--type-03': !isLayerVisible }"> |
|
<range-slider |
|
title="Filter by population" |
|
v-model="rangePop" |
|
:min-value="0" :max-value="50000000" :step="500000" |
|
:draggable="true" |
|
:format-value="formatter" |
|
:disabled="! isLayerVisible || population.selection.length == 2"> |
|
</range-slider> |
|
<range-slider |
|
title="Filter by latitude" |
|
v-model="latitude" |
|
:min-value="-90" :max-value="90" :step="5" |
|
:draggable="true" |
|
:disabled="! isLayerVisible"> |
|
</range-slider> |
|
<histogram |
|
heading="Population" |
|
description="In millions of inhabitants" |
|
:disable-interactivity="! isLayerVisible" |
|
:show-clear="true" |
|
:data="population.viewport" |
|
@selection-changed="population.selection = $event" |
|
> |
|
</histogram> |
|
<categories |
|
heading="Place types" |
|
:disable-interactivity="! isLayerVisible" |
|
:show-clear-button="true" |
|
:categories="placeTypes.viewport" |
|
@categories-selected="placeTypes.selected = $event" |
|
> |
|
</categories> |
|
</section> |
|
|
|
</div> |
|
|
|
</aside> |
|
<main class="as-main"> |
|
<div class="as-map-area"> |
|
<div id="map"></div> |
|
<div class="as-map-panels" data-name="Layer"> |
|
<div class="as-panel as-panel--top as-panel--right as-panel--vertical "> |
|
<div class="as-panel__element as-p--16"> |
|
<toggle |
|
v-model=isLayerVisible |
|
label="Toggle layer" /> |
|
</div> |
|
<!-- Example of simple formula widget --> |
|
<div class="as-panel__element as-p--16" :class="{ 'as-color--type-03': !isLayerVisible }"> |
|
<h4 class="as-subheader">{{formatter(this.totalPop)}}</h4> |
|
<p class="as-caption">total pop on <strong>{{totalCount}}</strong> places</p> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</main> |
|
</as-responsive-content> |
|
</div> |
|
|
|
<!-- Vue components, for some reason they need to be put |
|
before the other external components to prevent the layer |
|
switch not being properly rendered--> |
|
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script> |
|
<script src="./vue-component-toggle.js"></script> |
|
<script src="./vue-component-range-slider.js"></script> |
|
<script src="./vue-component-categories.js"></script> |
|
<script src="./vue-component-histogram.js"></script> |
|
|
|
<!-- External JS: Airship, CARTO VL, Mapbox JS, Vue--> |
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js"></script> |
|
<script src="https://libs.cartocdn.com/airship-components/v1.0.3/airship.js"></script> |
|
<script src="https://libs.cartocdn.com/carto-vl/v1.1.1/carto-vl.js"></script> |
|
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.50.0/mapbox-gl.js"></script> |
|
|
|
<!-- Main Vue object and mapping logic--> |
|
<script src="./vue_config.js"></script> |
|
<script src="./main.js"></script> |
|
|
|
</body> |
|
|
|
</html> |