diff --git a/app/package-lock.json b/app/package-lock.json
index f28d4f1..46a6142 100644
--- a/app/package-lock.json
+++ b/app/package-lock.json
@@ -56,7 +56,7 @@
"@angular/compiler-cli": "16.2.7",
"@blockcore/tsconfig": "0.0.1",
"@types/jasmine": "~4.3.1",
- "@types/leaflet": "^1.9.6",
+ "@types/leaflet": "^1.9.8",
"@types/qrcode": "^1.5.2",
"@types/qs": "^6.9.7",
"@types/sanitize-html": "^2.8.0",
@@ -4839,9 +4839,9 @@
"dev": true
},
"node_modules/@types/leaflet": {
- "version": "1.9.6",
- "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.6.tgz",
- "integrity": "sha512-HakGTK5LBBWegNWsAmTlG55zN1zszYec7aG47/z6SzT90bW2vqjmbqk3YKAbrtveO+G7fSTKTYqVbIwAFnTrbg==",
+ "version": "1.9.8",
+ "resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.9.8.tgz",
+ "integrity": "sha512-EXdsL4EhoUtGm2GC2ZYtXn+Fzc6pluVgagvo2VC1RHWToLGlTRwVYoDpqS/7QXa01rmDyBjJk3Catpf60VMkwg==",
"dev": true,
"dependencies": {
"@types/geojson": "*"
diff --git a/app/package.json b/app/package.json
index 177d39e..69a43fb 100644
--- a/app/package.json
+++ b/app/package.json
@@ -62,7 +62,7 @@
"@angular/compiler-cli": "16.2.7",
"@blockcore/tsconfig": "0.0.1",
"@types/jasmine": "~4.3.1",
- "@types/leaflet": "^1.9.6",
+ "@types/leaflet": "^1.9.8",
"@types/qrcode": "^1.5.2",
"@types/qs": "^6.9.7",
"@types/sanitize-html": "^2.8.0",
diff --git a/app/src/app/registries/land/land.component.css b/app/src/app/registries/land/land.component.css
index 8f74243..f8fb5d5 100644
--- a/app/src/app/registries/land/land.component.css
+++ b/app/src/app/registries/land/land.component.css
@@ -61,4 +61,11 @@
.project-logo {
max-height: 64px;
max-width: 64px;
-}
\ No newline at end of file
+}
+
+#map {
+ width: 100%;
+ height: 100%;
+ min-width: 300px;
+ min-height: 400px;
+}
diff --git a/app/src/app/registries/land/land.component.html b/app/src/app/registries/land/land.component.html
index aabf59d..3bed02b 100644
--- a/app/src/app/registries/land/land.component.html
+++ b/app/src/app/registries/land/land.component.html
@@ -1,4 +1,7 @@
+
+
+
{{ project.icon }}
@@ -10,6 +13,7 @@
{{ project.about }}
+
(this.following = profiles)) as Subscription);
}
+
+ initMap() {
+
+ this.map = L.map('map', {
+ attributionControl: true,
+
+ center: [58.358786, 7.547088],
+ zoom: 19,
+
+ minZoom: 10,
+ maxZoom: 23,
+ // maxBounds: [
+ // [58.3, 7.6],
+ // [58.4, 7.5],
+ // ],
+ });
+
+ // initialize the map on the "map" div with a given center and zoom
+ // this.map = L.map('map', {
+ // center: [51.505, -0.09],
+ // zoom: 13,
+ // });
+
+ this.map.attributionControl.setPrefix('');
+
+ L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
+ maxZoom: 25,
+ maxNativeZoom: 19,
+ attribution:
+ '© OpenStreetMap',
+ }).addTo(this.map);
+
+ // L.tileLayer('https://opencache.statkart.no/gatekeeper/gk/gk.open_gmaps?layers=Nibcache_UTM33_EUREF89&zoom={z}&x={x}&y={y}', {
+ // maxZoom: 25,
+ // maxNativeZoom: 19,
+ // attribution:
+ // 'Kartverket',
+ // }).addTo(this.map);
+
+ this.map.on('click', (e: any) => {
+ const lat = this.roundton(e.latlng.lat, 6);
+ const lng = this.roundton(e.latlng.lng, 6);
+
+ console.log('LAT:', lat);
+ console.log('LNG:', lng);
+
+ let num = lat;
+ let decimals = (num % 1) * 1000000;
+ console.log(decimals);
+ let nearest = Math.floor(decimals / 9) * 9;
+ console.log(nearest);
+ let before = nearest * 0.000001;
+ let after = (nearest + 9) * 0.000001;
+
+ console.log(Math.floor(num) + before);
+ console.log(Math.floor(num) + after);
+
+ let num2 = lng;
+ let decimals2 = (num2 % 1) * 1000000;
+ console.log(decimals2);
+ let nearest2 = Math.floor(decimals2 / 18) * 18;
+ console.log(nearest2);
+ let before2 = nearest2 * 0.000001;
+ let after2 = (nearest2 + 18) * 0.000001;
+
+ console.log(Math.floor(num2) + before2);
+ console.log(Math.floor(num2) + after2);
+
+ let tileLat1 = Math.floor(num) + after;
+ let tileLng1 = Math.floor(num2) + after2;
+
+ console.log('PRE-BOUNDS:', [tileLat1, tileLng1]);
+
+ let tileLat2 = tileLat1 - 0.000009;
+ let tileLng2 = tileLng1 - 0.000018;
+
+ tileLat1 = Number(tileLat1.toFixed(6));
+ tileLng1 = Number(tileLng1.toFixed(6));
+ tileLat2 = Number(tileLat2.toFixed(6));
+ tileLng2 = Number(tileLng2.toFixed(6));
+
+ console.log('PRE-BOUNDS 2:', [tileLat2, tileLng2]);
+
+ var bounds: any = [
+ [tileLat1, tileLng1],
+ [tileLat2, tileLng2],
+ ];
+
+ console.log('BOUNDS:', bounds);
+
+ var color;
+ var r = Math.floor(Math.random() * 255);
+ var g = Math.floor(Math.random() * 255);
+ var b = Math.floor(Math.random() * 255);
+ color = 'rgb(' + r + ' ,' + g + ',' + b + ')';
+
+ var borderColor = 'gray';
+
+ var rectangle: any = L.rectangle(bounds, {
+ fillColor: color,
+ color: borderColor,
+ weight: 1,
+ });
+
+ rectangle.propertyId = 'anonymous';
+ rectangle.property = {
+ owner: 'Anonymous',
+ id: 'liberstad/anarchypark/3',
+ location: tileLat1 + ':' + tileLng1 + ':' + tileLat2 + ':' + tileLng2,
+ bounds: bounds,
+ // topCenter: new L.LatLng(lat2, center),
+ // topLeft: new L.LatLng(lat2, lng2),
+ // bottomRight: new L.LatLng(lat1, lng1),
+ };
+
+ this.map.addLayer(rectangle);
+
+ // let before = decimals * 0.0000001;
+ // let after = (decimals + 9) * 0.0000001;
+ // // Log to console
+ // console.log('before', Math.floor(num) + before);
+ // console.log('after', Math.floor(num) + after);
+
+ // decimals = decimals * 0.0000001;
+
+ // let num = 58.358208 * 1000000;
+ // let closest = this.closestNumber(num, 9);
+ // let decimals = num / 1000000;
+
+ // 58.358209
+
+ // lat : 58.358214254714134
+ // lng : 7.54912555217743
+ });
+
+ this.map.whenReady(() => {
+ this.drawGrid();
+ });
+ this.map.on('move', () => {
+ this.drawGrid();
+ });
+ }
+
+ grid: any;
+
+ drawGrid() {
+ if (!this.map) {
+ return;
+ }
+
+ const zoom = this.map.getZoom();
+ const loadFeatures = zoom > 18;
+
+ if (loadFeatures) {
+ if (this.grid) {
+ this.map.removeLayer(this.grid);
+ }
+ this.grid = L.geoJSON(this.features[0], {
+ style: function () {
+ return {
+ color: '#777',
+ stroke: true,
+ weight: 0.5,
+ };
+ },
+ }).addTo(this.map);
+ } else {
+ if (this.grid) {
+ this.map.removeLayer(this.grid);
+ this.grid = null;
+ }
+ }
+ }
+
+ features: any = [
+ {
+ features: [
+ {
+ geometry: {
+ coordinates: [
+ [
+ [7.543198, 58.358218],
+ [7.549565, 58.358218],
+ ],
+ [
+ [7.543198, 58.358227],
+ [7.549565, 58.358227],
+ ],
+ [
+ [7.543198, 58.358236],
+ [7.549565, 58.358236],
+ ],
+ [
+ [7.543198, 58.358245],
+ [7.549565, 58.358245],
+ ],
+ [
+ [7.543198, 58.358254],
+ [7.549565, 58.358254],
+ ],
+ // [
+ // [7.5491, 58.358096],
+ // [7.5491, 58.359221],
+ // ],
+ [
+ [7.549126, 58.358096],
+ [7.549126, 58.359221],
+ ],
+ [
+ [7.549144, 58.358096],
+ [7.549144, 58.359221],
+ ],
+ [
+ [7.549162, 58.358096],
+ [7.549162, 58.359221],
+ ],
+ ],
+ type: 'MultiLineString',
+ },
+ type: 'Feature',
+ properties: {},
+ },
+ ],
+ type: 'FeatureCollection',
+ },
+ ];
}
diff --git a/app/src/styles.scss b/app/src/styles.scss
index 9256bad..4b3a71b 100644
--- a/app/src/styles.scss
+++ b/app/src/styles.scss
@@ -3,6 +3,8 @@
@include mat.core();
+@import "~leaflet/dist/leaflet.css";
+
$primary-palette: (
50: #fef7df,
100: #fdeaae,