Compare commits
	
		
			No commits in common. "6f632c3ee21bd75b74254ebeefa2258ea4a42886" and "9873b22c4c0fc1335ec98b0e13b16fffc317bb70" have entirely different histories.
		
	
	
		
			6f632c3ee2
			...
			9873b22c4c
		
	
		
@ -13,14 +13,13 @@
 | 
				
			|||||||
    <script type="importmap">
 | 
					    <script type="importmap">
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        "imports": {
 | 
					        "imports": {
 | 
				
			||||||
            "three": "./js/vendor/three/build/three.module.js",
 | 
					        "three": "./js/vendor/three/build/three.module.js",
 | 
				
			||||||
            "@photo-sphere-viewer/core": "./js/vendor/@photo-sphere-viewer/core/index.module.js",
 | 
					        "@photo-sphere-viewer/core": "./js/vendor/@photo-sphere-viewer/core/index.module.js",
 | 
				
			||||||
            "@hotwired/stimulus": "./js/vendor/@hotwired/stimulus/dist/stimulus.js"
 | 
					        "@hotwired/stimulus": "./js/vendor/@hotwired/stimulus/dist/stimulus.js"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    </script>
 | 
					    </script>
 | 
				
			||||||
    <script src="./js/vendor/proj4/dist/proj4.js"></script>
 | 
					    <script src="js/vendor/leaflet/dist/leaflet.js"></script>
 | 
				
			||||||
    <script src="js/vendor/leaflet/dist/leaflet-src.js"></script>
 | 
					 | 
				
			||||||
    <script src="js/vendor/leaflet.markercluster/dist/leaflet.markercluster.js"></script>
 | 
					    <script src="js/vendor/leaflet.markercluster/dist/leaflet.markercluster.js"></script>
 | 
				
			||||||
    <script src="js/vendor/@kalisio/leaflet-graphicscale/dist/Leaflet.GraphicScale.min.js"></script>
 | 
					    <script src="js/vendor/@kalisio/leaflet-graphicscale/dist/Leaflet.GraphicScale.min.js"></script>
 | 
				
			||||||
    <script src="js/index.js" type="module"></script>
 | 
					    <script src="js/index.js" type="module"></script>
 | 
				
			||||||
@ -284,18 +283,14 @@
 | 
				
			|||||||
            </template>
 | 
					            </template>
 | 
				
			||||||
            <aside class="menu ml-4 mt-3" data-id="cartography-aside">
 | 
					            <aside class="menu ml-4 mt-3" data-id="cartography-aside">
 | 
				
			||||||
                <button title="Chiudi menu" class="delete is-pulled-right" data-action="menu#closeCartography"></button>
 | 
					                <button title="Chiudi menu" class="delete is-pulled-right" data-action="menu#closeCartography"></button>
 | 
				
			||||||
                <ul class="menu-list">
 | 
					                <p class="menu-label is-size-5 mt-2 is-clickable" data-id="historic">
 | 
				
			||||||
                    <li>
 | 
					 | 
				
			||||||
                        <input type="checkbox" data-controller="layer" data-action="layer#toggleCadastral" />
 | 
					 | 
				
			||||||
                        Catasto Agenzia delle Entrate (particelle e fabbricati)
 | 
					 | 
				
			||||||
                    </li>
 | 
					 | 
				
			||||||
                </ul>
 | 
					 | 
				
			||||||
                <p class="menu-label is-size-5 mt-4 is-clickable" data-id="historic">
 | 
					 | 
				
			||||||
                    <span role="button" data-action="click->menu#toggle" data-id="historic">
 | 
					                    <span role="button" data-action="click->menu#toggle" data-id="historic">
 | 
				
			||||||
                        Catasto storico
 | 
					                        Catasto storico
 | 
				
			||||||
                        <span class="icon pl-2">
 | 
					                        <!--
 | 
				
			||||||
                            <i class="fa fa-chevron-right" data-menu-target="icon" data-id="historic"></i>
 | 
					                            <span class="icon pl-2">
 | 
				
			||||||
                        </span>
 | 
					                                <i class="fa fa-chevron-right" data-menu-target="icon" data-id="historic"></i>
 | 
				
			||||||
 | 
					                            </span>
 | 
				
			||||||
 | 
					                        -->
 | 
				
			||||||
                    </span>
 | 
					                    </span>
 | 
				
			||||||
                </p>
 | 
					                </p>
 | 
				
			||||||
            </aside>
 | 
					            </aside>
 | 
				
			||||||
 | 
				
			|||||||
@ -33,14 +33,6 @@ export default class extends Controller {
 | 
				
			|||||||
        else map.removeLayer(currentLayer);
 | 
					        else map.removeLayer(currentLayer);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    toggleCadastral() {
 | 
					 | 
				
			||||||
        const map = GisState.map;
 | 
					 | 
				
			||||||
        const wms = GisState.cartography.cadastral;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (!map.hasLayer(wms)) map.addLayer(wms);
 | 
					 | 
				
			||||||
        else map.removeLayer(wms);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * @todo Use Stimulus values?
 | 
					     * @todo Use Stimulus values?
 | 
				
			||||||
     * @param {Event} event 
 | 
					     * @param {Event} event 
 | 
				
			||||||
 | 
				
			|||||||
@ -9,15 +9,16 @@ import { GisState } from "./state.js";
 | 
				
			|||||||
const MAPBOX_TOKEN = 'pk.eyJ1Ijoibmljb3BhIiwiYSI6ImNseWNwZjJjbjFidzcya3BoYTU0bHg4NnkifQ.3036JnCXZTEMt6jVgMzVRw';
 | 
					const MAPBOX_TOKEN = 'pk.eyJ1Ijoibmljb3BhIiwiYSI6ImNseWNwZjJjbjFidzcya3BoYTU0bHg4NnkifQ.3036JnCXZTEMt6jVgMzVRw';
 | 
				
			||||||
const BASE_URL = location.href;
 | 
					const BASE_URL = location.href;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let API_URL = API_CONFIG.prod;
 | 
					let API_URL = '';
 | 
				
			||||||
 | 
					if (BASE_URL.includes('localhost')) {
 | 
				
			||||||
if (!BASE_URL.includes('cnr.it')) {
 | 
					 | 
				
			||||||
    API_URL = API_CONFIG.dev;
 | 
					    API_URL = API_CONFIG.dev;
 | 
				
			||||||
 | 
					} else {
 | 
				
			||||||
 | 
					    API_URL = API_CONFIG.prod;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
GisState.apiUrl = API_URL;
 | 
					GisState.apiUrl = API_URL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Global leaflet and proj4
 | 
					// Global leaflet
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @namespace GIS
 | 
					 * @namespace GIS
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@ -123,23 +124,6 @@ GIS.initMap = async function (mapId, zoomLevel = this.INIT_ZOOM) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    GisState.map = map;
 | 
					    GisState.map = map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const reprojectedWMSLayer = GIS.reprojectWMS();
 | 
					 | 
				
			||||||
    const wmsLayer = new reprojectedWMSLayer(
 | 
					 | 
				
			||||||
        'https://wms.cartografia.agenziaentrate.gov.it/inspire/wms/ows01.php?',
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            layers: 'CP.CadastralParcel,fabbricati',
 | 
					 | 
				
			||||||
            transparent: true,
 | 
					 | 
				
			||||||
            format: 'image/png',
 | 
					 | 
				
			||||||
            version: '1.1.1',
 | 
					 | 
				
			||||||
            minZoom: 15,
 | 
					 | 
				
			||||||
            maxZoom: this.MAX_ZOOM,
 | 
					 | 
				
			||||||
            tileSize: 1024,
 | 
					 | 
				
			||||||
            opacity: 0.6,
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    GisState.cartography.cadastral = wmsLayer;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return map;
 | 
					    return map;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -175,7 +159,7 @@ GIS.getImageOverlay = async function (imageId) {
 | 
				
			|||||||
        `/webgis/img/geo/${imageData.filename}`,
 | 
					        `/webgis/img/geo/${imageData.filename}`,
 | 
				
			||||||
        bounds,
 | 
					        bounds,
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            opacity: 0.6,
 | 
					            opacity: 0.8,
 | 
				
			||||||
            alt: `Immagine georeferita (${imageData.label})`,
 | 
					            alt: `Immagine georeferita (${imageData.label})`,
 | 
				
			||||||
            label: `geoimage:${imageData.id}:${imageData.label}`,
 | 
					            label: `geoimage:${imageData.id}:${imageData.label}`,
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@ -574,51 +558,6 @@ GIS.featurePopup = function (layerName, feature) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return content[layerName];
 | 
					    return content[layerName];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Reproject WMS layer to map's CRS
 | 
					 | 
				
			||||||
 * @todo Parametrize CRS?
 | 
					 | 
				
			||||||
 * @returns {L.TileLayer.WMS}
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
GIS.reprojectWMS = function (crs = 'EPSG:4258') {
 | 
					 | 
				
			||||||
    // Define EPSG:4258
 | 
					 | 
				
			||||||
    proj4.defs('EPSG:4258', "+proj=longlat +ellps=GRS80 +no_defs +type=crs");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const reprojectedWMSLayer =  L.TileLayer.WMS.extend({
 | 
					 | 
				
			||||||
        getTileUrl(tilePoint) {
 | 
					 | 
				
			||||||
            const map = GisState.map;
 | 
					 | 
				
			||||||
            //const crs = map.options.crs;
 | 
					 | 
				
			||||||
            const tileSize = this.getTileSize();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            //const geoPoint = L.point(tilePoint.x, tilePoint.y);
 | 
					 | 
				
			||||||
            const nwPoint = L.point(
 | 
					 | 
				
			||||||
                tilePoint.x * tileSize.x,
 | 
					 | 
				
			||||||
                tilePoint.y * tileSize.y,
 | 
					 | 
				
			||||||
            )
 | 
					 | 
				
			||||||
            const sePoint = nwPoint.add(L.point(tileSize));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            const nw = map.unproject(nwPoint, tilePoint.z);
 | 
					 | 
				
			||||||
            const se = map.unproject(sePoint, tilePoint.z);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            const [minX, minY] = proj4('EPSG:4326', 'EPSG:4258', [nw.lng, se.lat]);
 | 
					 | 
				
			||||||
            const [maxX, maxY] = proj4('EPSG:4326', 'EPSG:4258', [se.lng, nw.lat]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            const bbox = [minX, minY, maxX, maxY].join(',');
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return this._url + L.Util.getParamString({
 | 
					 | 
				
			||||||
                    ...this.wmsParams,
 | 
					 | 
				
			||||||
                    bbox,
 | 
					 | 
				
			||||||
                    width: tileSize.x,
 | 
					 | 
				
			||||||
                    height: tileSize.y,
 | 
					 | 
				
			||||||
                    srs: 'EPSG:4258'
 | 
					 | 
				
			||||||
                },
 | 
					 | 
				
			||||||
                this._url,
 | 
					 | 
				
			||||||
                true
 | 
					 | 
				
			||||||
            );
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return reprojectedWMSLayer;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Fetch data from API
 | 
					 * Fetch data from API
 | 
				
			||||||
 * @param {string} recordUri The URI to be appendend to the API's base URL
 | 
					 * @param {string} recordUri The URI to be appendend to the API's base URL
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,6 @@
 | 
				
			|||||||
    "fontawesome-free": "^1.0.4",
 | 
					    "fontawesome-free": "^1.0.4",
 | 
				
			||||||
    "leaflet": "^1.9.4",
 | 
					    "leaflet": "^1.9.4",
 | 
				
			||||||
    "leaflet.markercluster": "^1.5.3",
 | 
					    "leaflet.markercluster": "^1.5.3",
 | 
				
			||||||
    "proj4": "^2.9.4",
 | 
					 | 
				
			||||||
    "spotlight.js": "^0.7.8"
 | 
					    "spotlight.js": "^0.7.8"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {}
 | 
					  "devDependencies": {}
 | 
				
			||||||
 | 
				
			|||||||
@ -39,7 +39,6 @@ export const GisState = {
 | 
				
			|||||||
    apiUrl : null,
 | 
					    apiUrl : null,
 | 
				
			||||||
    cartography : {
 | 
					    cartography : {
 | 
				
			||||||
        historic: [],
 | 
					        historic: [],
 | 
				
			||||||
        cadastral: null,
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -39,19 +39,6 @@ leaflet@^1.9.4:
 | 
				
			|||||||
  resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.9.4.tgz#23fae724e282fa25745aff82ca4d394748db7d8d"
 | 
					  resolved "https://registry.yarnpkg.com/leaflet/-/leaflet-1.9.4.tgz#23fae724e282fa25745aff82ca4d394748db7d8d"
 | 
				
			||||||
  integrity sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==
 | 
					  integrity sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mgrs@1.0.0:
 | 
					 | 
				
			||||||
  version "1.0.0"
 | 
					 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/mgrs/-/mgrs-1.0.0.tgz#fb91588e78c90025672395cb40b25f7cd6ad1829"
 | 
					 | 
				
			||||||
  integrity sha512-awNbTOqCxK1DBGjalK3xqWIstBZgN6fxsMSiXLs9/spqWkF2pAhb2rrYCFSsr1/tT7PhcDGjZndG8SWYn0byYA==
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
proj4@^2.9.4:
 | 
					 | 
				
			||||||
  version "2.19.4"
 | 
					 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/proj4/-/proj4-2.19.4.tgz#38cf347309f523309ead94d565788de94f07098f"
 | 
					 | 
				
			||||||
  integrity sha512-1l6JiJ2ZOzXIoo6k64diOQVOvHIF0IACMrHTaFHrEQmuo1tY1vb73mrWfTSyPH+muc0Lut4zuj5encvB1Ccuhg==
 | 
					 | 
				
			||||||
  dependencies:
 | 
					 | 
				
			||||||
    mgrs "1.0.0"
 | 
					 | 
				
			||||||
    wkt-parser "^1.5.1"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
spotlight.js@^0.7.8:
 | 
					spotlight.js@^0.7.8:
 | 
				
			||||||
  version "0.7.8"
 | 
					  version "0.7.8"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/spotlight.js/-/spotlight.js-0.7.8.tgz#0620371701508222d736e0658e8db3fbe9ddc53b"
 | 
					  resolved "https://registry.yarnpkg.com/spotlight.js/-/spotlight.js-0.7.8.tgz#0620371701508222d736e0658e8db3fbe9ddc53b"
 | 
				
			||||||
@ -61,8 +48,3 @@ three@^0.169.0:
 | 
				
			|||||||
  version "0.169.0"
 | 
					  version "0.169.0"
 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/three/-/three-0.169.0.tgz#4a62114988ad9728d73526d1f1de6760c56b4adc"
 | 
					  resolved "https://registry.yarnpkg.com/three/-/three-0.169.0.tgz#4a62114988ad9728d73526d1f1de6760c56b4adc"
 | 
				
			||||||
  integrity sha512-Ed906MA3dR4TS5riErd4QBsRGPcx+HBDX2O5yYE5GqJeFQTPU+M56Va/f/Oph9X7uZo3W3o4l2ZhBZ6f6qUv0w==
 | 
					  integrity sha512-Ed906MA3dR4TS5riErd4QBsRGPcx+HBDX2O5yYE5GqJeFQTPU+M56Va/f/Oph9X7uZo3W3o4l2ZhBZ6f6qUv0w==
 | 
				
			||||||
 | 
					 | 
				
			||||||
wkt-parser@^1.5.1:
 | 
					 | 
				
			||||||
  version "1.5.2"
 | 
					 | 
				
			||||||
  resolved "https://registry.yarnpkg.com/wkt-parser/-/wkt-parser-1.5.2.tgz#a8eaf86ac2cc1d0a2e6a8082a930f5c7ebdb5771"
 | 
					 | 
				
			||||||
  integrity sha512-1ZUiV1FTwSiSrgWzV9KXJuOF2BVW91KY/mau04BhnmgOdroRQea7Q0s5TVqwGLm0D2tZwObd/tBYXW49sSxp3Q==
 | 
					 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user