Skip to content

Commit

Permalink
Merge pull request #7314 from TerriaJS/remove-basemaps
Browse files Browse the repository at this point in the history
Remove Carto basemaps.
  • Loading branch information
na9da authored Nov 21, 2024
2 parents 17f5070 + f4f627e commit c71ee74
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 60 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Add "searchBarConfig.showSearchInCatalog" to configParameters so that the link in location search results can be disabled.
- Properly initialize react ref in functional components
- Add NominatimSearchProvider.
- Removed the basemaps - positron, darkmatter and black-marble - from the default settings. The Carto ones are no longer free and requires an [Enterprise or Grantee license](https://carto.com/basemaps). If you have the appropriate license you can add them via your [initialization file](https://docs.terria.io/guide/customizing/initialization-files/#basemaps). [Example configuration](https://gist.github.com/na9da/ef7871afee7cbe3d0a95e5b6351834c9).
- [The next improvement]

#### 8.7.8 - 2024-11-01
Expand Down
45 changes: 0 additions & 45 deletions lib/Models/BaseMaps/defaultBaseMaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,50 +94,5 @@ export function defaultBaseMaps(terria: Terria): BaseMapJson[] {
contrastColor: "#000000"
});

baseMaps.push({
item: {
id: "basemap-black-marble",
name: "NASA Black Marble",
type: "wms",
url: "http://geoserver.nationalmap.nicta.com.au/imagery/nasa-black-marble/wms",
attribution:
"<a href='https://earthobservatory.nasa.gov/Features/NightLights'>Black Marble</a> - From NASA's Earth Observatory. <a href='https://earthobservatory.nasa.gov/image-use-policy'>Use Policy</a>.",
layers: "nasa-black-marble:dnb_land_ocean_ice.2012.54000x27000_geo",
opacity: 1.0
},
image: "build/TerriaJS/images/black-marble.png",
contrastColor: "#ffffff"
});

baseMaps.push({
item: {
id: "basemap-positron",
name: "Positron (Light)",
type: "open-street-map",
url: "https://basemaps.cartocdn.com/light_all/",
attribution:
"© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/about-carto/'>CARTO</a>",
subdomains: ["a", "b", "c", "d"],
opacity: 1.0
},
image: "build/TerriaJS/images/positron.png",
contrastColor: "#000000"
});

baseMaps.push({
item: {
id: "basemap-darkmatter",
name: "Dark Matter",
type: "open-street-map",
url: "https://basemaps.cartocdn.com/dark_all/",
attribution:
"© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/about-carto/'>CARTO</a>",
subdomains: ["a", "b", "c", "d"],
opacity: 1.0
},
image: "build/TerriaJS/images/dark-matter.png",
contrastColor: "#ffffff"
});

return baseMaps;
}
2 changes: 1 addition & 1 deletion lib/Traits/TraitsClasses/BaseMapTraits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class BaseMapsTraits extends ModelTraits {
description:
"The id of the baseMap to be used as the base map in data preview. "
})
previewBaseMapId?: string = "basemap-positron";
previewBaseMapId?: string = "basemap-natural-earth-II";

@objectArrayTrait<BaseMapTraits>({
type: BaseMapTraits,
Expand Down
27 changes: 21 additions & 6 deletions test/Models/BaseMaps/BaseMapsModelSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe("BaseMapModel", () => {
it("properly use enabledBaseMaps list", () => {
const baseMaps: any = {
items: [baseMapPositron],
enabledBaseMaps: ["basemap-positron"]
enabledBaseMaps: ["basemap-natural-earth-II"]
};
baseMapsModel.loadFromJson(CommonStrata.definition, baseMaps);
expect(baseMapsModel.items.length).toBe(
Expand All @@ -73,12 +73,27 @@ describe("BaseMapModel", () => {
});

it("propperly override image", () => {
const _baseMapPositron = JSON.parse(JSON.stringify(baseMapPositron));
_baseMapPositron.item.id = "basemap-positron";
_baseMapPositron.image = "test";
const _baseMapNaturalEarth = JSON.parse(
JSON.stringify({
item: {
id: "basemap-natural-earth-II-test",
name: "Natural Earth II",
type: "url-template-imagery",
url: "https://storage.googleapis.com/terria-datasets-public/basemaps/natural-earth-tiles/{z}/{x}/{reverseY}.png",
attribution:
"<a href='https://www.naturalearthdata.com/downloads/10m-raster-data/10m-natural-earth-2/'>Natural Earth II</a> - From Natural Earth. <a href='https://www.naturalearthdata.com/about/terms-of-use/'>Public Domain</a>.",
maximumLevel: 7,
opacity: 1.0
},
image: "build/TerriaJS/images/natural-earth.png",
contrastColor: "#000000"
})
);
_baseMapNaturalEarth.item.id = "basemap-natural-earth-II";
_baseMapNaturalEarth.image = "test";
const baseMaps: any = {
items: [_baseMapPositron],
enabledBaseMaps: ["basemap-positron"]
items: [_baseMapNaturalEarth],
enabledBaseMaps: ["basemap-natural-earth-II"]
};
baseMapsModel.loadFromJson(CommonStrata.definition, baseMaps);
expect(baseMapsModel.items.length).toBe(defaultBaseMapsLength);
Expand Down
17 changes: 9 additions & 8 deletions test/Models/TerriaSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1615,24 +1615,25 @@ describe("Terria", function () {
);
});

it("propperly loads base maps", async function () {
it("correctly loads the base maps", async function () {
await terria.start({ configUrl: "" });
terria.applyInitData({
initData: {
baseMaps: {
items: [
{
item: {
id: "basemap-positron",
name: "Positron (Light)",
type: "open-street-map",
url: "https://basemaps.cartocdn.com/light_all/",
id: "basemap-natural-earth-II",
name: "Natural Earth II",
type: "url-template-imagery",
url: "https://storage.googleapis.com/terria-datasets-public/basemaps/natural-earth-tiles/{z}/{x}/{reverseY}.png",
attribution:
"© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a>, © <a href='https://carto.com/about-carto/'>CARTO</a>",
subdomains: ["a", "b", "c", "d"],
"<a href='https://www.naturalearthdata.com/downloads/10m-raster-data/10m-natural-earth-2/'>Natural Earth II</a> - From Natural Earth. <a href='https://www.naturalearthdata.com/about/terms-of-use/'>Public Domain</a>.",
maximumLevel: 7,
opacity: 1.0
},
image: "/images/positron.png"
image: "build/TerriaJS/images/natural-earth.png",
contrastColor: "#000000"
},
{
item: {
Expand Down

0 comments on commit c71ee74

Please sign in to comment.