Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
dd99f6a
feat: Migrates the deckgl-points sample.
willum070 Mar 6, 2026
b4d234e
feat: Migrates the deckgl-points sample.
willum070 Mar 12, 2026
6199cbf
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 13, 2026
1a22286
Remove deck.gl dependencies from package.json
willum070 Mar 13, 2026
8bd27cd
Add back dependencies
willum070 Mar 13, 2026
ea2fb0b
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 18, 2026
721bbba
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 18, 2026
769cd98
Upgrade Deck.gl dependencies to version 9.2.10
willum070 Mar 18, 2026
d930f4c
Add luma.gl dependencies to package.json
willum070 Mar 18, 2026
f740ba1
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 23, 2026
c2c7a42
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 23, 2026
b6c39ec
Remove deck.gl and luma.gl dependencies
willum070 Mar 23, 2026
ec293e6
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 23, 2026
355df7c
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 23, 2026
3d61153
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 24, 2026
fd5a2c7
Add dependencies back to local project
willum070 Mar 24, 2026
3845cd2
Improve feature validation for earthquake rendering
willum070 Mar 25, 2026
db123b3
Remove unused Feature type definition
willum070 Mar 25, 2026
83c6db6
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 25, 2026
99c85b3
Change deck.gl dependencies to version 8.9.0
willum070 Mar 25, 2026
88a5fda
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 26, 2026
115dbb3
Merge branch 'main' into migrate-deckgl-points
willum070 Mar 27, 2026
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
41 changes: 41 additions & 0 deletions samples/deckgl-points/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Google Maps JavaScript Sample

## deckgl-points

This example visualizes recent earthquakes using the deck.gl GeoJsonLayer and a ScatterPlot of earthquakes.

## Setup

### Before starting run:

`npm i`

### Run an example on a local web server

`cd samples/deckgl-points`
`npm start`

### Build an individual example

`cd samples/deckgl-points`
`npm run build`

From 'samples':

`npm run build --workspace=deckgl-points/`

### Build all of the examples.

From 'samples':

`npm run build-all`

### Run lint to check for problems

`cd samples/deckgl-points`
`npx eslint index.ts`

## Feedback

For feedback related to this sample, please open a new issue on
[GitHub](https://github.com/googlemaps-samples/js-api-samples/issues).
21 changes: 21 additions & 0 deletions samples/deckgl-points/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!doctype html>
<!--
@license
Copyright 2026 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_deckgl_points] -->
<html>
<head>
<title>deck.gl and Google Maps Platform</title>
<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
<!-- prettier-ignore -->
<script>(g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=`https://maps.${c}apis.com/maps/api/js?`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})
({key: "AIzaSyA6myHzS10YXdcazAFalmXvDkrYCp5cLc8", v: "weekly"});</script>
</head>
<body>
<gmp-map center="40, -110" zoom="4" map-id="DEMO_MAP_ID"></gmp-map>
</body>
</html>
<!-- [END maps_deckgl_points] -->
82 changes: 82 additions & 0 deletions samples/deckgl-points/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/**
* @license
* Copyright 2026 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// [START maps_deckgl_points]
//import type * as GeoJSON from 'geojson';
import { Feature } from 'geojson';
import { GoogleMapsOverlay } from '@deck.gl/google-maps';
import { GeoJsonLayer } from '@deck.gl/layers';

type Properties = { mag: number };

const mapElement = document.querySelector('gmp-map') as google.maps.MapElement;
let innerMap: google.maps.Map;

interface EarthquakeProperties {
mag: number;
place: string;
time: number;
}

/**
* Validates that a feature has the properties we need for rendering.
*/
function isEarthquake(f: Feature): f is Feature & { properties: EarthquakeProperties } {
return (
f.properties !== null &&
typeof f.properties === 'object' &&
typeof (f.properties as any).mag === 'number'
);
}

// Initialize and add the map
async function initMap() {
// Request the needed libraries.
await google.maps.importLibrary('maps');

innerMap = await mapElement.innerMap;

const deckOverlay = new GoogleMapsOverlay({
layers: [
new GeoJsonLayer({
id: 'earthquakes',
data: 'https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson',
filled: true,
pointRadiusMinPixels: 2,
pointRadiusMaxPixels: 200,
opacity: 0.4,
pointRadiusScale: 0.3,
getPointRadius: (f: Feature): number => {
if (isEarthquake(f)) {
return Math.pow(10, f.properties.mag);
}
return 0; // Fallback for invalid data.
},
getFillColor: (f: Feature): [number, number, number, number] => {
return [255, 70, 30, 180]; // Default color for other earthquakes.
},
autoHighlight: true,
transitions: {
getPointRadius: {
type: 'spring',
stiffness: 0.1,
damping: 0.15,
enter: () => [0], // grow from size 0,
duration: 10000,
},
},
onDataLoad: () => {
console.log('Data is loaded.');
},
}),
],
});

deckOverlay.setMap(innerMap);
}

initMap();
// [END maps_deckgl_points]
17 changes: 17 additions & 0 deletions samples/deckgl-points/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@js-api-samples/deckgl-points",
"version": "1.0.0",
"scripts": {
"build": "tsc && bash ../jsfiddle.sh deckgl-points && bash ../app.sh deckgl-points && bash ../docs.sh deckgl-points && npm run build:vite --workspace=. && bash ../dist.sh deckgl-points",
"test": "tsc && npm run build:vite --workspace=.",
"start": "tsc && vite build --base './' && vite",
"build:vite": "vite build --base './'",
"preview": "vite preview"
},
"dependencies": {
"@deck.gl/core": "^8.9.0",
"@deck.gl/google-maps": "^8.9.0",
"@deck.gl/layers": "^8.9.0",
"deck.gl": "^8.9.0"
}
}
28 changes: 28 additions & 0 deletions samples/deckgl-points/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @license
* Copyright 2026 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
:root {
--mdc-theme-primary: #1a73e8;
--mdc-theme-secondary: #rgb(225, 245, 254);
--mdc-theme-on-primary: #fff;
--mdc-theme-on-secondary: rgb(1, 87, 155);
}

.mdc-text-field--focused:not(.mdc-text-field--disabled) .mdc-floating-label {
color: var(--mdc-theme-primary);
}

/* [START maps_deckgl_points] */
/*
* Optional: Makes the sample page fill the window.
*/
html,
body {
height: 100%;
margin: 0;
padding: 0;
}

/* [END maps_deckgl_points] */
17 changes: 17 additions & 0 deletions samples/deckgl-points/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"module": "esnext",
"target": "esnext",
"strict": true,
"noImplicitAny": false,
"lib": [
"es2015",
"esnext",
"es6",
"dom",
"dom.iterable"
],
"moduleResolution": "Node",
"jsx": "preserve"
}
}
Loading