Skip to content

Commit 708c018

Browse files
committed
docs: add ROADMAP mode to 3D routes example and document alpha status
1 parent e838946 commit 708c018

5 files changed

Lines changed: 30 additions & 19 deletions

File tree

examples/map-3d-routes/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ GOOGLE_MAPS_API_KEY="<YOUR API KEY HERE>"
2020

2121
Photorealistic 3D Maps require WebGL2 support and hardware graphics acceleration. Please refer to the official **[Google Maps 3D Maps Browser Support Guide](https://developers.google.com/maps/documentation/javascript/3d-maps-support)** for detailed browser requirements and system compatibility guidelines.
2222

23-
*(Note: Virtual machine or remote desktop environments like Cloudtop do not support direct WebGL2 hardware rendering overlays by default. Please run the example locally on your physical host machine).*
23+
_(Note: Virtual machine or remote desktop environments like Cloudtop do not support direct WebGL2 hardware rendering overlays by default. Please run the example locally on your physical host machine)._
2424

2525
## Development & How to Run
2626

2727
Go into the example directory:
28+
2829
```shell
2930
cd examples/map-3d-routes
3031
```

examples/map-3d-routes/src/app.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* Styles for 3D Map Routes Programmatic Example */
2-
html, body, #app {
2+
html,
3+
body,
4+
#app {
35
width: 100%;
46
height: 100%;
57
margin: 0;

examples/map-3d-routes/src/app.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React, {useEffect, useState} from 'react';
22
import {createRoot} from 'react-dom/client';
33

44
import {
@@ -20,12 +20,15 @@ const Programmatic3DRoute = () => {
2020
const maps3dLibrary = useMapsLibrary('maps3d') as any;
2121

2222
useEffect(() => {
23-
console.log("=== 3D Routes Diagnostics ===");
24-
console.log("Map3D instance resolved:", map);
25-
console.log("routesLibrary state:", routesLibrary);
26-
console.log("maps3dLibrary state:", maps3dLibrary);
23+
console.log('=== 3D Routes Diagnostics ===');
24+
console.log('Map3D instance resolved:', map);
25+
console.log('routesLibrary state:', routesLibrary);
26+
console.log('maps3dLibrary state:', maps3dLibrary);
2727
if (window.google && window.google.maps) {
28-
console.log("Global window.google.maps keys:", Object.keys(window.google.maps));
28+
console.log(
29+
'Global window.google.maps keys:',
30+
Object.keys(window.google.maps)
31+
);
2932
}
3033
}, [map, routesLibrary, maps3dLibrary]);
3134

@@ -36,8 +39,8 @@ const Programmatic3DRoute = () => {
3639

3740
// Fetch the route programmatically using SDK computeRoutes
3841
routesLibrary.Route.computeRoutes({
39-
origin: { lat: 43.65, lng: -79.38 },
40-
destination: { lat: 43.69, lng: -79.42 },
42+
origin: {lat: 43.65, lng: -79.38},
43+
destination: {lat: 43.69, lng: -79.42},
4144
travelMode: 'DRIVING',
4245
fields: ['*']
4346
}).then((response: any) => {
@@ -69,14 +72,15 @@ const Map3DRoutesExample = () => {
6972
return (
7073
<>
7174
<Map3D
72-
defaultCenter={{ lat: 43.67, lng: -79.40, altitude: 100 }}
75+
defaultCenter={{lat: 43.67, lng: -79.4, altitude: 100}}
7376
defaultRange={12000}
7477
defaultHeading={0}
7578
defaultTilt={60}
7679
defaultRoll={0}
7780
defaultLabelsDisabled
81+
mode="ROADMAP"
7882
mapId="49ae42fed52588c3"
79-
style={{ width: '100%', height: '100%' }}>
83+
style={{width: '100%', height: '100%'}}>
8084
<Programmatic3DRoute />
8185
</Map3D>
8286
</>

examples/map-3d-routes/src/control-panel.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ function ControlPanel() {
66
<div className="control-panel">
77
<h3>3D Map Routes (JS API)</h3>
88
<p>
9-
This example demonstrates how to retrieve a route programmatically using the
10-
modern <code>google.maps.routes.Route.computeRoutes(...)</code> SDK method
11-
and visualize it cleanly using a custom-styled 3D polyline.
9+
This example demonstrates how to retrieve a route programmatically using
10+
the modern <code>google.maps.routes.Route.computeRoutes(...)</code> SDK
11+
method and visualize it cleanly using a custom-styled 3D polyline.
1212
</p>
1313

1414
<p className={'note'}>
15-
<strong>Note:</strong> This utilizes custom 3D elements and routing from the Maps JS API{' '}
15+
<strong>Note:</strong> This utilizes custom 3D elements and routing from
16+
the Maps JS API{' '}
1617
<a
1718
href="https://developers.google.com/maps/documentation/javascript/reference/route"
1819
target="_new">
@@ -24,7 +25,8 @@ function ControlPanel() {
2425
target="_new">
2526
3D Map
2627
</a>{' '}
27-
libraries.
28+
libraries.{' '}
29+
<strong>Note that ROADMAP mode is currently in Alpha.</strong>
2830
</p>
2931

3032
<div className="links">

examples/map-3d-routes/vite.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ export default defineConfig(({mode}) => {
1818
'../../examples/examples.css'
1919
),
2020
'@vis.gl/react-google-maps': resolve('../../src/index.ts'),
21-
'@googlemaps/js-api-loader': resolve('./node_modules/@googlemaps/js-api-loader'),
21+
'@googlemaps/js-api-loader': resolve(
22+
'./node_modules/@googlemaps/js-api-loader'
23+
),
2224
'fast-deep-equal': resolve('./node_modules/fast-deep-equal'),
23-
'react': resolve('./node_modules/react'),
25+
react: resolve('./node_modules/react'),
2426
'react-dom': resolve('./node_modules/react-dom')
2527
}
2628
}

0 commit comments

Comments
 (0)