Skip to content

Commit

Permalink
cleanup / self-review
Browse files Browse the repository at this point in the history
  • Loading branch information
zbigg committed May 6, 2024
1 parent e65fb12 commit 173c2a4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
6 changes: 0 additions & 6 deletions docs/api-reference/carto/fetch-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ Properties:
* `style` **(string or object)** - URL of basemap style or style object if custom basemap is configured
* `attribution` **(string)** - custom attribution HTML for this basemap

#### `mapStyle` (string) {#mapstyle}

_(**deprecated**, use `basemap.styleUrl`)_

An identifier describing the CARTO [basemap](../../api-reference/carto/basemap.md#supported-basemaps) configured in CARTO Builder.

#### `layers` (Layer[]) {#layers}

A collection of deck.gl [layers](../core/layer.md).
Expand Down
4 changes: 2 additions & 2 deletions modules/carto/src/api/basemap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {cartoBasemapsBaseUrl} from '../basemap';
import {KeplerMapConfig} from './types';

const DEFAULT_CARTO_STYLE = 'positron';
const CARTO_MAP_BASEURL = 'https://basemaps.cartocdn.com/gl/';
const CARTO_MAP_STYLES = ['positron', 'dark-matter', 'voyager'];
const CARTO_MAP_ATRRIBUTION = `© <a href="https://carto.com/about-carto/" target="_blank" rel="noopener noreferrer">CARTO</a>, ©
<a href="http://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors`;
Expand All @@ -21,7 +21,7 @@ export function getBasemapSettings(config: KeplerMapConfig) {
if (CARTO_MAP_STYLES.includes(styleType)) {
const {label} = mapStyle.visibleLayerGroups;
const labelSuffix = label ? '' : '-nolabels';
const styleUrl = `${CARTO_MAP_BASEURL}${styleType}${labelSuffix}-gl-style/style.json`;
const styleUrl = `${cartoBasemapsBaseUrl}${styleType}${labelSuffix}-gl-style/style.json`;
return {
style: styleUrl,
attribution: CARTO_MAP_ATRRIBUTION
Expand Down
4 changes: 3 additions & 1 deletion modules/carto/src/basemap.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const baseUrl = 'https://basemaps.cartocdn.com/gl/{basemap}-gl-style/style.json';
export const cartoBasemapsBaseUrl = 'https://basemaps.cartocdn.com/gl';

const baseUrl = `${cartoBasemapsBaseUrl}/{basemap}-gl-style/style.json`;

export default {
VOYAGER: baseUrl.replace('{basemap}', 'voyager'),
Expand Down

0 comments on commit 173c2a4

Please sign in to comment.