demarches-normaliennes/app/javascript/new_design/carto.js

25 lines
583 B
JavaScript
Raw Normal View History

import { getData } from '../shared/data';
2018-10-13 10:36:14 +02:00
import { initMap } from '../shared/carto';
import {
drawCadastre,
drawQuartiersPrioritaires,
drawUserSelection
} from './carto/draw';
function initialize() {
2018-10-09 11:35:22 +02:00
if (document.getElementById('map')) {
2018-10-13 10:36:14 +02:00
const position = getData('carto').position;
const map = initMap(position);
const data = getData('carto');
// draw external polygons
drawCadastre(map, data);
drawQuartiersPrioritaires(map, data);
// draw user polygon
drawUserSelection(map, data);
}
}
addEventListener('turbolinks:load', initialize);