Skip to content

Commit

Permalink
Merge pull request #48 from kartAI/sokefunksjon
Browse files Browse the repository at this point in the history
Søkefunksjon og endring av posisjon
  • Loading branch information
springvalley authored Feb 6, 2024
2 parents f88dd88 + 9fb73e1 commit 174583a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions frontend/pages/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"
integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" crossorigin="">

<!-- Leaflet søkefunksjon-->
<link rel="stylesheet" href="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css" />


<!-- Leaflet Draw CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet.draw/1.0.4/leaflet.draw.css">

Expand Down Expand Up @@ -70,6 +74,9 @@ <h1 class="display-4 fw-normal">Draw shape on map</h1>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"
integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>

<!--Script for leaflet søkefunksjon, ved hjelp av geocoder-->
<script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script>

<!-- Proj4 library for coordinate transformations -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.9.0/proj4.js"
integrity="sha512-lO8f7sIViqr9x5VE6Q72PS6f4FoZcuh5W9YzeSyfNRJ9z/qL3bkweiwG6keGzWS0BQzNDqAWXdBhYzFD6KffIw=="
Expand Down
5 changes: 4 additions & 1 deletion frontend/scripts/map.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Map initialization
var map = L.map('map', { crs: L.CRS.EPSG3857 }).setView([59.887537, 10.523083], 14);
var map = L.map('map', { crs: L.CRS.EPSG3857 }).setView([59.917075, 10.727720], 10);

// Add OpenStreetMap Tiles
var osm = L.tileLayer('https://api.maptiler.com/maps/openstreetmap/{z}/{x}/{y}.jpg?key=gBHYqk3cSCXUdQqICyH3', {
attribution: '<a href=" https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a><a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>'
}).addTo(map);

// Søkefunksjon til leaflet maps
L.Control.geocoder().addTo(map);

// Leaflet draw
var drawnItems = new L.FeatureGroup();
map.addLayer(drawnItems);
Expand Down

0 comments on commit 174583a

Please sign in to comment.