From 70814b1b925fca633edb686d3e11bbed358c453e Mon Sep 17 00:00:00 2001 From: zoran995 Date: Tue, 19 Jan 2021 15:33:51 +0100 Subject: [PATCH 1/9] register search providers --- index.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index c501862dd..d4190ef9c 100644 --- a/index.js +++ b/index.js @@ -20,7 +20,7 @@ import Terria from 'terriajs/lib/Models/Terria'; import updateApplicationOnHashChange from 'terriajs/lib/ViewModels/updateApplicationOnHashChange'; import updateApplicationOnMessageFromParentWindow from 'terriajs/lib/ViewModels/updateApplicationOnMessageFromParentWindow'; import ViewState from 'terriajs/lib/ReactViewModels/ViewState'; -import BingMapsSearchProviderViewModel from 'terriajs/lib/Models/BingMapsSearchProvider'; +// import BingMapsSearchProviderViewModel from 'terriajs/lib/Models/SearchProvider/BingMapsSearchProvider'; // import GazetteerSearchProviderViewModel from 'terriajs/lib/ViewModels/GazetteerSearchProviderViewModel.js'; // import GnafSearchProviderViewModel from 'terriajs/lib/ViewModels/GnafSearchProviderViewModel.js'; // import defined from 'terriajs-cesium/Source/Core/defined'; @@ -28,7 +28,7 @@ import render from './lib/Views/render'; import createGlobalBaseMapOptions from 'terriajs/lib/ViewModels/createGlobalBaseMapOptions'; import registerCatalogMembers from 'terriajs/lib/Models/registerCatalogMembers'; import defined from 'terriajs-cesium/Source/Core/defined'; - +import registerSearchProviders from 'terriajs/lib/Models/SearchProvider/registerSearchProviders' // Register all types of catalog members in the core TerriaJS. If you only want to register a subset of them // (i.e. to reduce the size of your application if you don't actually use them all), feel free to copy a subset of // the code in the registerCatalogMembers function here instead. @@ -55,6 +55,9 @@ const viewState = new ViewState({ }); registerCatalogMembers(); +// Register custom search providers in the core TerriaJS. If you only want to register a subset of them, or to add your own, +// insert your custom version of the code in the registerSearchProviders function here instead. +registerSearchProviders(); if (process.env.NODE_ENV === "development") { window.viewState = viewState; @@ -81,14 +84,12 @@ module.exports = terria.start({ raiseErrorToUser(terria, e); }); try { - viewState.searchState.locationSearchProviders = [ - new BingMapsSearchProviderViewModel({ - terria: terria, - key: terria.configParameters.bingMapsKey - }), + /* viewState.searchState.locationSearchProviders = [ + new BingMapsSearchProviderViewModel("bing-search", terria), // new GazetteerSearchProviderViewModel({terria}), // new GnafSearchProviderViewModel({terria}) - ]; + ]; */ + viewState.searchState.locationSearchProviders = terria.locationSearchProvidersArray; // Automatically update Terria (load new catalogs, etc.) when the hash part of the URL changes. updateApplicationOnHashChange(terria, window); From 78e053d063aba6e8ca860f987f3ed2cb22403245 Mon Sep 17 00:00:00 2001 From: zoran995 Date: Mon, 15 Feb 2021 12:32:25 +0100 Subject: [PATCH 2/9] fix lint error --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d4190ef9c..c1532b85f 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ import render from './lib/Views/render'; import createGlobalBaseMapOptions from 'terriajs/lib/ViewModels/createGlobalBaseMapOptions'; import registerCatalogMembers from 'terriajs/lib/Models/registerCatalogMembers'; import defined from 'terriajs-cesium/Source/Core/defined'; -import registerSearchProviders from 'terriajs/lib/Models/SearchProvider/registerSearchProviders' +import registerSearchProviders from 'terriajs/lib/Models/SearchProvider/registerSearchProviders'; // Register all types of catalog members in the core TerriaJS. If you only want to register a subset of them // (i.e. to reduce the size of your application if you don't actually use them all), feel free to copy a subset of // the code in the registerCatalogMembers function here instead. From 642a99a2ae17b46001e3b2de21836c9c4a2dfa8c Mon Sep 17 00:00:00 2001 From: zoran995 Date: Thu, 18 Feb 2021 00:55:00 +0100 Subject: [PATCH 3/9] add default list of searchProviders to config --- wwwroot/config.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/wwwroot/config.json b/wwwroot/config.json index 68f9804e6..6e6af2013 100644 --- a/wwwroot/config.json +++ b/wwwroot/config.json @@ -85,6 +85,32 @@ }, "fallbackLanguage": "en" }, + "searchBar": { + "searchProviders": [ + { + "id": "search-provider/bing-maps", + "type": "bing-maps-search-provider", + "name": "translate#viewModels.searchLocations", + "url": "https://dev.virtualearth.net/", + "flightDurationSeconds": 1.5, + "minCharacters": 5, + "isOpen": true + }, + { + "id": "search-provider/australian-gazetteer", + "type": "australian-gazetteer-search-provider", + "name": "translate#viewModels.searchPlaceNames", + "url": + "http://services.ga.gov.au/gis/services/Australian_Gazetteer/MapServer/WFSServer", + "searchPropertyName": "Australian_Gazetteer:NameU", + "searchPropertyTypeName": "Australian_Gazetteer:Gazetteer_of_Australia", + "flightDurationSeconds": 1.5, + "minCharacters": 3, + "recommendedListLength": 3, + "isOpen": false + } + ] + }, "helpContent": [ { "title": "gettingstarted.title", From 204db963015dc379ead46b214ca243fa2199661d Mon Sep 17 00:00:00 2001 From: Zoran Kokeza Date: Fri, 3 Sep 2021 00:44:41 +0200 Subject: [PATCH 4/9] update registerSearchProviders location --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index f172dbe67..018cf246e 100644 --- a/index.js +++ b/index.js @@ -10,7 +10,7 @@ import defined from 'terriajs-cesium/Source/Core/defined'; import ConsoleAnalytics from 'terriajs/lib/Core/ConsoleAnalytics'; import GoogleAnalytics from 'terriajs/lib/Core/GoogleAnalytics'; import registerCatalogMembers from 'terriajs/lib/Models/Catalog/registerCatalogMembers'; -import registerSearchProviders from 'terriajs/lib/Models/SearchProvider/registerSearchProviders'; +import registerSearchProviders from 'terriajs/lib/Models/SearchProviders/registerSearchProviders'; import ShareDataService from 'terriajs/lib/Models/ShareDataService'; import Terria from 'terriajs/lib/Models/Terria'; import ViewState from 'terriajs/lib/ReactViewModels/ViewState'; From bcba528b9b8f059b9d8b6ca7635c8b4a6b3e292c Mon Sep 17 00:00:00 2001 From: Zoran Kokeza Date: Sun, 17 Oct 2021 22:53:27 +0200 Subject: [PATCH 5/9] update config.json to match changes in search configuration --- wwwroot/config.json | 68 +++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 37 deletions(-) diff --git a/wwwroot/config.json b/wwwroot/config.json index 420f59e53..840366eb6 100644 --- a/wwwroot/config.json +++ b/wwwroot/config.json @@ -1,14 +1,14 @@ { /* Names of init files (in wwwroot/init), without the .json extension, to load by default */ - "initializationUrls": ["simple"], + "initializationUrls": [ + "simple" + ], "parameters": { "googleUrlShortenerKey": null, "googleAnalyticsKey": null, "googleAnalyticsOptions": null, - // Log ConsoleAnalytics events to console // logToConsole: true, - /* Text that appears at the bottom of the map */ "disclaimer": { "text": "Disclaimer: This map must not be used for navigation or precise spatial analysis", @@ -21,7 +21,6 @@ url: "#" }, */ - // Pop-up disclaimer that will be shown at the start // The text of the disclaimer is in lib/Views/GlobalDisclaimer.html // globalDisclaimer: { @@ -34,7 +33,6 @@ // //devHostRegex: "\\b(staging|preview|test|dev)\\.", // enableOnLocalhost: true // If false, don't show this when running on localhost // }, - /* developerAttribution: { text: "Your organisation", @@ -42,7 +40,6 @@ },*/ // This is used in various text messages. You should also set in index.html "appName": "Terria Map", - // See comments in lib/Views/global.scss for further information about customising colors, logos, fonts etc. "brandBarElements": [ "", @@ -55,7 +52,6 @@ "proj4ServiceBaseUrl": "proj4def/", // Or this "feedbackUrl": "feedback", - // Default mobile viewer mode when loading the map for the first time on mobile platforms. // Options are: "3DTerrain", "3DSmooth", "2D" "mobileDefaultViewerMode": "2d", @@ -71,10 +67,8 @@ // "videoUrl": "https://www.youtube-nocookie.com/embed/NTtSM70rIvI", // use an embedded video link // "placeholderImage": "https://img.youtube.com/vi/NTtSM70rIvI/maxresdefault.jpg" // }, - // True to display in-app guides. // "showInAppGuides": false, - // see `languageOverrides.json` in languages/en "languageConfiguration": { "enabled": false, @@ -85,32 +79,30 @@ }, "fallbackLanguage": "en" }, - "searchBar": { - "searchProviders": [ - { - "id": "search-provider/bing-maps", - "type": "bing-maps-search-provider", - "name": "translate#viewModels.searchLocations", - "url": "https://dev.virtualearth.net/", - "flightDurationSeconds": 1.5, - "minCharacters": 5, - "isOpen": true - }, - { - "id": "search-provider/australian-gazetteer", - "type": "australian-gazetteer-search-provider", - "name": "translate#viewModels.searchPlaceNames", - "url": - "http://services.ga.gov.au/gis/services/Australian_Gazetteer/MapServer/WFSServer", - "searchPropertyName": "Australian_Gazetteer:NameU", - "searchPropertyTypeName": "Australian_Gazetteer:Gazetteer_of_Australia", - "flightDurationSeconds": 1.5, - "minCharacters": 3, - "recommendedListLength": 3, - "isOpen": false - } - ] - }, + "searchBarModel": {}, + "searchProviders": [ + { + "id": "search-provider/bing-maps", + "type": "bing-maps-search-provider", + "name": "translate#viewModels.searchLocations", + "url": "https://dev.virtualearth.net/", + "flightDurationSeconds": 1.5, + "minCharacters": 5, + "isOpen": true + }, + { + "id": "search-provider/australian-gazetteer", + "type": "australian-gazetteer-search-provider", + "name": "translate#viewModels.searchPlaceNames", + "url": "http://services.ga.gov.au/gis/services/Australian_Gazetteer/MapServer/WFSServer", + "searchPropertyName": "Australian_Gazetteer:NameU", + "searchPropertyTypeName": "Australian_Gazetteer:Gazetteer_of_Australia", + "flightDurationSeconds": 1.5, + "minCharacters": 3, + "recommendedListLength": 3, + "isOpen": false + } + ], "helpContent": [ { "title": "translate#gettingstarted.title", @@ -243,7 +235,9 @@ }, { "term": "translate#helpContentTerm5.term", - "aliases": ["catalogue"], + "aliases": [ + "catalogue" + ], "content": "translate#helpContentTerm5.content" }, { @@ -393,4 +387,4 @@ // } // ] } -} +} \ No newline at end of file From 97fab07b76e61c423211b7feaa8c1bc56e9ab61a Mon Sep 17 00:00:00 2001 From: Zoran Kokeza <zorankokeza95@gmail.com> Date: Wed, 20 Oct 2021 23:31:42 +0200 Subject: [PATCH 6/9] reflect chamges from terriajs for search providers --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 018cf246e..4003667fb 100644 --- a/index.js +++ b/index.js @@ -75,7 +75,7 @@ module.exports = terria.start({ }).finally(function() { terria.loadInitSources().then(result => result.raiseError(terria)); try { - viewState.searchState.locationSearchProviders = terria.locationSearchProvidersArray; + viewState.searchState.locationSearchProviders = terria.configParameters.searchBarModel.locationSearchProvidersArray; // Automatically update Terria (load new catalogs, etc.) when the hash part of the URL changes. updateApplicationOnHashChange(terria, window); From 40c296110605ed14d9d8fdf85595c73456484c62 Mon Sep 17 00:00:00 2001 From: Zoran Kokeza <zoran.kokeza@htecgroup.com> Date: Sat, 4 Nov 2023 20:00:49 +0100 Subject: [PATCH 7/9] fix: remove unnecessary search providers override --- index.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/index.js b/index.js index 39b3cf5fe..6aabae7ed 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,6 @@ var terriaOptions = { }; import { runInAction } from "mobx"; -// checkBrowserCompatibility('ui'); import ConsoleAnalytics from "terriajs/lib/Core/ConsoleAnalytics"; import GoogleAnalytics from "terriajs/lib/Core/GoogleAnalytics"; import ShareDataService from "terriajs/lib/Models/ShareDataService"; @@ -15,10 +14,6 @@ import Terria from "terriajs/lib/Models/Terria"; import updateApplicationOnHashChange from "terriajs/lib/ViewModels/updateApplicationOnHashChange"; import updateApplicationOnMessageFromParentWindow from "terriajs/lib/ViewModels/updateApplicationOnMessageFromParentWindow"; import ViewState from "terriajs/lib/ReactViewModels/ViewState"; -import BingMapsSearchProviderViewModel from "terriajs/lib/Models/SearchProviders/BingMapsSearchProvider"; -// import GazetteerSearchProviderViewModel from 'terriajs/lib/ViewModels/GazetteerSearchProviderViewModel.js'; -// import GnafSearchProviderViewModel from 'terriajs/lib/ViewModels/GnafSearchProviderViewModel.js'; -// import defined from 'terriajs-cesium/Source/Core/defined'; import render from "./lib/Views/render"; import registerCatalogMembers from "terriajs/lib/Models/Catalog/registerCatalogMembers"; import registerSearchProviders from "terriajs/lib/Models/SearchProviders/registerSearchProviders"; @@ -89,9 +84,6 @@ module.exports = terria terria.loadInitSources().then((result) => result.raiseError(terria)); try { - viewState.searchState.locationSearchProviders = - terria.configParameters.searchBarModel.locationSearchProvidersArray; - // Automatically update Terria (load new catalogs, etc.) when the hash part of the URL changes. updateApplicationOnHashChange(terria, window); updateApplicationOnMessageFromParentWindow(terria, window); From 8cf29706abdd4142b92a22a180ea43085dd2b075 Mon Sep 17 00:00:00 2001 From: Zoran Kokeza <zoran.kokeza@htecgroup.com> Date: Thu, 23 Nov 2023 14:15:42 +0100 Subject: [PATCH 8/9] feat: added cesium ion search provider to config.json --- wwwroot/config.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wwwroot/config.json b/wwwroot/config.json index cbc7d232d..806d2b7c1 100644 --- a/wwwroot/config.json +++ b/wwwroot/config.json @@ -77,8 +77,15 @@ }, "fallbackLanguage": "en" }, - "searchBarModel": {}, + "searchBarConfig": {}, "searchProviders": [ + { + "id": "search-provider/cesium-ion", + "type": "cesium-ion-search-provider", + "name": "translate#viewModels.searchLocations", + "flightDurationSeconds": 1.5, + "minCharacters": 3 + }, { "id": "search-provider/bing-maps", "type": "bing-maps-search-provider", From 1bde721ab00f90fcbf4f294045bb75fe016d056b Mon Sep 17 00:00:00 2001 From: Nick Forbes-Smith <nick@forbes-smith.com> Date: Fri, 24 Nov 2023 16:52:56 +1100 Subject: [PATCH 9/9] Update TerriaJS to 8.3.9 and only add cesium ion search provider to default config --- CHANGES.md | 7 +++++++ package.json | 4 ++-- wwwroot/config.json | 21 --------------------- yarn.lock | 9 ++++----- 4 files changed, 13 insertions(+), 28 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c6df0d327..db2a31df2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,13 @@ - [The next improvement] +### `0.0.9` + +**2023-11-24** + +- Updated TerriaJS to `8.3.9`. +- Moved to new Search Provider model. Search Providers are now configured in `config.json` `searchProviders`. For example configuration see https://docs.terria.io/guide/customizing/search-providers/ + ### `0.0.8` **2023-08-11** diff --git a/package.json b/package.json index 926af2b0c..9bbd5f6fc 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ ] }, "name": "terriajs-map", - "version": "0.0.8", + "version": "0.0.9", "description": "Geospatial catalog explorer based on TerriaJS.", "license": "Apache-2.0", "engines": { @@ -74,7 +74,7 @@ "semver": "^5.0.0", "style-loader": "^0.23.1", "svg-sprite-loader": "4.1.3", - "terriajs": "8.3.2", + "terriajs": "8.3.9", "terriajs-cesium": "1.92.0-tile-error-provider-fix-2", "ts-loader": "^5.3.3", "typescript": "^4.9.5", diff --git a/wwwroot/config.json b/wwwroot/config.json index 806d2b7c1..c874fe106 100644 --- a/wwwroot/config.json +++ b/wwwroot/config.json @@ -85,27 +85,6 @@ "name": "translate#viewModels.searchLocations", "flightDurationSeconds": 1.5, "minCharacters": 3 - }, - { - "id": "search-provider/bing-maps", - "type": "bing-maps-search-provider", - "name": "translate#viewModels.searchLocations", - "url": "https://dev.virtualearth.net/", - "flightDurationSeconds": 1.5, - "minCharacters": 5, - "isOpen": true - }, - { - "id": "search-provider/australian-gazetteer", - "type": "australian-gazetteer-search-provider", - "name": "translate#viewModels.searchPlaceNames", - "url": "http://services.ga.gov.au/gis/services/Australian_Gazetteer/MapServer/WFSServer", - "searchPropertyName": "Australian_Gazetteer:NameU", - "searchPropertyTypeName": "Australian_Gazetteer:Gazetteer_of_Australia", - "flightDurationSeconds": 1.5, - "minCharacters": 3, - "recommendedListLength": 3, - "isOpen": false } ], "helpContent": [ diff --git a/yarn.lock b/yarn.lock index 47cc85ffe..cba922e33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10635,10 +10635,10 @@ terriajs-server@^4.0.0: request-promise "^4.0.1" yargs "^13.2.4" -terriajs@8.3.2: - version "8.3.2" - resolved "https://registry.yarnpkg.com/terriajs/-/terriajs-8.3.2.tgz#c98d734656b6e215917cc4c3cb62aab635ed0f8c" - integrity sha512-Hu/tbMOI2y6BcE3f77xFY+f3pnraddGZneqIBeS9JuWXlxjpiZ/dB1lORPM457ldvm39frm/IQff9YmclM8hfg== +terriajs@8.3.9: + version "8.3.9" + resolved "https://registry.yarnpkg.com/terriajs/-/terriajs-8.3.9.tgz#e4bee5c367c8ac10a6c8fa8bf35854e1abccc573" + integrity sha512-91Xnkp3BKUJFpjQXfdwonOZOri4RzTFGLtap8fNLI7GUzmTRsr3R/WaWlNrtYp5N4M3rJOsAKpoEIbROHHD9HA== dependencies: "@babel/core" "^7.22.9" "@babel/parser" "^7.22.7" @@ -10707,7 +10707,6 @@ terriajs@8.3.2: "@visx/tooltip" "^2.1.0" assimpjs "^0.0.7" babel-loader "^8.2.3" - babel-plugin-jsx-control-statements "^4.0.0" babel-plugin-lodash "^3.3.4" bottleneck "^2.19.5" catalog-converter "^0.0.9"