diff --git a/samples/layer-bicycling/README.md b/samples/layer-bicycling/README.md new file mode 100644 index 000000000..25c38bc11 --- /dev/null +++ b/samples/layer-bicycling/README.md @@ -0,0 +1,41 @@ +# Google Maps JavaScript Sample + +## layer-bicycling + +Bicycling layer sample. + +## Setup + +### Before starting run: + +`npm i` + +### Run an example on a local web server + +`cd samples/layer-bicycling` +`npm start` + +### Build an individual example + +`cd samples/layer-bicycling` +`npm run build` + +From 'samples': + +`npm run build --workspace=layer-bicycling/` + +### Build all of the examples. + +From 'samples': + +`npm run build-all` + +### Run lint to check for problems + +`cd samples/layer-bicycling` +`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). diff --git a/samples/layer-bicycling/index.html b/samples/layer-bicycling/index.html new file mode 100644 index 000000000..80e6552e6 --- /dev/null +++ b/samples/layer-bicycling/index.html @@ -0,0 +1,22 @@ + + + + + + Bicycle Layer + + + + + + + + + + + diff --git a/samples/layer-bicycling/index.ts b/samples/layer-bicycling/index.ts new file mode 100644 index 000000000..648a0cc30 --- /dev/null +++ b/samples/layer-bicycling/index.ts @@ -0,0 +1,22 @@ +/** + * @license + * Copyright 2026 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +// [START maps_layer_bicycling] +async function initMap(): Promise { + await google.maps.importLibrary('maps'); + + const mapElement = document.querySelector( + 'gmp-map' + ) as google.maps.MapElement; + const innerMap = mapElement.innerMap; + + const bikeLayer = new google.maps.BicyclingLayer(); + + bikeLayer.setMap(innerMap); +} + +initMap(); +// [END maps_layer_bicycling] diff --git a/samples/layer-bicycling/package.json b/samples/layer-bicycling/package.json new file mode 100644 index 000000000..bf27fe8f2 --- /dev/null +++ b/samples/layer-bicycling/package.json @@ -0,0 +1,12 @@ +{ + "name": "@js-api-samples/layer-bicycling", + "version": "1.0.0", + "scripts": { + "build": "tsc && bash ../jsfiddle.sh layer-bicycling && bash ../app.sh layer-bicycling && bash ../docs.sh layer-bicycling && npm run build:vite --workspace=. && bash ../dist.sh layer-bicycling", + "test": "tsc && npm run build:vite --workspace=.", + "start": "tsc && vite build --base './' && vite", + "build:vite": "vite build --base './'", + "preview": "vite preview" + }, + "dependencies": {} +} diff --git a/samples/layer-bicycling/style.css b/samples/layer-bicycling/style.css new file mode 100644 index 000000000..574dd8eae --- /dev/null +++ b/samples/layer-bicycling/style.css @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2026 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +/* [START maps_layer_bicycling] */ +/* + * Optional: Makes the sample page fill the window. + */ +html, +body { + height: 100%; + margin: 0; + padding: 0; +} + +/* [END maps_layer_bicycling] */ diff --git a/samples/layer-bicycling/tsconfig.json b/samples/layer-bicycling/tsconfig.json new file mode 100644 index 000000000..976bcc6ef --- /dev/null +++ b/samples/layer-bicycling/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "." + }, + "include": ["./*.ts"] +}