Interactive map of Catalunya using OpenStreetMaps library.
https://github.com/Leaflet/Leaflet.markercluster
- Add the following files to your html page
Inside the head tag at the end
<!-- needed dependencies -->
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.5.3/dist/MarkerCluster.Default.css" />
<link href="https://fonts.googleapis.com/css?family=Droid+Serif" rel="stylesheet">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"
integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="
crossorigin=""/>
<!-- Make sure you put this AFTER Leaflet's CSS -->
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin="">
</script>
<link href="css/catalunya-omap.css" rel="stylesheet" type="text/css">
in your body
<div id="container">
<div id="primary-div" class="primary-div_big">
<div id="map-container">
<div id="omap"></div>
</div>
</div>
<div id="secondary-div">
<div id="error">
<h2>No hi ha cap edificació disponible per aquesta comcarca</h2>
</div>
<input type="text" id="search-llista" placeholder="cercar..">
<div id="list">
<ul id="map-list"></ul>
</div>
</div>
</div>
...
<footer>
<script type="text/javascript" src="assets/js/catalunya-omap/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="assets/js/catalunya-omap/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/catalunya-omap/catalunya-omap-path.min.js"></script>
<script type="text/javascript" src="assets/js/catalunya-omap/catalunya-omap.min.js"></script>
</footer>Inside the catalunya-omap-main we can find the important code :
const monument = new MonumentBuilder('gMap');
const mapManager = await monument.create()Since version 1.0 uses webpack.
add a .env file and setup the required env variables. Check the .env.sample for
more information, and create the following files:
.env (local)
.env.production (production)
SERVER_HOST='http://localhost:9000/'
DEBUG=true
USER_POSITION=false
USE_MARKER_CLUSTER=true
NOTE: it is important that the server host ends with a '/' like in the sample.
Building the theme requires node.js. We recommend you update to the latest version of npm: npm install -g npm@latest.
From the command line:
- Navigate to the theme directory, then run
npm install - Build
npm run buildLocal - Start
npm run start - (optional) buildWatch
npm run buildWatch
Open your browser localhost:9000
test— run all the teststestWatch— run all the tests while watching the changes of the filesbuildLocal— Compile (local) and optimize the files in your web directorybuildProd— Compile (production) and optimize the files in your web directorybuildWatch— Compile (local) and optimize the files in your web directory and watch for changes to update the filesstart— Starts a web server
