From 34633dd8a60d3137b3311cf634e92a84ceed42a2 Mon Sep 17 00:00:00 2001 From: googlemaps-bot Date: Thu, 31 Jul 2025 14:12:29 +0000 Subject: [PATCH] Update dist folder [skip ci] --- dist/index.html | 1 + .../place-nearby-search/app/.eslintsrc.json | 13 ++++ .../samples/place-nearby-search/app/README.md | 33 ++++++++ .../place-nearby-search/app/index.html | 23 ++++++ dist/samples/place-nearby-search/app/index.ts | 78 +++++++++++++++++++ .../place-nearby-search/app/package.json | 14 ++++ .../samples/place-nearby-search/app/style.css | 25 ++++++ .../place-nearby-search/app/tsconfig.json | 17 ++++ .../dist/assets/index-DW_Ml_OD.css | 5 ++ .../dist/assets/index-UUptK1XA.js | 5 ++ .../place-nearby-search/dist/index.html | 23 ++++++ .../place-nearby-search/docs/index.html | 23 ++++++ .../samples/place-nearby-search/docs/index.js | 65 ++++++++++++++++ .../samples/place-nearby-search/docs/index.ts | 78 +++++++++++++++++++ .../place-nearby-search/docs/style.css | 25 ++++++ .../place-nearby-search/jsfiddle/demo.css | 24 ++++++ .../place-nearby-search/jsfiddle/demo.details | 7 ++ .../place-nearby-search/jsfiddle/demo.html | 23 ++++++ .../place-nearby-search/jsfiddle/demo.js | 65 ++++++++++++++++ index.html | 1 + package-lock.json | 8 ++ 21 files changed, 556 insertions(+) create mode 100644 dist/samples/place-nearby-search/app/.eslintsrc.json create mode 100644 dist/samples/place-nearby-search/app/README.md create mode 100644 dist/samples/place-nearby-search/app/index.html create mode 100644 dist/samples/place-nearby-search/app/index.ts create mode 100644 dist/samples/place-nearby-search/app/package.json create mode 100644 dist/samples/place-nearby-search/app/style.css create mode 100644 dist/samples/place-nearby-search/app/tsconfig.json create mode 100644 dist/samples/place-nearby-search/dist/assets/index-DW_Ml_OD.css create mode 100644 dist/samples/place-nearby-search/dist/assets/index-UUptK1XA.js create mode 100644 dist/samples/place-nearby-search/dist/index.html create mode 100644 dist/samples/place-nearby-search/docs/index.html create mode 100644 dist/samples/place-nearby-search/docs/index.js create mode 100644 dist/samples/place-nearby-search/docs/index.ts create mode 100644 dist/samples/place-nearby-search/docs/style.css create mode 100644 dist/samples/place-nearby-search/jsfiddle/demo.css create mode 100644 dist/samples/place-nearby-search/jsfiddle/demo.details create mode 100644 dist/samples/place-nearby-search/jsfiddle/demo.html create mode 100644 dist/samples/place-nearby-search/jsfiddle/demo.js diff --git a/dist/index.html b/dist/index.html index 8355aabeb..b36ac7424 100644 --- a/dist/index.html +++ b/dist/index.html @@ -54,6 +54,7 @@

Maps JSAPI Samples

  • place-autocomplete-element
  • place-autocomplete-map
  • place-class
  • +
  • place-nearby-search
  • place-text-search
  • test-example
  • ui-kit-customization
  • diff --git a/dist/samples/place-nearby-search/app/.eslintsrc.json b/dist/samples/place-nearby-search/app/.eslintsrc.json new file mode 100644 index 000000000..4c44dab04 --- /dev/null +++ b/dist/samples/place-nearby-search/app/.eslintsrc.json @@ -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 + } +} diff --git a/dist/samples/place-nearby-search/app/README.md b/dist/samples/place-nearby-search/app/README.md new file mode 100644 index 000000000..385d89239 --- /dev/null +++ b/dist/samples/place-nearby-search/app/README.md @@ -0,0 +1,33 @@ +# 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 + +First `cd` to the folder for the sample to run, then: + +`npm start` + +### Build an individual example + +From `samples/`: + +`npm run build --workspace=sample-name/` + +### Build all of the examples. + +From `samples/`: + +`npm run build-all` + +## 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/dist/samples/place-nearby-search/app/index.html b/dist/samples/place-nearby-search/app/index.html new file mode 100644 index 000000000..cb2aac659 --- /dev/null +++ b/dist/samples/place-nearby-search/app/index.html @@ -0,0 +1,23 @@ + + + + + + Nearby Search + + + + + +
    + + + + + + diff --git a/dist/samples/place-nearby-search/app/index.ts b/dist/samples/place-nearby-search/app/index.ts new file mode 100644 index 000000000..dd92b4e5c --- /dev/null +++ b/dist/samples/place-nearby-search/app/index.ts @@ -0,0 +1,78 @@ +/** + * @license + * Copyright 2024 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +// [START maps_place_nearby_search] +let map; + +async function initMap() { + const { Map, InfoWindow } = await google.maps.importLibrary('maps') as google.maps.MapsLibrary; + + let center = new google.maps.LatLng(52.369358, 4.889258); + + map = new Map(document.getElementById('map') as HTMLElement, { + center: center, + zoom: 11, + mapId: 'DEMO_MAP_ID', + mapTypeControl: false, + }); + nearbySearch(); +} + +async function nearbySearch() { + //@ts-ignore + const { Place, SearchNearbyRankPreference } = await google.maps.importLibrary('places') as google.maps.PlacesLibrary; + const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary; + // [START maps_place_nearby_search_request] + + // Restrict within the map viewport. + let center = new google.maps.LatLng(52.369358, 4.889258); + + const request = { + // required parameters + fields: ['displayName', 'location', 'businessStatus'], + locationRestriction: { + center: center, + radius: 500, + }, + // optional parameters + includedPrimaryTypes: ['restaurant'], + maxResultCount: 5, + rankPreference: SearchNearbyRankPreference.POPULARITY, + language: 'en-US', + region: 'us', + }; + + //@ts-ignore + const { places } = await Place.searchNearby(request); + // [END maps_place_nearby_search_request] + + if (places.length) { + console.log(places); + + const { LatLngBounds } = await google.maps.importLibrary("core") as google.maps.CoreLibrary; + const bounds = new LatLngBounds(); + + // Loop through and get all the results. + places.forEach((place) => { + const markerView = new AdvancedMarkerElement({ + map, + position: place.location, + title: place.displayName, + }); + + bounds.extend(place.location as google.maps.LatLng); + console.log(place); + }); + + map.fitBounds(bounds); + + } else { + console.log("No results"); + } +} + +initMap(); +// [END maps_place_nearby_search] diff --git a/dist/samples/place-nearby-search/app/package.json b/dist/samples/place-nearby-search/app/package.json new file mode 100644 index 000000000..2d6f27154 --- /dev/null +++ b/dist/samples/place-nearby-search/app/package.json @@ -0,0 +1,14 @@ +{ + "name": "@js-api-samples/place-nearby-search", + "version": "1.0.0", + "scripts": { + "build": "tsc && bash ../jsfiddle.sh place-nearby-search && bash ../app.sh place-nearby-search && bash ../docs.sh place-nearby-search && npm run build:vite --workspace=. && bash ../dist.sh place-nearby-search", + "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/dist/samples/place-nearby-search/app/style.css b/dist/samples/place-nearby-search/app/style.css new file mode 100644 index 000000000..68d7d2d32 --- /dev/null +++ b/dist/samples/place-nearby-search/app/style.css @@ -0,0 +1,25 @@ +/** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +/* [START maps_place_nearby_search] */ +/* + * Always set the map height explicitly to define the size of the div element + * that contains the map. + */ +#map { + height: 100%; +} + +/* + * Optional: Makes the sample page fill the window. + */ +html, +body { + height: 100%; + margin: 0; + padding: 0; +} + +/* [END maps_place_nearby_search] */ \ No newline at end of file diff --git a/dist/samples/place-nearby-search/app/tsconfig.json b/dist/samples/place-nearby-search/app/tsconfig.json new file mode 100644 index 000000000..366aabb04 --- /dev/null +++ b/dist/samples/place-nearby-search/app/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "esnext", + "target": "esnext", + "strict": true, + "noImplicitAny": false, + "lib": [ + "es2015", + "esnext", + "es6", + "dom", + "dom.iterable" + ], + "moduleResolution": "Node", + "jsx": "preserve" + } +} diff --git a/dist/samples/place-nearby-search/dist/assets/index-DW_Ml_OD.css b/dist/samples/place-nearby-search/dist/assets/index-DW_Ml_OD.css new file mode 100644 index 000000000..672cb7cc9 --- /dev/null +++ b/dist/samples/place-nearby-search/dist/assets/index-DW_Ml_OD.css @@ -0,0 +1,5 @@ +/** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */#map{height:100%}html,body{height:100%;margin:0;padding:0} diff --git a/dist/samples/place-nearby-search/dist/assets/index-UUptK1XA.js b/dist/samples/place-nearby-search/dist/assets/index-UUptK1XA.js new file mode 100644 index 000000000..1795910cb --- /dev/null +++ b/dist/samples/place-nearby-search/dist/assets/index-UUptK1XA.js @@ -0,0 +1,5 @@ +(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))a(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const n of t.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&a(n)}).observe(document,{childList:!0,subtree:!0});function r(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function a(e){if(e.ep)return;e.ep=!0;const t=r(e);fetch(e.href,t)}})();/** + * @license + * Copyright 2024 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */let c;async function u(){const{Map:s,InfoWindow:o}=await google.maps.importLibrary("maps");let r=new google.maps.LatLng(52.369358,4.889258);c=new s(document.getElementById("map"),{center:r,zoom:11,mapId:"DEMO_MAP_ID",mapTypeControl:!1}),d()}async function d(){const{Place:s,SearchNearbyRankPreference:o}=await google.maps.importLibrary("places"),{AdvancedMarkerElement:r}=await google.maps.importLibrary("marker");let a=new google.maps.LatLng(52.369358,4.889258);const e={fields:["displayName","location","businessStatus"],locationRestriction:{center:a,radius:500},includedPrimaryTypes:["restaurant"],maxResultCount:5,rankPreference:o.POPULARITY,language:"en-US",region:"us"},{places:t}=await s.searchNearby(e);if(t.length){console.log(t);const{LatLngBounds:n}=await google.maps.importLibrary("core"),l=new n;t.forEach(i=>{new r({map:c,position:i.location,title:i.displayName}),l.extend(i.location),console.log(i)}),c.fitBounds(l)}else console.log("No results")}u(); diff --git a/dist/samples/place-nearby-search/dist/index.html b/dist/samples/place-nearby-search/dist/index.html new file mode 100644 index 000000000..5e894ffc5 --- /dev/null +++ b/dist/samples/place-nearby-search/dist/index.html @@ -0,0 +1,23 @@ + + + + + + Nearby Search + + + + + +
    + + + + + + diff --git a/dist/samples/place-nearby-search/docs/index.html b/dist/samples/place-nearby-search/docs/index.html new file mode 100644 index 000000000..cb2aac659 --- /dev/null +++ b/dist/samples/place-nearby-search/docs/index.html @@ -0,0 +1,23 @@ + + + + + + Nearby Search + + + + + +
    + + + + + + diff --git a/dist/samples/place-nearby-search/docs/index.js b/dist/samples/place-nearby-search/docs/index.js new file mode 100644 index 000000000..1ca510b3f --- /dev/null +++ b/dist/samples/place-nearby-search/docs/index.js @@ -0,0 +1,65 @@ +"use strict"; +/** + * @license + * Copyright 2024 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +// [START maps_place_nearby_search] +let map; +async function initMap() { + const { Map, InfoWindow } = await google.maps.importLibrary('maps'); + let center = new google.maps.LatLng(52.369358, 4.889258); + map = new Map(document.getElementById('map'), { + center: center, + zoom: 11, + mapId: 'DEMO_MAP_ID', + mapTypeControl: false, + }); + nearbySearch(); +} +async function nearbySearch() { + //@ts-ignore + const { Place, SearchNearbyRankPreference } = await google.maps.importLibrary('places'); + const { AdvancedMarkerElement } = await google.maps.importLibrary("marker"); + // [START maps_place_nearby_search_request] + // Restrict within the map viewport. + let center = new google.maps.LatLng(52.369358, 4.889258); + const request = { + // required parameters + fields: ['displayName', 'location', 'businessStatus'], + locationRestriction: { + center: center, + radius: 500, + }, + // optional parameters + includedPrimaryTypes: ['restaurant'], + maxResultCount: 5, + rankPreference: SearchNearbyRankPreference.POPULARITY, + language: 'en-US', + region: 'us', + }; + //@ts-ignore + const { places } = await Place.searchNearby(request); + // [END maps_place_nearby_search_request] + if (places.length) { + console.log(places); + const { LatLngBounds } = await google.maps.importLibrary("core"); + const bounds = new LatLngBounds(); + // Loop through and get all the results. + places.forEach((place) => { + const markerView = new AdvancedMarkerElement({ + map, + position: place.location, + title: place.displayName, + }); + bounds.extend(place.location); + console.log(place); + }); + map.fitBounds(bounds); + } + else { + console.log("No results"); + } +} +initMap(); +// [END maps_place_nearby_search] diff --git a/dist/samples/place-nearby-search/docs/index.ts b/dist/samples/place-nearby-search/docs/index.ts new file mode 100644 index 000000000..dd92b4e5c --- /dev/null +++ b/dist/samples/place-nearby-search/docs/index.ts @@ -0,0 +1,78 @@ +/** + * @license + * Copyright 2024 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +// [START maps_place_nearby_search] +let map; + +async function initMap() { + const { Map, InfoWindow } = await google.maps.importLibrary('maps') as google.maps.MapsLibrary; + + let center = new google.maps.LatLng(52.369358, 4.889258); + + map = new Map(document.getElementById('map') as HTMLElement, { + center: center, + zoom: 11, + mapId: 'DEMO_MAP_ID', + mapTypeControl: false, + }); + nearbySearch(); +} + +async function nearbySearch() { + //@ts-ignore + const { Place, SearchNearbyRankPreference } = await google.maps.importLibrary('places') as google.maps.PlacesLibrary; + const { AdvancedMarkerElement } = await google.maps.importLibrary("marker") as google.maps.MarkerLibrary; + // [START maps_place_nearby_search_request] + + // Restrict within the map viewport. + let center = new google.maps.LatLng(52.369358, 4.889258); + + const request = { + // required parameters + fields: ['displayName', 'location', 'businessStatus'], + locationRestriction: { + center: center, + radius: 500, + }, + // optional parameters + includedPrimaryTypes: ['restaurant'], + maxResultCount: 5, + rankPreference: SearchNearbyRankPreference.POPULARITY, + language: 'en-US', + region: 'us', + }; + + //@ts-ignore + const { places } = await Place.searchNearby(request); + // [END maps_place_nearby_search_request] + + if (places.length) { + console.log(places); + + const { LatLngBounds } = await google.maps.importLibrary("core") as google.maps.CoreLibrary; + const bounds = new LatLngBounds(); + + // Loop through and get all the results. + places.forEach((place) => { + const markerView = new AdvancedMarkerElement({ + map, + position: place.location, + title: place.displayName, + }); + + bounds.extend(place.location as google.maps.LatLng); + console.log(place); + }); + + map.fitBounds(bounds); + + } else { + console.log("No results"); + } +} + +initMap(); +// [END maps_place_nearby_search] diff --git a/dist/samples/place-nearby-search/docs/style.css b/dist/samples/place-nearby-search/docs/style.css new file mode 100644 index 000000000..68d7d2d32 --- /dev/null +++ b/dist/samples/place-nearby-search/docs/style.css @@ -0,0 +1,25 @@ +/** + * @license + * Copyright 2019 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ +/* [START maps_place_nearby_search] */ +/* + * Always set the map height explicitly to define the size of the div element + * that contains the map. + */ +#map { + height: 100%; +} + +/* + * Optional: Makes the sample page fill the window. + */ +html, +body { + height: 100%; + margin: 0; + padding: 0; +} + +/* [END maps_place_nearby_search] */ \ No newline at end of file diff --git a/dist/samples/place-nearby-search/jsfiddle/demo.css b/dist/samples/place-nearby-search/jsfiddle/demo.css new file mode 100644 index 000000000..fa4d8cd3c --- /dev/null +++ b/dist/samples/place-nearby-search/jsfiddle/demo.css @@ -0,0 +1,24 @@ +/** + * @license + * Copyright 2019 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. + */ +#map { + height: 100%; +} + +/* + * Optional: Makes the sample page fill the window. + */ +html, +body { + height: 100%; + margin: 0; + padding: 0; +} + diff --git a/dist/samples/place-nearby-search/jsfiddle/demo.details b/dist/samples/place-nearby-search/jsfiddle/demo.details new file mode 100644 index 000000000..3783bf86b --- /dev/null +++ b/dist/samples/place-nearby-search/jsfiddle/demo.details @@ -0,0 +1,7 @@ +name: place-nearby-search +authors: + - Geo Developer IX Documentation Team +tags: + - google maps +load_type: h +description: Sample code supporting Google Maps Platform JavaScript API documentation. diff --git a/dist/samples/place-nearby-search/jsfiddle/demo.html b/dist/samples/place-nearby-search/jsfiddle/demo.html new file mode 100644 index 000000000..bd164ad9f --- /dev/null +++ b/dist/samples/place-nearby-search/jsfiddle/demo.html @@ -0,0 +1,23 @@ + + + + + + Nearby Search + + + + + +
    + + + + + + diff --git a/dist/samples/place-nearby-search/jsfiddle/demo.js b/dist/samples/place-nearby-search/jsfiddle/demo.js new file mode 100644 index 000000000..39ddb80e6 --- /dev/null +++ b/dist/samples/place-nearby-search/jsfiddle/demo.js @@ -0,0 +1,65 @@ +"use strict"; +/** + * @license + * Copyright 2024 Google LLC. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +let map; +async function initMap() { + const { Map, InfoWindow } = await google.maps.importLibrary('maps'); + let center = new google.maps.LatLng(52.369358, 4.889258); + map = new Map(document.getElementById('map'), { + center: center, + zoom: 11, + mapId: 'DEMO_MAP_ID', + mapTypeControl: false, + }); + nearbySearch(); +} +async function nearbySearch() { + //@ts-ignore + const { Place, SearchNearbyRankPreference } = await google.maps.importLibrary('places'); + const { AdvancedMarkerElement } = await google.maps.importLibrary("marker"); + + // Restrict within the map viewport. + let center = new google.maps.LatLng(52.369358, 4.889258); + const request = { + // required parameters + fields: ['displayName', 'location', 'businessStatus'], + locationRestriction: { + center: center, + radius: 500, + }, + // optional parameters + includedPrimaryTypes: ['restaurant'], + maxResultCount: 5, + rankPreference: SearchNearbyRankPreference.POPULARITY, + language: 'en-US', + region: 'us', + }; + //@ts-ignore + const { places } = await Place.searchNearby(request); + + if (places.length) { + console.log(places); + const { LatLngBounds } = await google.maps.importLibrary("core"); + const bounds = new LatLngBounds(); + // Loop through and get all the results. + places.forEach((place) => { + const markerView = new AdvancedMarkerElement({ + map, + position: place.location, + title: place.displayName, + }); + bounds.extend(place.location); + console.log(place); + }); + map.fitBounds(bounds); + } + else { + console.log("No results"); + } +} +initMap(); + diff --git a/index.html b/index.html index 8355aabeb..b36ac7424 100644 --- a/index.html +++ b/index.html @@ -54,6 +54,7 @@

    Maps JSAPI Samples

  • place-autocomplete-element
  • place-autocomplete-map
  • place-class
  • +
  • place-nearby-search
  • place-text-search
  • test-example
  • ui-kit-customization
  • diff --git a/package-lock.json b/package-lock.json index f9d134069..f6dd8df19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -659,6 +659,10 @@ "resolved": "samples/place-class", "link": true }, + "node_modules/@js-api-samples/place-nearby-search": { + "resolved": "samples/place-nearby-search", + "link": true + }, "node_modules/@js-api-samples/place-text-search": { "resolved": "samples/place-text-search", "link": true @@ -2548,6 +2552,10 @@ "name": "@js-api-samples/place-class", "version": "1.0.0" }, + "samples/place-nearby-search": { + "name": "@js-api-samples/place-nearby-search", + "version": "1.0.0" + }, "samples/place-text-search": { "name": "@js-api-samples/place-text-search", "version": "1.0.0"