Skip to content
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
3 changes: 3 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ <h1>Maps JSAPI Samples</h1>
<li><a href='/samples/deckgl-kml/dist'>deckgl-kml</a></li>
<li><a href='/samples/deckgl-kml-updated/dist'>deckgl-kml-updated</a></li>
<li><a href='/samples/deckgl-polygon/dist'>deckgl-polygon</a></li>
<li><a href='/samples/layer-data-quakes-red/dist'>layer-data-quakes-red</a></li>
<li><a href='/samples/layer-data-quakes-simple/dist'>layer-data-quakes-simple</a></li>
<li><a href='/samples/layer-data-simple/dist'>layer-data-simple</a></li>
<li><a href='/samples/layer-data-style/dist'>layer-data-style</a></li>
<li><a href='/samples/map-drawing-terradraw/dist'>map-drawing-terradraw</a></li>
<li><a href='/samples/map-simple/dist'>map-simple</a></li>
<li><a href='/samples/place-autocomplete-basic-map/dist'>place-autocomplete-basic-map</a></li>
Expand Down
13 changes: 13 additions & 0 deletions dist/samples/layer-data-quakes-red/app/.eslintsrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": [
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/ban-ts-comment": 0,
"@typescript-eslint/no-this-alias": 1,
"@typescript-eslint/no-empty-function": 1,
"@typescript-eslint/explicit-module-boundary-types": 1,
"@typescript-eslint/no-unused-vars": 1
}
}
40 changes: 40 additions & 0 deletions dist/samples/layer-data-quakes-red/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Google Maps JavaScript Sample

This sample is generated from @googlemaps/js-samples located at
https://github.com/googlemaps-samples/js-api-samples.

## Setup

### Before starting run:

`npm i`

### Run an example on a local web server

`cd samples/layer-data-quakes-red`
`npm start`

### Build an individual example

`cd samples/layer-data-quakes-red`
`npm run build`

From 'samples':

`npm run build --workspace=layer-data-quakes-red/`

### Build all of the examples.

From 'samples':

`npm run build-all`

### Run lint to check for problems

`cd samples/layer-data-quakes-red`
`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).
23 changes: 23 additions & 0 deletions dist/samples/layer-data-quakes-red/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<!--
@license
Copyright 2019 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_layer_data_quakes_red] -->
<html>
<head>
<title>Simple Data Layer: Earthquakes</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="20,-160" zoom="2"></gmp-map>
</body>
</html>
<!-- [END maps_layer_data_quakes_red] -->
53 changes: 53 additions & 0 deletions dist/samples/layer-data-quakes-red/app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// [START maps_layer_data_quakes_red]
let innerMap;

async function initMap() {
(await google.maps.importLibrary("maps")) as google.maps.MapsLibrary;

const mapElement = document.querySelector(
"gmp-map"
) as google.maps.MapElement;

innerMap = mapElement.innerMap;

// Get the earthquake data (JSONP format)
// This feed is a copy from the USGS feed, you can find the originals here:
// http://earthquake.usgs.gov/earthquakes/feed/v1.0/geojson.php
const script = document.createElement("script");

script.setAttribute(
"src",
"quakes.geo.json"
);

document.getElementsByTagName("head")[0].appendChild(script);

// Add a basic style.
innerMap.data.setStyle((feature) => {
const mag = Math.exp(parseFloat(feature.getProperty("mag") as string)) * 0.1;
return /** @type {google.maps.Data.StyleOptions} */ {
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: mag,
fillColor: "#f00",
fillOpacity: 0.35,
strokeWeight: 0,
},
};
});
}

// Defines the callback function referenced in the jsonp file.
function eqfeed_callback(data: any) {
innerMap.data.addGeoJson(data);
}

window.eqfeed_callback = eqfeed_callback;
initMap();
// [END maps_layer_data_quakes_red]
14 changes: 14 additions & 0 deletions dist/samples/layer-data-quakes-red/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@js-api-samples/layer-data-quakes-red",
"version": "1.0.0",
"scripts": {
"build": "tsc && bash ../jsfiddle.sh layer-data-quakes-red && bash ../app.sh layer-data-quakes-red && bash ../docs.sh layer-data-quakes-red && npm run build:vite --workspace=. && bash ../dist.sh layer-data-quakes-red",
"test": "tsc && npm run build:vite --workspace=.",
"start": "tsc && vite build --base './' && vite",
"build:vite": "vite build --base './'",
"preview": "vite preview"
},
"dependencies": {

}
}
25 changes: 25 additions & 0 deletions dist/samples/layer-data-quakes-red/app/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/* [START maps_layer_data_quakes_red] */
/*
* Always set the map height explicitly to define the size of the div element
* that contains the map.
*/
gmp-map {
height: 100%;
}

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

/* [END maps_layer_data_quakes_red] */
17 changes: 17 additions & 0 deletions dist/samples/layer-data-quakes-red/app/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"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* @license
* Copyright 2019 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/gmp-map{height:100%}html,body{height:100%;margin:0;padding:0}
23 changes: 23 additions & 0 deletions dist/samples/layer-data-quakes-red/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<!--
@license
Copyright 2019 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_layer_data_quakes_red] -->
<html>
<head>
<title>Simple Data Layer: Earthquakes</title>


<!-- 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>
<script type="module" crossorigin src="./assets/index-B6LvuGLW.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BOPY9jPg.css">
</head>
<body>
<gmp-map center="20,-160" zoom="2"></gmp-map>
</body>
</html>
<!-- [END maps_layer_data_quakes_red] -->
Loading