Skip to content
Open
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
13 changes: 10 additions & 3 deletions samples/3d-simple-map/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!doctype html>
<!--
@license
Copyright 2025 Google LLC. All Rights Reserved.
Copyright 2026 Google LLC. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!-- [START maps_3d_simple_map] -->
Expand All @@ -11,11 +11,18 @@

<link rel="stylesheet" type="text/css" href="./style.css" />
<script type="module" src="./index.js"></script>
</head>
<body>
<!-- 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-3d
center="37.7704, -122.3985, 500"
zoom="15"
tilt="67.5"
mode="hybrid"
gesture-handling="cooperative">
</gmp-map-3d>
</body>
</html>
<!-- [END maps_3d_simple_map] -->
27 changes: 17 additions & 10 deletions samples/3d-simple-map/index.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,29 @@
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* Copyright 2026 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

//@ts-nocheck
// [START maps_3d_simple_map]
async function initMap() {
//@ts-ignore
const { Map3DElement } = await google.maps.importLibrary('maps3d');

const map = new Map3DElement({
center: { lat: 37.7704, lng: -122.3985, altitude: 500 },
tilt: 67.5,
mode: 'HYBRID',
gestureHandling: 'COOPERATIVE',
});
// Get the gmp-map element.
const mapElement = document.querySelector(
'gmp-map-3d'
//@ts-ignore
) as Map3DElement;

document.body.append(map);
// Wait for the map to finish loading.
google.maps.event.addListenerOnce(mapElement, 'tilesloaded', () => {
// Get the inner map.
const innerMap = mapElement.innerMap;

// Set map options.
innerMap.setOptions({
mapTypeControl: false,
});
});
}

initMap();
Expand Down
6 changes: 2 additions & 4 deletions samples/3d-simple-map/style.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
/*
* @license
* Copyright 2025 Google LLC. All Rights Reserved.
* Copyright 2026 Google LLC. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/* [START maps_3d_simple_map] */
/* * Always set the map height explicitly to define the size of the div element
* that contains the map.
*/
#gmp-map-3d {
height: 100%;
}

html,
body {
height: 100%;
Expand Down
Loading