Skip to content

Commit

Permalink
2081 new config v2 (#2096)
Browse files Browse the repository at this point in the history
* schema config-layer start

* Add real sample for esriFeature leaf and inside a group

* add localize rule, layerfilter, move serviceDate

* remove allMaps callback

* refactor(clean): Remove cluster and heatmap from codebase (#2076)

Closes #2075

Co-authored-by: jolevesq <[email protected]>

* progress on link to api

* rebase from local branch mistake to include remove allMaps

* fix types issue

* fix types

* Remove triggerReadyCallback

* rebase

* fix comment

* codeQL regex config

---------

Co-authored-by: Johann Levesque <[email protected]>
  • Loading branch information
jolevesq and Johann Levesque authored May 7, 2024
1 parent b126e85 commit 6662e0e
Show file tree
Hide file tree
Showing 59 changed files with 1,851 additions and 816 deletions.
100 changes: 49 additions & 51 deletions packages/geoview-core/public/configs/OSDP/osdp-land.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
{
"map": {
"interaction": "dynamic",
"viewSettings": {
"zoom": 8,
"center": [-113, 57.5],
"projection": 3978
},
"basemapOptions": {
"basemapId": "transport",
"shaded": true,
"labeled": true
},
"listOfGeoviewLayerConfig": [
{
"geoviewLayerId": "LYR1",
"geoviewLayerName": { "en": "2010 Land Cover of Canada" },
"metadataAccessPath": {
"en": "https://datacube.services.geo.ca/web/landcover.xml"
},
"geoviewLayerType": "ogcWms",
"listOfLayerEntryConfig": [
{
"layerId": "landcover-2010"
}
]
},
{
"geoviewLayerId": "LYR2",
"geoviewLayerName": { "en": "2015 Land Cover of Canada" },
"metadataAccessPath": {
"en": "https://datacube.services.geo.ca/web/landcover.xml"
},
"geoviewLayerType": "ogcWms",
"listOfLayerEntryConfig": [
{
"layerId": "landcover-2015"
}
]
}
]
},
"components": ["north-arrow", "overview-map"],
"footerBar": {
"tabs": {
"core": ["legend", "layers", "details", "data-table"]
}
},
"corePackages": [ "swiper"],
"theme": "geo.ca",
"suportedLanguages": ["en"]
{
"map": {
"interaction": "dynamic",
"viewSettings": {
"projection": 3978
},
"basemapOptions": {
"basemapId": "transport",
"shaded": true,
"labeled": true
},
"listOfGeoviewLayerConfig": [
{
"geoviewLayerId": "LYR1",
"geoviewLayerName": { "en": "2010 Land Cover of Canada" },
"metadataAccessPath": {
"en": "https://datacube.services.geo.ca/web/landcover.xml"
},
"geoviewLayerType": "ogcWms",
"listOfLayerEntryConfig": [
{
"layerId": "landcover-2010"
}
]
},
{
"geoviewLayerId": "LYR2",
"geoviewLayerName": { "en": "2015 Land Cover of Canada" },
"metadataAccessPath": {
"en": "https://datacube.services.geo.ca/web/landcover.xml"
},
"geoviewLayerType": "ogcWms",
"listOfLayerEntryConfig": [
{
"layerId": "landcover-2015"
}
]
}
]
},
"components": ["north-arrow", "overview-map"],
"footerBar": {
"tabs": {
"core": ["legend", "layers", "details", "data-table"]
}
},
"corePackages": [ "swiper"],
"theme": "geo.ca",
"suportedLanguages": ["en"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"map": {
"interaction": "dynamic",
"viewSettings": {
"projection": 3978
},
"basemapOptions": {
"basemapId": "transport",
"shaded": true,
"labeled": false
},
"listOfGeoviewLayerConfig": [
{
"geoviewLayerId": "geojsonLYR1",
"geoviewLayerName": { "en": "GeoJSON Sample" },
"metadataAccessPath": { "en": "./datasets/geojson/metadata1.json" },
"geoviewLayerType": "GeoJSON",
"listOfLayerEntryConfig": [
{
"layerId": "projects.json",
"layerName": { "en": "Projects" }
}
]
},
{
"geoviewLayerId": "geojsonLYR2",
"geoviewLayerName": { "en": "MultiPolygon Sample" },
"metadataAccessPath": { "en": "./datasets/geojson/metadata.json" },
"geoviewLayerType": "GeoJSON",
"listOfLayerEntryConfig": [
{
"layerId": "multipolygons.geojson",
"layerName": { "en": "MultiPolygon" }
}
]
}
]
},
"components": ["overview-map"],
"overviewMap": {"hideOnZoom": 7},
"footerBar": {
"tabs": {
"core": ["legend", "layers", "details", "data-table"]
}
},
"corePackages": [],
"theme": "geo.ca",
"suportedLanguages": ["en"]
}
13 changes: 7 additions & 6 deletions packages/geoview-core/public/templates/add-panels.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h1><strong>Add Panels</strong></h1>
<script>
// initialize cgpv and api events, a callback is optional, used if calling api's after the rendering is ready
cgpv.init((mapId) => {
if (mapId === 'allMaps') {
if (mapId === 'mapWM') {
// get add panel button element for WM map
var addAppbarPanelBtn = document.getElementsByClassName('add-appbar-panel-btn')[0];

Expand All @@ -108,7 +108,6 @@ <h1><strong>Add Panels</strong></h1>

// get add nav-bar panel button element for WM map
var addNavbarPanelBtn = document.getElementsByClassName('add-navbar-panel-btn')[0];

// add nav-bar panel btn click event handler
// button will open a panel on the nav-bar
addNavbarPanelBtn.addEventListener('click', function (e) {
Expand Down Expand Up @@ -170,12 +169,14 @@ <h1><strong>Add Panels</strong></h1>
// call an api function to add a new button panel in the nav-bar in a new group
cgpv.api.maps['mapWM'].navBarApi.createNavbarButtonPanel(button, panel, 'newGroup');
});

// create snippets
createCodeSnippet();
createConfigSnippet();
}
});

// create snippets
window.addEventListener('load', () => {
createCodeSnippet();
createConfigSnippet();
});
</script>
</body>
</html>
12 changes: 7 additions & 5 deletions packages/geoview-core/public/templates/api-functions-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ <h4 id="HLNG1">1. Test get service metadata</h4>
<script>
// initialize cgpv and api events, a callback is optional, used if calling api's after the rendering is ready
cgpv.init((mapId) => {
if (mapId === 'allMaps') {
if (mapId === 'LNG1') {
cgpv.api.utilities.geo
.getESRIServiceMetadata('https://maps-cartes.ec.gc.ca/arcgis/rest/services/CESI/MapServer/1')
.then((data) => {
Expand Down Expand Up @@ -223,12 +223,14 @@ <h4 id="HLNG1">1. Test get service metadata</h4>
var timeConsole = document.getElementById('time-console');
timeConsole.textContent = '';
});

// create snippets
createCodeSnippet();
createConfigSnippet();
}
});

// create snippets
window.addEventListener('load', () => {
createCodeSnippet();
createConfigSnippet();
});
</script>
</body>
</html>
12 changes: 7 additions & 5 deletions packages/geoview-core/public/templates/api-loads.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,17 @@ <h4 id="HLNG1">1. Load from URL keys</h4>
<script>
// initialize cgpv and api events, a callback is optional, used if calling api's after the rendering is ready
cgpv.init((mapId) => {
if (mapId === 'allMaps') {
if (mapId === 'LNG1') {
// Write code here...
// ...

// create snippets
createCodeSnippet();
createConfigSnippet();
}
});

// create snippets
window.addEventListener('load', () => {
createCodeSnippet();
createConfigSnippet();
});
</script>
</body>
</html>
13 changes: 5 additions & 8 deletions packages/geoview-core/public/templates/config-sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ <h1><strong>Sandbox Configuration</strong></h1>
</div>
<div>
<textarea id="configUrlGeoview" name="Urlconfiguration" cols="210">
p=3857&z=4&c=-100,40&l=en&t=dark&b={basemapId:transport,shaded:false,labeled:true}&i=dynamic&cc=overview-map&keys=12acd145-626a-49eb-b850-0a59c9bc7506,ccc75c12-5acc-4a6a-959f-ef6f621147b9
p=3857&z=4&c=-100,40&l=en&t=dark&b=basemapId:transport,shaded:false,labeled:true&i=dynamic&cc=overview-map&keys=12acd145-626a-49eb-b850-0a59c9bc7506,ccc75c12-5acc-4a6a-959f-ef6f621147b9
</textarea>
</div>
</div>
Expand Down Expand Up @@ -322,13 +322,10 @@ <h4 id="HLCONF1">Sanbox Map</h4>
document.getElementById('createMap').disabled = true;
});

// initialize cgpv and api events, a callback is optional, used if calling api's after the rendering is ready
cgpv.init((mapId) => {
if (mapId === 'allMaps') {
// create snippets
createCodeSnippet();
createConfigSnippet();
}
// create snippets
window.addEventListener('load', () => {
createCodeSnippet();
createConfigSnippet();
});
</script>
</body>
Expand Down
14 changes: 8 additions & 6 deletions packages/geoview-core/public/templates/default-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'c=-100,40&' +
'l=en&' +
't=dark&' +
'b={basemapId:transport,shaded:false,labeled:true}&' +
'b=basemapId:transport,shaded:false,labeled:true&' +
'i=dynamic&' +
'cc=overview-map&' +
'keys=12acd145-626a-49eb-b850-0a59c9bc7506,ccc75c12-5acc-4a6a-959f-ef6f621147b9';
Expand Down Expand Up @@ -295,11 +295,13 @@ <h4 id="HLCONF7">7. Load config from function call</h4>

// initialize cgpv and api events, a callback is optional, used if calling api's after the rendering is ready
cgpv.init((mapId) => {
if (mapId === 'allMaps') {
// create snippets
createCodeSnippet();
createConfigSnippet();
}
// write some code ....
});

// create snippets
window.addEventListener('load', () => {
createCodeSnippet();
createConfigSnippet();
});
</script>
</body>
Expand Down
6 changes: 5 additions & 1 deletion packages/geoview-core/public/templates/demos-navigator.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ <h1><strong>Demo Configs Selector</strong></h1>
<option value="./configs/navigator/22-static-image.json">Layer - Static Image -</option>
<option value="./configs/navigator/23-csv.json">Layer - CSV -</option>
<option value="./configs/navigator/24-vector-tile.json">Layer - Vector Tile -</option>
<option value="./configs/navigator/25-geojson-multi.json">Layer - GeoJSON MutiPolygon -</option>
</select>
</div>
</div>
Expand Down Expand Up @@ -269,7 +270,10 @@ <h1><strong>Demo Configs Selector</strong></h1>
});

// create snippets
createConfigSnippet();
window.addEventListener('load', () => {
createCodeSnippet();
createConfigSnippet();
});
</script>
</body>
</html>
13 changes: 7 additions & 6 deletions packages/geoview-core/public/templates/demos/demo-cgdi.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ <h4 id="HMapWR1">Water Resources</h4>
<div
id="MapWR1"
class="geoview-map"
triggerReadyCallback="true"
data-lang="en"
data-config="{
'map': {
Expand Down Expand Up @@ -193,14 +192,16 @@ <h4 id="HMapWR1">Water Resources</h4>
<script>
// initialize cgpv and api events, a callback is optional, used if calling api's after the rendering is ready
cgpv.init((mapId) => {
if (mapId === 'allMaps') {
if (mapId === 'MapWR1') {
listenToLegendLayerSetChanges('HMapWR1-state', 'MapWR1');

// create snippets
createCodeSnippet();
createConfigSnippet();
}
});

// create snippets
window.addEventListener('load', () => {
createCodeSnippet();
createConfigSnippet();
});
</script>
</body>
</html>
13 changes: 7 additions & 6 deletions packages/geoview-core/public/templates/demos/demo-osdp-air.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ <h4 id="HMap1">Air Quality</h4>
<div
id="Map1"
class="geoview-map"
triggerReadyCallback="true"
data-lang="en"
data-config="{
'map': {
Expand Down Expand Up @@ -110,14 +109,16 @@ <h4 id="HMap1">Air Quality</h4>
<script>
// initialize cgpv and api events, a callback is optional, used if calling api's after the rendering is ready
cgpv.init((mapId) => {
if (mapId === 'allMaps') {
if (mapId === 'Map1') {
listenToLegendLayerSetChanges('HMap1-state', 'Map1');

// create snippets
createCodeSnippet();
createConfigSnippet();
}
});

// create snippets
window.addEventListener('load', () => {
createCodeSnippet();
createConfigSnippet();
});
</script>
</body>
</html>
Loading

0 comments on commit 6662e0e

Please sign in to comment.