// TODO Use imports when Deck.gl works in more bundlers// https://github.com/visgl/deck.gl/issues/6351#issuecomment-1079424167importtype*asGeoJSONfrom"geojson";// import { GeoJsonLayer } from "deck.gl";// import { GoogleMapsOverlay } from "@deck.gl/google-maps";constGeoJsonLayer=deck.GeoJsonLayer;constGoogleMapsOverlay=deck.GoogleMapsOverlay;typeProperties={mag:number};typeFeature=GeoJSON.Feature<GeoJSON.Point,Properties>;// Initialize and add the mapfunctioninitMap():void{constmap=newgoogle.maps.Map(document.getElementById("map")asHTMLElement,{center:{lat:40,lng:-110},zoom:4,});constdeckOverlay=newGoogleMapsOverlay({layers:[newGeoJsonLayer({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,getRadius:(f:Feature)=>Math.pow(10,f.properties.mag),getFillColor:[255,70,30,180],autoHighlight:true,transitions:{getRadius:{type:"spring",stiffness:0.1,damping:0.15,enter:()=>[0],// grow from size 0,duration:10000,},},onDataLoad:()=>{/* eslint-disable no-undef */// @ts-ignore defined in includeprogress.done();// hides progress bar/* eslint-enable no-undef */},}),],});deckOverlay.setMap(map);}declareglobal{interfaceWindow{initMap:()=>void;}}window.initMap=initMap;
// import { GeoJsonLayer } from "deck.gl";// import { GoogleMapsOverlay } from "@deck.gl/google-maps";constGeoJsonLayer=deck.GeoJsonLayer;constGoogleMapsOverlay=deck.GoogleMapsOverlay;// Initialize and add the mapfunctioninitMap(){constmap=newgoogle.maps.Map(document.getElementById("map"),{center:{lat:40,lng:-110},zoom:4,});constdeckOverlay=newGoogleMapsOverlay({layers:[newGeoJsonLayer({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,getRadius:(f)=>Math.pow(10,f.properties.mag),getFillColor:[255,70,30,180],autoHighlight:true,transitions:{getRadius:{type:"spring",stiffness:0.1,damping:0.15,enter:()=>[0],// grow from size 0,duration:10000,},},onDataLoad:()=>{/* eslint-disable no-undef */// @ts-ignore defined in includeprogress.done();// hides progress bar/* eslint-enable no-undef */},}),],});deckOverlay.setMap(map);}window.initMap=initMap;
/* * Always set the map height explicitly to define the size of the div element * that contains the map. */#map{height:100%;}/* * Optional: Makes the sample page fill the window. */html,body{height:100%;margin:0;padding:0;}
Git and Node.js are required to run this sample locally. Follow these instructions to install Node.js and NPM. The following commands clone, install dependencies and start the sample application.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[[["\u003cp\u003eThis example demonstrates visualizing a large number of data points, specifically earthquake locations, on a Google Map using deck.gl's GeoJsonLayer and ScatterplotOverlay.\u003c/p\u003e\n"],["\u003cp\u003eIt fetches earthquake data from a USGS GeoJSON feed and dynamically renders points on the map, scaling their size based on magnitude.\u003c/p\u003e\n"],["\u003cp\u003eThe visualization utilizes deck.gl transitions for a smooth, animated appearance of data points.\u003c/p\u003e\n"],["\u003cp\u003eThe code provides both TypeScript and JavaScript implementations, offering flexibility for developers.\u003c/p\u003e\n"],["\u003cp\u003eUsers can interact with the visualization through a live demo on JSFiddle or explore the source code via provided links.\u003c/p\u003e\n"]]],[],null,["Visualizing thousands of points\n\nThis example visualizes recent earthquakes using the deck.gl GeoJsonLayer and a\nScatterPlot of earthquakes.\n\nFor more information, see \u003chttps://deck.gl/\u003e. \n\nTypeScript \n\n```typescript\n// TODO Use imports when Deck.gl works in more bundlers\n// https://github.com/visgl/deck.gl/issues/6351#issuecomment-1079424167\n\nimport type * as GeoJSON from \"geojson\";\n// import { GeoJsonLayer } from \"deck.gl\";\n// import { GoogleMapsOverlay } from \"@deck.gl/google-maps\";\n\nconst GeoJsonLayer = deck.GeoJsonLayer;\nconst GoogleMapsOverlay = deck.GoogleMapsOverlay;\n\ntype Properties = { mag: number };\ntype Feature = GeoJSON.Feature\u003cGeoJSON.Point, Properties\u003e;\n\n// Initialize and add the map\nfunction initMap(): void {\n const map = new google.maps.Map(\n document.getElementById(\"map\") as HTMLElement,\n {\n center: { lat: 40, lng: -110 },\n zoom: 4,\n }\n );\n\n const deckOverlay = new GoogleMapsOverlay({\n layers: [\n new GeoJsonLayer({\n id: \"earthquakes\",\n data: \"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson\",\n filled: true,\n pointRadiusMinPixels: 2,\n pointRadiusMaxPixels: 200,\n opacity: 0.4,\n pointRadiusScale: 0.3,\n getRadius: (f: Feature) =\u003e Math.pow(10, f.properties.mag),\n getFillColor: [255, 70, 30, 180],\n autoHighlight: true,\n transitions: {\n getRadius: {\n type: \"spring\",\n stiffness: 0.1,\n damping: 0.15,\n enter: () =\u003e [0], // grow from size 0,\n duration: 10000,\n },\n },\n onDataLoad: () =\u003e {\n /* eslint-disable no-undef */\n // @ts-ignore defined in include\n progress.done(); // hides progress bar\n /* eslint-enable no-undef */\n },\n }),\n ],\n });\n\n deckOverlay.setMap(map);\n}\n\ndeclare global {\n interface Window {\n initMap: () =\u003e void;\n }\n}\nwindow.initMap = initMap;https://github.com/googlemaps/js-samples/blob/2683f7366fb27829401945d2a7e27d77ed2df8e5/samples/deckgl-points/index.ts#L8-L71\n```\n| **Note:** Read the [guide](/maps/documentation/javascript/using-typescript) on using TypeScript and Google Maps.\n\nJavaScript \n\n```javascript\n// import { GeoJsonLayer } from \"deck.gl\";\n// import { GoogleMapsOverlay } from \"@deck.gl/google-maps\";\nconst GeoJsonLayer = deck.GeoJsonLayer;\nconst GoogleMapsOverlay = deck.GoogleMapsOverlay;\n\n// Initialize and add the map\nfunction initMap() {\n const map = new google.maps.Map(document.getElementById(\"map\"), {\n center: { lat: 40, lng: -110 },\n zoom: 4,\n });\n const deckOverlay = new GoogleMapsOverlay({\n layers: [\n new GeoJsonLayer({\n id: \"earthquakes\",\n data: \"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson\",\n filled: true,\n pointRadiusMinPixels: 2,\n pointRadiusMaxPixels: 200,\n opacity: 0.4,\n pointRadiusScale: 0.3,\n getRadius: (f) =\u003e Math.pow(10, f.properties.mag),\n getFillColor: [255, 70, 30, 180],\n autoHighlight: true,\n transitions: {\n getRadius: {\n type: \"spring\",\n stiffness: 0.1,\n damping: 0.15,\n enter: () =\u003e [0], // grow from size 0,\n duration: 10000,\n },\n },\n onDataLoad: () =\u003e {\n /* eslint-disable no-undef */\n // @ts-ignore defined in include\n progress.done(); // hides progress bar\n /* eslint-enable no-undef */\n },\n }),\n ],\n });\n\n deckOverlay.setMap(map);\n}\n\nwindow.initMap = initMap;https://github.com/googlemaps/js-samples/blob/2683f7366fb27829401945d2a7e27d77ed2df8e5/dist/samples/deckgl-points/docs/index.js#L7-L53\n```\n| **Note:** The JavaScript is compiled from the TypeScript snippet.\n\nCSS \n\n```css\n/* \n * Always set the map height explicitly to define the size of the div element\n * that contains the map. \n */\n#map {\n height: 100%;\n}\n\n/* \n * Optional: Makes the sample page fill the window. \n */\nhtml,\nbody {\n height: 100%;\n margin: 0;\n padding: 0;\n}\nhttps://github.com/googlemaps/js-samples/blob/2683f7366fb27829401945d2a7e27d77ed2df8e5/dist/samples/deckgl-points/docs/style.css#L18-L35\n```\n\nHTML \n\n```html\n\u003chtml\u003e\n \u003chead\u003e\n \u003ctitle\u003edeck.gl and Google Maps Platform\u003c/title\u003e\n\n \u003c!-- Use Material Design Progress indicator --\u003e\n \u003clink\n href=\"https://unpkg.com/material-components-web@6.0.0/dist/material-components-web.css\"\n rel=\"stylesheet\"\n /\u003e\n \u003cscript src=\"https://unpkg.com/material-components-web@6.0.0/dist/material-components-web.min.js\"\u003e\u003c/script\u003e\n \u003cscript src=\"https://unpkg.com/deck.gl@8.9.22/dist.min.js\"\u003e\u003c/script\u003e\n \u003cscript src=\"https://unpkg.com/@deck.gl/google-maps@8.9.22/dist.min.js\"\u003e\u003c/script\u003e\n\n \u003clink rel=\"stylesheet\" type=\"text/css\" href=\"./style.css\" /\u003e\n \u003cscript type=\"module\" src=\"./index.js\"\u003e\u003c/script\u003e\n \u003c/head\u003e\n \u003cbody\u003e\n \u003cdiv\n role=\"progressbar\"\n class=\"mdc-linear-progress\"\n aria-label=\"Data Progress Bar\"\n \u003e\n \u003cdiv class=\"mdc-linear-progress__buffer\"\u003e\n \u003cdiv class=\"mdc-linear-progress__buffer-bar\"\u003e\u003c/div\u003e\n \u003cdiv class=\"mdc-linear-progress__buffer-dots\"\u003e\u003c/div\u003e\n \u003c/div\u003e\n \u003cdiv class=\"mdc-linear-progress__bar mdc-linear-progress__primary-bar\"\u003e\n \u003cspan class=\"mdc-linear-progress__bar-inner\"\u003e\u003c/span\u003e\n \u003c/div\u003e\n \u003cdiv class=\"mdc-linear-progress__bar mdc-linear-progress__secondary-bar\"\u003e\n \u003cspan class=\"mdc-linear-progress__bar-inner\"\u003e\u003c/span\u003e\n \u003c/div\u003e\n \u003c/div\u003e\n \u003cscript\u003e\n var progress, progressDiv;\n progressDiv = document.querySelector(\".mdc-linear-progress\");\n progress = new mdc.linearProgress.MDCLinearProgress(progressDiv);\n progress.open();\n progress.determinate = false;\n progress.done = function () {\n progress.close();\n progressDiv.remove();\n };\n \u003c/script\u003e\n\n \u003cdiv id=\"map\"\u003e\u003c/div\u003e\n\n \u003c!-- \n The `defer` attribute causes the script to execute after the full HTML\n document has been parsed. For non-blocking uses, avoiding race conditions,\n and consistent behavior across browsers, consider loading using Promises. See\n https://developers.google.com/maps/documentation/javascript/load-maps-js-api\n for more information.\n --\u003e\n \u003cscript\n src=\"https://maps.googleapis.com/maps/api/js?key=AIzaSyB41DRUbKWJHPxaFjMAwdrzWzbVKartNGg&callback=initMap&v=weekly\"\n defer\n \u003e\u003c/script\u003e\n \u003c/body\u003e\n\u003c/html\u003ehttps://github.com/googlemaps/js-samples/blob/2683f7366fb27829401945d2a7e27d77ed2df8e5/dist/samples/deckgl-points/docs/index.html#L8-L67\n```\n\nTry Sample \n[JSFiddle.net](https://jsfiddle.net/gh/get/library/pure/googlemaps/js-samples/tree/master/dist/samples/deckgl-points/jsfiddle) [Google Cloud Shell](https://ssh.cloud.google.com/cloudshell/editor?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fgooglemaps%2Fjs-samples&cloudshell_git_branch=sample-deckgl-points&cloudshell_tutorial=cloud_shell_instructions.md&cloudshell_workspace=.)\n\nClone Sample\n\n\nGit and Node.js are required to run this sample locally. Follow these [instructions](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) to install Node.js and NPM. The following commands clone, install dependencies and start the sample application. \n\n git clone -b sample-deckgl-points https://github.com/googlemaps/js-samples.git\n cd js-samples\n npm i\n npm start\n\n\nOther samples can be tried by switching to any branch beginning with `sample-`\u003cvar translate=\"no\"\u003eSAMPLE_NAME\u003c/var\u003e. \n\n git checkout sample-\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eSAMPLE_NAME\u003c/span\u003e\u003c/var\u003e\n npm i\n npm start"]]