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

CARTO cloud native integration #5859

Merged
merged 86 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from 84 commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
a74aa2a
improvements
AdriSolid Apr 29, 2021
2f1f861
Unstable
alasarr Apr 29, 2021
7e09830
improvements
AdriSolid Apr 29, 2021
4b4a1a8
Split maps api clients
alasarr Apr 29, 2021
4bb6123
add some asserts
AdriSolid Apr 29, 2021
1986b4e
Config
alasarr Apr 29, 2021
b544d01
fix conflicts
alasarr Apr 29, 2021
e861cbb
fix: add rendersublayers logic
AdriSolid Apr 29, 2021
99a69f6
Merge branch 'adrisolid/carto-cloud-native' of https://github.com/Car…
AdriSolid Apr 29, 2021
e290e7d
Set debug
alasarr Apr 29, 2021
ce05fb8
Fix CARTO Layer
alasarr Apr 29, 2021
6385730
merge
AdriSolid Apr 29, 2021
6afdbea
Config for cloud native
alasarr Apr 29, 2021
6ed7655
Merge branch 'adrisolid/carto-cloud-native' of github.com:CartoDB/car…
alasarr Apr 29, 2021
90a3edb
Fixing tests
alasarr Apr 29, 2021
1aa6bcd
Validate layer inputs
alasarr Apr 29, 2021
bd4e332
Remove demo
alasarr Apr 29, 2021
27b26ac
Migration guide
alasarr Apr 29, 2021
bada58b
Smal tweaks
alasarr Apr 29, 2021
7b1a980
test: add cartosqllayer
AdriSolid Apr 30, 2021
fbc4c74
Add apiVersion
alasarr Apr 30, 2021
630033e
Merge branch 'adrisolid/carto-cloud-native' of github.com:CartoDB/car…
alasarr Apr 30, 2021
a7dc83a
apiVersion at config
alasarr Apr 30, 2021
04e9cae
Upgrade guide
alasarr Apr 30, 2021
1769b6d
Upgrade guide
alasarr Apr 30, 2021
7296e90
Upgrade guide
alasarr Apr 30, 2021
d7ee4c1
Upgrade guide
alasarr Apr 30, 2021
b6804f4
Merge pull request #2 from CartoDB/adrisolid/carto-cloud-native
alasarr Apr 30, 2021
fe71fb3
test: add CartoSQLLayer
AdriSolid Apr 30, 2021
16e1063
CartoSQLLayer tests
alasarr Apr 30, 2021
31d03d7
getMapCartoCloudNative always forces map instantiation
alasarr May 3, 2021
5ffdeb7
Update docs for new CartoLayer and Maps API v3
borja-munoz May 4, 2021
5b2d0fb
test: add cartosqllayer
AdriSolid Apr 30, 2021
178984f
apiVersion at config
alasarr Apr 30, 2021
87cb718
Upgrade guide
alasarr Apr 30, 2021
fee75bc
Upgrade guide
alasarr Apr 30, 2021
21e7c70
Upgrade guide
alasarr Apr 30, 2021
028cad4
Fix : upgrade guide
alasarr Apr 30, 2021
99bd2d3
test22: add CartoSQLLayer
AdriSolid Apr 30, 2021
0b22abd
getMapCartoCloudNative always forces map instantiation
alasarr May 3, 2021
787c5d6
Minor fixes in docs
borja-munoz May 5, 2021
931330e
Fix format in redshift and snowflake
alasarr May 7, 2021
0bb56d6
Export _getMapMetadata. Rename export getMap to _getMap
alasarr May 10, 2021
b4570a8
Updates after Alberto PR review
borja-munoz May 12, 2021
1fbaf33
Merge branch 'master' of github.com:visgl/deck.gl into carto-cloud-na…
alasarr May 14, 2021
c9be1cd
Back to credentials
alasarr May 14, 2021
af87ee8
Merge branch 'master' of github.com:visgl/deck.gl into carto-cloud-na…
alasarr May 14, 2021
04983e3
Updates after renaming config back to credentials
borja-munoz May 17, 2021
94585e9
Adapt to new maps url
alasarr May 24, 2021
3aef42b
Remove debugger
alasarr May 25, 2021
7c1c133
Merge branch 'master' of github.com:visgl/deck.gl into carto-cloud-na…
alasarr May 25, 2021
7c3dea3
Merge pull request #11 from CartoDB/alasarr/maps-url
alasarr May 26, 2021
d47b220
Merge branch 'carto-cloud-native' of github.com:CartoDB/carto-deck.gl…
alasarr May 26, 2021
8acb926
Remove tenant in favor of apiBaseUrl
alasarr May 27, 2021
edc4859
Show error if no apiBaseUrl for v3
alasarr May 27, 2021
e42bac4
Adapt to changes in Maps API
borja-munoz Jun 1, 2021
d60eb67
Update from carto-cloud-native branch
borja-munoz Jun 1, 2021
db3847d
Updates after Alberto review
borja-munoz Jun 1, 2021
5a73b0f
Make linter happy
alasarr Jun 2, 2021
3ede02c
Remove renderSubLayer
alasarr Jun 4, 2021
84a384f
Added getData description, updated on-prem URLs, added v3 private bet…
borja-munoz Jun 7, 2021
f61af48
Remove SubLayer property
borja-munoz Jun 7, 2021
edcaf0d
Fix typo
borja-munoz Jun 7, 2021
4c36d65
Merge branch 'carto-cloud-native' of https://github.com/CartoDB/carto…
borja-munoz Jun 7, 2021
e157cf8
Add tests
alasarr Jun 7, 2021
cebef69
Merge pull request #10 from CartoDB/carto-cloud-native-docs
alasarr Jun 8, 2021
42921be
Changes doc and remove format parameter
alasarr Jun 8, 2021
d0ba113
Merge branch 'master' of github.com:visgl/deck.gl into carto-cloud-na…
alasarr Jun 8, 2021
97c4bc1
Update doc
alasarr Jun 8, 2021
eca86ec
Update docs/api-reference/carto/overview.md
alasarr Jun 8, 2021
f375baa
Improve doc
alasarr Jun 8, 2021
1357a1c
Fix conflict
alasarr Jun 8, 2021
53315b1
Better warnings at doc
alasarr Jun 8, 2021
e610c9a
Doc deprecation warning
alasarr Jun 9, 2021
cffeba9
POST request on large SQL queries
alasarr Jun 9, 2021
4e3cc8e
Adapt declarative for CartoLayer
alasarr Jun 9, 2021
b6cbce2
Remove credentials on deprecated layers
alasarr Jun 9, 2021
5b58ea9
Default props from MVT and GeoJSON
alasarr Jun 9, 2021
bd09d82
Make linter happy
alasarr Jun 9, 2021
5260362
Changes requested
alasarr Jun 9, 2021
d532c49
Merge branch 'master' into carto-cloud-native
alasarr Jun 9, 2021
f31dbb2
Changes requested
alasarr Jun 9, 2021
4aec919
Merge branch 'carto-cloud-native' of github.com:visgl/deck.gl into ca…
alasarr Jun 9, 2021
553b5ce
Fix typo
alasarr Jun 9, 2021
2f2996a
Fix tipos
alasarr Jun 9, 2021
1ffe2d7
Improve default props
alasarr Jun 9, 2021
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
12 changes: 6 additions & 6 deletions docs/api-reference/carto/basemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ import {BASEMAP} from '@deck.gl/carto';
To use pre-bundled scripts:

```html
<script src="https://unpkg.com/deck.gl@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/deck.gl@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>

<!-- or -->
<script src="https://unpkg.com/@deck.gl/core@^8.0.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/geo-layers@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/core@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/geo-layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>
```

```js
Expand Down
45 changes: 35 additions & 10 deletions docs/api-reference/carto/carto-bqtiler-layer.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@


# CartoBQTilerLayer
alasarr marked this conversation as resolved.
Show resolved Hide resolved
>CartoBQTilerLayer will be deprecated in future versions. Use CartoLayer instead. If you've existing code using this layer, check [the migration steps](#migration-to-cartolayer).

`CartoBQTilerLayer` is a layer to visualize large datasets (millions or billions of rows) directly from [Google BigQuery](https://cloud.google.com/bigquery) without having to move data outside of BigQuery.

First you need first to generate a tileset of your dataset in your BigQuery account using CARTO BigQuery Tiler. For more info click [here](https://carto.com/bigquery/beta/).

First you need first to generate a tileset of your dataset in your BigQuery account using CARTO BigQuery Tiler. For more info click [here](https://carto.com/bigquery-tiler/).
```js
import DeckGL from '@deck.gl/react';
import {CartoBQTilerLayer} from '@deck.gl/carto';
Expand All @@ -23,6 +22,28 @@ function App({viewState}) {
}
```

## Migration to CartoLayer

To migrate from `CartoBQTilerLayer` to `CartoLayer` you only need to change the layer name and set `type` property to `MAP_TYPES.TILESET`:

```js
import DeckGL from '@deck.gl/react';
import {CartoLayer, MAP_TYPES} from '@deck.gl/carto';

function App({viewState}) {
const layer = new CartoLayer({
type: MAP_TYPES.TILESET,
data: 'cartobq.maps.nyc_taxi_points_demo_id',
getLineColor: [255, 255, 255],
getFillColor: [238, 77, 90],
pointRadiusMinPixels: 2,
lineWidthMinPixels: 1
});

return <DeckGL viewState={viewState} layers={[layer]} />;
}
```

## Installation

To install the dependencies from NPM:
Expand All @@ -41,14 +62,14 @@ new CartoBQTilerLayer({});
To use pre-bundled scripts:

```html
<script src="https://unpkg.com/deck.gl@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/deck.gl@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>

<!-- or -->
<script src="https://unpkg.com/@deck.gl/core@^8.0.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/geo-layers@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/core@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/geo-layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>
```

```js
Expand All @@ -73,6 +94,10 @@ Optional. Needed for highlighting a feature split across two or more tiles if no

A string pointing to a tile attribute containing a unique identifier for features across tiles.

##### `credentials` (Object)

Optional. Overrides the configuration to connect with CARTO. Check the parameters [here](overview#carto-credentials).

### Callbacks

#### `onDataLoad` (Function, optional)
Expand Down
149 changes: 149 additions & 0 deletions docs/api-reference/carto/carto-layer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# CartoLayer
alasarr marked this conversation as resolved.
Show resolved Hide resolved

`CartoLayer` is the layer to visualize data using the CARTO Maps API.

## Usage

```js
import DeckGL from '@deck.gl/react';
import {CartoLayer, setDefaultCredentials, MAP_TYPES, API_VERSIONS} from '@deck.gl/carto';

setDefaultCredentials({
apiVersion: API_VERSIONS.V2,
username: 'public',
apiKey: 'default_public'
});

function App({viewState}) {
const layer = new CartoLayer({
type: MAP_TYPES.QUERY,
data: 'SELECT * FROM world_population_2015',
pointRadiusMinPixels: 2,
getLineColor: [0, 0, 0, 125],
getFillColor: [238, 77, 90],
lineWidthMinPixels: 1
})

return <DeckGL viewState={viewState} layers={[layer]} />;
}
```

## Usage Carto Cloud Native

```js
import DeckGL from '@deck.gl/react';
import {CartoLayer, setDefaultCredentials, MAP_TYPES, API_VERSIONS} from '@deck.gl/carto';

setDefaultCredentials({
apiVersion: API_VERSIONS.V3
apiBaseUrl: 'https://gcp-us-east1.api.carto.com',
accessToken: 'XXX',
});

function App({viewState}) {
const layer = new CartoLayer({
type: MAP_TYPES.QUERY,
connection: 'bigquery',
data: 'SELECT * FROM cartobq.testtables.points_10k',
pointRadiusMinPixels: 2,
getLineColor: [0, 0, 0, 200],
getFillColor: [238, 77, 90],
lineWidthMinPixels: 1
})

return <DeckGL viewState={viewState} layers={[layer]} />;
}
```

> **CARTO Cloud Native** is currently available only in a private beta. If you want to test it, please contact us at [support@carto.com](mailto:support@carto.com?subject=Access%20to%20Cloud%20%Native%20%API%20(v3)).
Copy link
Contributor Author

@alasarr alasarr Jun 9, 2021

Choose a reason for hiding this comment

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

@borja-munoz remember to replace this with the form at carto.com


## Installation

To install the dependencies from NPM:

```bash
npm install deck.gl
# or
npm install @deck.gl/core @deck.gl/layers @deck.gl/carto
```

```js
import {CartoLayer} from '@deck.gl/carto';
new CartoLayer({});
```

To use pre-bundled scripts:

```html
<script src="https://unpkg.com/deck.gl@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>

<!-- or -->
<script src="https://unpkg.com/@deck.gl/core@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/geo-layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>
```

```js
new deck.carto.CartoLayer({});
```

## Properties

This layer allows to work with the different CARTO Maps API versions (v1, v2 and v3). When using version v1 and v2, the layer always works with vector tiles so it inherits all properties from [`MVTLayer`](/docs/api-reference/geo-layers/mvt-layer.md). When using v3, the layer works with vector tiles if the `type` property is `MAP_TYPES.TILESET` and with GeoJSON data if the `type` is `MAP_TYPES.QUERY` or `MAP_TYPES.TABLE`. When using GeoJSON data, the layer inherits all properties from [`GeoJsonLayer`](/docs/api-reference/layers/geojson-layer.md).

##### `data` (String)

Required. Either a SQL query or a name of dataset/tileset.

##### `type` (String)

Required. Data type. Possible values are:

- `MAP_TYPES.QUERY`, if `data` is a SQL query.
- `MAP_TYPES.TILESET`, if `data` is a tileset name.
- `MAP_TYPES.TABLE`, if `data` is a dataset name. Only supported with API v3.

##### `connection` (String)

Required when apiVersion is `API_VERSIONS.V3`.

Name of the connection registered in the [CARTO workspace].

##### `uniqueIdProperty` (String)

* Default: `cartodb_id`

Optional. A string pointing to a unique attribute at the result of the query. A unique attribute is needed for highlighting with vector tiles when a feature is split across two or more tiles.

##### `credentials` (Object)

Optional. Overrides the configuration to connect with CARTO. Check the parameters [here](overview#carto-credentials).


### Callbacks

#### `onDataLoad` (Function, optional)

`onDataLoad` is called when the request to the CARTO Maps API was completed successfully.

* Default: `data => {}`

Receives arguments:

* `data` (Object) - Data received from CARTO Maps API

##### `onDataError` (Function, optional)

`onDataError` is called when the request to the CARTO Maps API failed. By default the Error is thrown.

* Default: `null`

Receives arguments:

* `error` (`Error`)

## Source

[modules/carto/src/layers/carto-layer.js](https://github.com/visgl/deck.gl/tree/master/modules/carto/src/layers/carto-layer.js)
71 changes: 37 additions & 34 deletions docs/api-reference/carto/carto-sql-layer.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@


# CartoSQLLayer
>CartoSQLLayer will be deprecated in future versions. Use CartoLayer instead. If you've existing code using this layer, check [the migration steps](#migration-to-cartolayer).

`CartoSQLLayer` is a layer to visualize data hosted in your CARTO account and to apply custom SQL.

```js
import DeckGL from '@deck.gl/react';
import {CartoSQLLayer, setDefaultCredentials} from '@deck.gl/carto';
Expand All @@ -17,7 +16,34 @@ function App({viewState}) {
const layer = new CartoSQLLayer({
data: 'SELECT * FROM world_population_2015',
pointRadiusMinPixels: 2,
getLineColor: [0, 0, 0, 0.75],
getLineColor: [0, 0, 0, 125],
getFillColor: [238, 77, 90],
lineWidthMinPixels: 1
})

return <DeckGL viewState={viewState} layers={[layer]} />;
}
```

## Migration to CartoLayer

To migrate from `CartoSQLLayer` to `CartoLayer` you only need to change the layer name and set `type` property to `MAP_TYPES.QUERY`:

```js
import DeckGL from '@deck.gl/react';
import {CartoLayer, setDefaultCredentials, MAP_TYPES} from '@deck.gl/carto';

setDefaultCredentials({
username: 'public',
apiKey: 'default_public'
});

function App({viewState}) {
const layer = new CartoLayer({
type: MAP_TYPES.QUERY,
data: 'SELECT * FROM world_population_2015',
pointRadiusMinPixels: 2,
getLineColor: [0, 0, 0, 125],
getFillColor: [238, 77, 90],
lineWidthMinPixels: 1
})
Expand All @@ -44,14 +70,14 @@ new CartoSQLLayer({});
To use pre-bundled scripts:

```html
<script src="https://unpkg.com/deck.gl@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/deck.gl@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>

<!-- or -->
<script src="https://unpkg.com/@deck.gl/core@^8.0.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/geo-layers@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.2.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/core@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/geo-layers@^8.5.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/carto@^8.5.0/dist.min.js"></script>
```

```js
Expand All @@ -74,32 +100,9 @@ Required. Either a sql query or a name of dataset

Optional. A string pointing to a unique attribute at the result of the query. A unique attribute is needed for highlighting a feature split across two or more tiles.


##### `credentials` (Object)

Optional. Object with the credentials to connect with CARTO.

* Default:

```js
{
username: 'public',
apiKey: 'default_public'
}
```

##### `bufferSize` (Number)

Optional. MVT BufferSize in tile coordinate space as defined by MVT specification

* Default: `16`


##### `tileExtent` (String)

Optional. Tile extent in tile coordinate space as defined by MVT specification.

* Default: `4096`
Optional. Overrides the configuration to connect with CARTO. Check the parameters [here](overview#carto-credentials).

### Callbacks

Expand Down
Loading