Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Add basemaps from Carto #1107

Merged
merged 3 commits into from
Sep 28, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/osmLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ let StamenAttribution = 'Map tiles by <a href="http://stamen.com">Stamen ' +
'CC BY 3.0</a>. Data by <a href="http://openstreetmap.org">OpenStreetMap' +
'</a>, under <a href="http://www.openstreetmap.org/copyright">ODbL</a>.';

/* Per Carto's website regarding basemap attribution: https://carto.com/help/working-with-data/attribution/#basemaps */
let CartoAttribution = '<a href="https://carto.com"> Carto</a> ' + 'Contributors <a href="https://www.openstreetmap.org/"> OpenStreetMap</a>'

/**
* This is a list of known tile sources. It can be added to via
* `geo.osmLayer.tilesource[<key>] = <object>`, where the object has `url`,
Expand All @@ -139,6 +142,18 @@ let StamenAttribution = 'Map tiles by <a href="http://stamen.com">Stamen ' +
* @type {object}
*/
osmLayer.tileSources = {
'darkMatter-with-labels': {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, should this be dark-matter-with-labels rather than camel case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, yes it should.

url: ' https://{s}.basemaps.cartocdn.com/rastertiles/dark_all/{z}/{x}/{y}.png',
attribution: CartoAttribution,
minLevel: 0,
maxLevel: 18
},
'darkMatter-without-labels': {
url: 'https://{s}.basemaps.cartocdn.com/rastertiles/dark_nolabels/{z}/{x}/{y}.png',
attribution: CartoAttribution,
minLevel: 0,
maxLevel: 18
},
'nationalmap-satellite': {
url: 'https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/tile/{z}/{y}/{x}',
attribution: 'Tile data from <a href="https://basemap.nationalmap.gov/">USGS</a>',
Expand All @@ -153,6 +168,18 @@ osmLayer.tileSources = {
minLevel: 0,
maxLevel: 19
},
'positron-with-labels': {
url: 'https://{s}.basemaps.cartocdn.com/rastertiles/light_all/{z}/{x}/{y}.png',
attribution: CartoAttribution,
minLevel: 0,
maxLevel: 18
},
'positron-without-labels': {
url: 'https://{s}.basemaps.cartocdn.com/rastertiles/light_nolabels/{z}/{x}/{y}.png',
attribution: CartoAttribution,
minLevel: 0,
maxLevel: 18
},
'stamen-terrain': {
url: 'https://stamen-tiles-{s}.a.ssl.fastly.net/terrain/{z}/{x}/{y}.png',
attribution: StamenAttribution,
Expand Down Expand Up @@ -181,6 +208,18 @@ osmLayer.tileSources = {
minLevel: 0,
maxLevel: 20
},
'voyager-with-labels': {
url: 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager_labels_under/{z}/{x}/{y}.png',
attribution: CartoAttribution,
minLevel: 0,
maxLevel: 18
},
'voyager-without-layers': {
url: 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}.png',
attribution: CartoAttribution,
minLevel: 0,
maxLevel: 18
},
'wikimedia': {
url: 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png',
attribution: '<a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use">Wikimedia maps</a> | Map data &copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap contributors</a>',
Expand Down