Skip to content

Commit

Permalink
fix: Updates sample to show a location with more visual interest. (#1690
Browse files Browse the repository at this point in the history
)

Change-Id: I1180ada4007f7fec1daa257b530400e389c99c79
  • Loading branch information
willum070 committed Apr 8, 2024
1 parent 212db50 commit 522d012
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions samples/place-nearby-search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@

// [START maps_place_nearby_search]
let map;
let center;

async function initMap() {
const { Map, InfoWindow } = await google.maps.importLibrary('maps') as google.maps.MapsLibrary;

center = { lat: 37.4161493, lng: -122.0812166 };
let center = new google.maps.LatLng(52.369358, 4.889258);

map = new Map(document.getElementById('map') as HTMLElement, {
center: center,
zoom: 11,
// [START_EXCLUDE]
mapId: '4504f8b37365c3d0',
// [END_EXCLUDE]
mapId: 'DEMO_MAP_ID',
});
nearbySearch();
}
Expand All @@ -28,16 +25,20 @@ async function nearbySearch() {
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: { lat: 37.4161493, lng: -122.0812166 },
center: center,
radius: 500,
},
// optional parameters
includedPrimaryTypes: ['restaurant'],
maxResultCount: 8,
maxResultCount: 5,
rankPreference: SearchNearbyRankPreference.POPULARITY,
language: 'en-US',
region: 'us',
Expand Down

0 comments on commit 522d012

Please sign in to comment.