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
12 changes: 12 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,23 @@
<!-- Default top-level index for Firebase Hosting -->
<h1>Maps JSAPI Samples</h1>
<ul>
<li><a href='/samples/3d-camera-to-around/dist'>3d-camera-to-around</a></li>
<li><a href='/samples/3d-label-toggle/dist'>3d-label-toggle</a></li>
<li><a href='/samples/3d-marker-click-event/dist'>3d-marker-click-event</a></li>
<li><a href='/samples/3d-marker-customization/dist'>3d-marker-customization</a></li>
<li><a href='/samples/3d-marker-interactive/dist'>3d-marker-interactive</a></li>
<li><a href='/samples/3d-places/dist'>3d-places</a></li>
<li><a href='/samples/3d-places-autocomplete/dist'>3d-places-autocomplete</a></li>
<li><a href='/samples/3d-polygon/dist'>3d-polygon</a></li>
<li><a href='/samples/3d-polygon-click-event/dist'>3d-polygon-click-event</a></li>
<li><a href='/samples/3d-polygon-extruded-hole/dist'>3d-polygon-extruded-hole</a></li>
<li><a href='/samples/3d-polyline/dist'>3d-polyline</a></li>
<li><a href='/samples/3d-polyline-click-event/dist'>3d-polyline-click-event</a></li>
<li><a href='/samples/3d-polyline-extruded/dist'>3d-polyline-extruded</a></li>
<li><a href='/samples/3d-popover-location/dist'>3d-popover-location</a></li>
<li><a href='/samples/3d-popover-marker/dist'>3d-popover-marker</a></li>
<li><a href='/samples/3d-simple-map/dist'>3d-simple-map</a></li>
<li><a href='/samples/3d-simple-map-declarative/dist'>3d-simple-map-declarative</a></li>
<li><a href='/samples/3d-simple-marker/dist'>3d-simple-marker</a></li>
<li><a href='/samples/add-map/dist'>add-map</a></li>
<li><a href='/samples/advanced-markers-animation/dist'>advanced-markers-animation</a></li>
Expand Down
13 changes: 13 additions & 0 deletions dist/samples/3d-camera-to-around/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
}
}
23 changes: 23 additions & 0 deletions dist/samples/3d-camera-to-around/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<!--
@license
Copyright 2025 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_3d_camera_to_around] -->
<html>
<head>
<title>Map</title>

<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
</head>
<body>
<div id="map"></div>

<!-- 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: "alpha",});</script>
</body>
</html>
<!-- [END maps_3d_camera_to_around] -->
53 changes: 53 additions & 0 deletions dist/samples/3d-camera-to-around/app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// @ts-nocheck
// [START maps_3d_camera_to_around]
async function init() {
const { Map3DElement } = await google.maps.importLibrary("maps3d");

const map = new Map3DElement(
{ center: { lat: 37.79810773998413, lng : -122.41784275049939, altitude: 89.08476932205978 }, range: 6062.016931506805, tilt: 81.17100663963272, heading: -56.047035719765596, }
);

map.mode = "SATELLITE";

document.body.append(map);

// Used for both the fly to function and the location to fly around.
const flyToCamera = {
center: { lat: 21.263523536467105, lng : -157.80663691939296, altitude: 80.28936069489404 },
range: 1500.8202963253427, tilt: 76.9173260789542 ,heading: -44.59196007522445,
};

// Fly the camera from San Francisco to Hawaii, can be controlled by a button alternatively.
map.flyCameraTo({
// Where we are going to.
endCamera: flyToCamera,
// How long we want the flight to take.
durationMillis: 30000,
});

// When the animation has completed, fly around the location.
map.addEventListener('gmp-animationend', () => {
map.flyCameraAround({
// Location to fly around.
camera: flyToCamera,
// Length of time to fly to the location.
durationMillis: 50000,
// Number of rotations to make in the specified time.
rounds: 1
});
}, {once: true}); // Stop animation after flying around.

// At any time stop the animation.
map.addEventListener('gmp-click', (event) => {
map.stopCameraAnimation();
});
}

init();
// [END maps_3d_camera_to_around]
14 changes: 14 additions & 0 deletions dist/samples/3d-camera-to-around/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@js-api-samples/3d-camera-to-around",
"version": "1.0.0",
"scripts": {
"build": "tsc && bash ../jsfiddle.sh 3d-camera-to-around && bash ../app.sh 3d-camera-to-around && bash ../docs.sh 3d-camera-to-around && npm run build:vite --workspace=. && bash ../dist.sh 3d-camera-to-around",
"test": "tsc && npm run build:vite --workspace=.",
"start": "tsc && vite build --base './' && vite",
"build:vite": "vite build --base './'",
"preview": "vite preview"
},
"dependencies": {

}
}
19 changes: 19 additions & 0 deletions dist/samples/3d-camera-to-around/app/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/* [START maps_3d_camera_to_around] */
/* * Always set the map height explicitly to define the size of the div element
* that contains the map.
*/
html,
map {
height: 100%;
}
body {
height: 100%;
margin: 0;
padding: 0;
}
/* [END maps_3d_camera_to_around] */
17 changes: 17 additions & 0 deletions dist/samples/3d-camera-to-around/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 2025 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/html,map{height:100%}body{height:100%;margin:0;padding:0}
23 changes: 23 additions & 0 deletions dist/samples/3d-camera-to-around/dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<!--
@license
Copyright 2025 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_3d_camera_to_around] -->
<html>
<head>
<title>Map</title>

<script type="module" crossorigin src="./assets/index-CCfvJRed.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-DDwKyjRS.css">
</head>
<body>
<div id="map"></div>

<!-- 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: "alpha",});</script>
</body>
</html>
<!-- [END maps_3d_camera_to_around] -->
23 changes: 23 additions & 0 deletions dist/samples/3d-camera-to-around/docs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<!--
@license
Copyright 2025 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_3d_camera_to_around] -->
<html>
<head>
<title>Map</title>

<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
</head>
<body>
<div id="map"></div>

<!-- 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: "alpha",});</script>
</body>
</html>
<!-- [END maps_3d_camera_to_around] -->
43 changes: 43 additions & 0 deletions dist/samples/3d-camera-to-around/docs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"use strict";
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
// @ts-nocheck
// [START maps_3d_camera_to_around]
async function init() {
const { Map3DElement } = await google.maps.importLibrary("maps3d");
const map = new Map3DElement({ center: { lat: 37.79810773998413, lng: -122.41784275049939, altitude: 89.08476932205978 }, range: 6062.016931506805, tilt: 81.17100663963272, heading: -56.047035719765596, });
map.mode = "SATELLITE";
document.body.append(map);
// Used for both the fly to function and the location to fly around.
const flyToCamera = {
center: { lat: 21.263523536467105, lng: -157.80663691939296, altitude: 80.28936069489404 },
range: 1500.8202963253427, tilt: 76.9173260789542, heading: -44.59196007522445,
};
// Fly the camera from San Francisco to Hawaii, can be controlled by a button alternatively.
map.flyCameraTo({
// Where we are going to.
endCamera: flyToCamera,
// How long we want the flight to take.
durationMillis: 30000,
});
// When the animation has completed, fly around the location.
map.addEventListener('gmp-animationend', () => {
map.flyCameraAround({
// Location to fly around.
camera: flyToCamera,
// Length of time to fly to the location.
durationMillis: 50000,
// Number of rotations to make in the specified time.
rounds: 1
});
}, { once: true }); // Stop animation after flying around.
// At any time stop the animation.
map.addEventListener('gmp-click', (event) => {
map.stopCameraAnimation();
});
}
init();
// [END maps_3d_camera_to_around]
53 changes: 53 additions & 0 deletions dist/samples/3d-camera-to-around/docs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

// @ts-nocheck
// [START maps_3d_camera_to_around]
async function init() {
const { Map3DElement } = await google.maps.importLibrary("maps3d");

const map = new Map3DElement(
{ center: { lat: 37.79810773998413, lng : -122.41784275049939, altitude: 89.08476932205978 }, range: 6062.016931506805, tilt: 81.17100663963272, heading: -56.047035719765596, }
);

map.mode = "SATELLITE";

document.body.append(map);

// Used for both the fly to function and the location to fly around.
const flyToCamera = {
center: { lat: 21.263523536467105, lng : -157.80663691939296, altitude: 80.28936069489404 },
range: 1500.8202963253427, tilt: 76.9173260789542 ,heading: -44.59196007522445,
};

// Fly the camera from San Francisco to Hawaii, can be controlled by a button alternatively.
map.flyCameraTo({
// Where we are going to.
endCamera: flyToCamera,
// How long we want the flight to take.
durationMillis: 30000,
});

// When the animation has completed, fly around the location.
map.addEventListener('gmp-animationend', () => {
map.flyCameraAround({
// Location to fly around.
camera: flyToCamera,
// Length of time to fly to the location.
durationMillis: 50000,
// Number of rotations to make in the specified time.
rounds: 1
});
}, {once: true}); // Stop animation after flying around.

// At any time stop the animation.
map.addEventListener('gmp-click', (event) => {
map.stopCameraAnimation();
});
}

init();
// [END maps_3d_camera_to_around]
19 changes: 19 additions & 0 deletions dist/samples/3d-camera-to-around/docs/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/* [START maps_3d_camera_to_around] */
/* * Always set the map height explicitly to define the size of the div element
* that contains the map.
*/
html,
map {
height: 100%;
}
body {
height: 100%;
margin: 0;
padding: 0;
}
/* [END maps_3d_camera_to_around] */
19 changes: 19 additions & 0 deletions dist/samples/3d-camera-to-around/jsfiddle/demo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

/* * Always set the map height explicitly to define the size of the div element
* that contains the map.
*/
html,
map {
height: 100%;
}
body {
height: 100%;
margin: 0;
padding: 0;
}

7 changes: 7 additions & 0 deletions dist/samples/3d-camera-to-around/jsfiddle/demo.details
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: 3d-camera-to-around
authors:
- Geo Developer IX Documentation Team
tags:
- google maps
load_type: h
description: Sample code supporting Google Maps Platform JavaScript API documentation.
23 changes: 23 additions & 0 deletions dist/samples/3d-camera-to-around/jsfiddle/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!doctype html>
<!--
@license
Copyright 2025 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->

<html>
<head>
<title>Map</title>

<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
</head>
<body>
<div id="map"></div>

<!-- 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: "alpha",});</script>
</body>
</html>

Loading