Skip to content

Commit f3876b9

Browse files
authored
Merge pull request #515 from zoran995/configurable-search-bar
Configurable search providers from config
2 parents 5a5615c + 1bde721 commit f3876b9

6 files changed

Lines changed: 28 additions & 31 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ deploy/work/
2525
packages/
2626
pancake/
2727
yarn-error.log
28+
.npmrc
2829

2930
package-lock.json

CHANGES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
- [The next improvement]
66

7+
### `0.0.9`
8+
9+
**2023-11-24**
10+
11+
- Updated TerriaJS to `8.3.9`.
12+
- 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/
13+
714
### `0.0.8`
815

916
**2023-08-11**

index.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,18 @@ var terriaOptions = {
55
};
66

77
import { runInAction } from "mobx";
8-
9-
// checkBrowserCompatibility('ui');
108
import ConsoleAnalytics from "terriajs/lib/Core/ConsoleAnalytics";
119
import GoogleAnalytics from "terriajs/lib/Core/GoogleAnalytics";
1210
import ShareDataService from "terriajs/lib/Models/ShareDataService";
1311
// import registerAnalytics from 'terriajs/lib/Models/registerAnalytics';
14-
// import registerCatalogMembers from 'terriajs/lib/Models/registerCatalogMembers';
1512
import registerCustomComponentTypes from "terriajs/lib/ReactViews/Custom/registerCustomComponentTypes";
1613
import Terria from "terriajs/lib/Models/Terria";
1714
import updateApplicationOnHashChange from "terriajs/lib/ViewModels/updateApplicationOnHashChange";
1815
import updateApplicationOnMessageFromParentWindow from "terriajs/lib/ViewModels/updateApplicationOnMessageFromParentWindow";
1916
import ViewState from "terriajs/lib/ReactViewModels/ViewState";
20-
import BingMapsSearchProviderViewModel from "terriajs/lib/Models/SearchProviders/BingMapsSearchProvider";
21-
// import GazetteerSearchProviderViewModel from 'terriajs/lib/ViewModels/GazetteerSearchProviderViewModel.js';
22-
// import GnafSearchProviderViewModel from 'terriajs/lib/ViewModels/GnafSearchProviderViewModel.js';
23-
// import defined from 'terriajs-cesium/Source/Core/defined';
2417
import render from "./lib/Views/render";
2518
import registerCatalogMembers from "terriajs/lib/Models/Catalog/registerCatalogMembers";
19+
import registerSearchProviders from "terriajs/lib/Models/SearchProviders/registerSearchProviders";
2620
import defined from "terriajs-cesium/Source/Core/defined";
2721
import loadPlugins from "./lib/Core/loadPlugins";
2822
import plugins from "./plugins";
@@ -53,6 +47,9 @@ const viewState = new ViewState({
5347
});
5448

5549
registerCatalogMembers();
50+
// Register custom search providers in the core TerriaJS. If you only want to register a subset of them, or to add your own,
51+
// insert your custom version of the code in the registerSearchProviders function here instead.
52+
registerSearchProviders();
5653

5754
if (process.env.NODE_ENV === "development") {
5855
window.viewState = viewState;
@@ -87,15 +84,6 @@ module.exports = terria
8784
terria.loadInitSources().then((result) => result.raiseError(terria));
8885

8986
try {
90-
viewState.searchState.locationSearchProviders = [
91-
new BingMapsSearchProviderViewModel({
92-
terria: terria,
93-
key: terria.configParameters.bingMapsKey
94-
})
95-
// new GazetteerSearchProviderViewModel({terria}),
96-
// new GnafSearchProviderViewModel({terria})
97-
];
98-
9987
// Automatically update Terria (load new catalogs, etc.) when the hash part of the URL changes.
10088
updateApplicationOnHashChange(terria, window);
10189
updateApplicationOnMessageFromParentWindow(terria, window);

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
]
1414
},
1515
"name": "terriajs-map",
16-
"version": "0.0.8",
16+
"version": "0.0.9",
1717
"description": "Geospatial catalog explorer based on TerriaJS.",
1818
"license": "Apache-2.0",
1919
"engines": {
@@ -74,7 +74,7 @@
7474
"semver": "^5.0.0",
7575
"style-loader": "^0.23.1",
7676
"svg-sprite-loader": "4.1.3",
77-
"terriajs": "8.3.2",
77+
"terriajs": "8.3.9",
7878
"terriajs-cesium": "1.92.0-tile-error-provider-fix-2",
7979
"ts-loader": "^5.3.3",
8080
"typescript": "^4.9.5",

wwwroot/config.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
"googleUrlShortenerKey": null,
66
"googleAnalyticsKey": null,
77
"googleAnalyticsOptions": null,
8-
98
// Log ConsoleAnalytics events to console
109
// logToConsole: true,
11-
1210
/* Text that appears at the bottom of the map */
1311
"disclaimer": {
1412
"text": "Disclaimer: This map must not be used for navigation or precise spatial analysis",
@@ -21,7 +19,6 @@
2119
url: "#"
2220
},
2321
*/
24-
2522
// Pop-up disclaimer that will be shown at the start
2623
// The text of the disclaimer is in lib/Views/GlobalDisclaimer.html
2724
// globalDisclaimer: {
@@ -34,15 +31,13 @@
3431
// //devHostRegex: "\\b(staging|preview|test|dev)\\.",
3532
// enableOnLocalhost: true // If false, don't show this when running on localhost
3633
// },
37-
3834
/*
3935
developerAttribution: {
4036
text: "Your organisation",
4137
link: "http://www.example.com"
4238
},*/
4339
// This is used in various text messages. You should also set <title> in index.html
4440
"appName": "Terria Map",
45-
4641
// See comments in lib/Views/global.scss for further information about customising colors, logos, fonts etc.
4742
"brandBarElements": [
4843
"",
@@ -55,7 +50,6 @@
5550
"proj4ServiceBaseUrl": "proj4def/",
5651
// Or this
5752
"feedbackUrl": "feedback",
58-
5953
// Default mobile viewer mode when loading the map for the first time on mobile platforms.
6054
// Options are: "3DTerrain", "3DSmooth", "2D"
6155
"mobileDefaultViewerMode": "2d",
@@ -71,10 +65,8 @@
7165
// "videoUrl": "https://www.youtube-nocookie.com/embed/NTtSM70rIvI", // use an embedded video link
7266
// "placeholderImage": "https://img.youtube.com/vi/NTtSM70rIvI/maxresdefault.jpg"
7367
// },
74-
7568
// True to display in-app guides.
7669
// "showInAppGuides": false,
77-
7870
// see `languageOverrides.json` in languages/en
7971
"languageConfiguration": {
8072
"enabled": false,
@@ -85,6 +77,16 @@
8577
},
8678
"fallbackLanguage": "en"
8779
},
80+
"searchBarConfig": {},
81+
"searchProviders": [
82+
{
83+
"id": "search-provider/cesium-ion",
84+
"type": "cesium-ion-search-provider",
85+
"name": "translate#viewModels.searchLocations",
86+
"flightDurationSeconds": 1.5,
87+
"minCharacters": 3
88+
}
89+
],
8890
"helpContent": [
8991
{
9092
"title": "translate#gettingstarted.title",

yarn.lock

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10635,10 +10635,10 @@ terriajs-server@^4.0.0:
1063510635
request-promise "^4.0.1"
1063610636
yargs "^13.2.4"
1063710637

10638-
terriajs@8.3.2:
10639-
version "8.3.2"
10640-
resolved "https://registry.yarnpkg.com/terriajs/-/terriajs-8.3.2.tgz#c98d734656b6e215917cc4c3cb62aab635ed0f8c"
10641-
integrity sha512-Hu/tbMOI2y6BcE3f77xFY+f3pnraddGZneqIBeS9JuWXlxjpiZ/dB1lORPM457ldvm39frm/IQff9YmclM8hfg==
10638+
terriajs@8.3.9:
10639+
version "8.3.9"
10640+
resolved "https://registry.yarnpkg.com/terriajs/-/terriajs-8.3.9.tgz#e4bee5c367c8ac10a6c8fa8bf35854e1abccc573"
10641+
integrity sha512-91Xnkp3BKUJFpjQXfdwonOZOri4RzTFGLtap8fNLI7GUzmTRsr3R/WaWlNrtYp5N4M3rJOsAKpoEIbROHHD9HA==
1064210642
dependencies:
1064310643
"@babel/core" "^7.22.9"
1064410644
"@babel/parser" "^7.22.7"
@@ -10707,7 +10707,6 @@ terriajs@8.3.2:
1070710707
"@visx/tooltip" "^2.1.0"
1070810708
assimpjs "^0.0.7"
1070910709
babel-loader "^8.2.3"
10710-
babel-plugin-jsx-control-statements "^4.0.0"
1071110710
babel-plugin-lodash "^3.3.4"
1071210711
bottleneck "^2.19.5"
1071310712
catalog-converter "^0.0.9"

0 commit comments

Comments
 (0)