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

Adds info box to globe-view example #19

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion globe-view/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Example: Globe View

Data from CARTO can be used as the source for any deck.gl layer or view. In this example, we use flights data from a SQL query to CARTO to animate the flight paths in a 3D visualization using the GlobeView from deck.gl.

Uses [Vite](https://vitejs.dev/) to bundle and serve files.

## Usage
Expand All @@ -15,5 +17,5 @@ yarn
```

Commands:
* `npm dev` is the development target, to serve the app and hot reload.
* `npm run dev` is the development target, to serve the app and hot reload.
* `npm run build` is the production target, to create the final bundle and write to disk.
35 changes: 33 additions & 2 deletions globe-view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,39 @@
<title>deck.gl Globe View - CARTO Source Example</title>
</head>
<body>
<div id="map"></div>
<canvas id="deck-canvas"></canvas>
<div id="app">
<div id="map"></div>
<canvas id="deck-canvas"></canvas>
<div id="story-card">
<p class="overline">✨👀 You're viewing</p>
<h2>GlobeView from CARTO data</h2>
<p>
You can easily use data from CARTO in other deck.gl layers and views such as
<a
href="https://deck.gl/docs/api-reference/core/globe-view"
rel="noopener noreferrer"
target="_blank">
GlobeView</a>
to create advanced visualizations.
</p>
<div class="code-block">
<code>
import {query} from '@deck.gl/carto';
</code>
</div>
<p>
Just use the <i>query</i> method from the
<a
href="https://deck.gl/docs/api-reference/carto/overview"
rel="noopener noreferrer"
target="_blank">
CARTO module</a>,
and use it as the data in your deck.gl layers.
</p>

</div>
</div>

<script type="module" src='./index.ts'></script>
</body>
</html>
40 changes: 40 additions & 0 deletions globe-view/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,43 @@ canvas {
max-height: 100%;
background-color: #000;
}

#app {
flex: 1 1 auto;
min-height: 100vh;
display: flex;
flex-direction: column;
}

#story-card {
padding: 1.75rem;
background: #fdfdfe;
box-shadow: 4px 4px 8px #30303099;
border-radius: 4px;
z-index:1;
margin: 1.5rem;
max-width: 480px;
max-height: 100vh;
z-index: 10;
}

.overline {
font-size: .625rem;
font-weight: 600;
line-height: 1.2;
letter-spacing: .125rem;
text-transform: uppercase;
}

.code-block {
background: #2C3032;
padding: 0.75rem;
border-radius: 4px;
}

.code-block code {
font-family: monospace;
font-size: 0.75rem;
color: white;
line-height: 1.25;
}