Wie beschränke ich Google Maps automatisch auf nur ein Land?JavaScript

Javascript-Forum
Anonymous
 Wie beschränke ich Google Maps automatisch auf nur ein Land?

Post by Anonymous »

Ich habe alles ausprobiert, also gibt meine Sucheingabe nur Autokonompletenoptionen aus nur der Dominikanischen Republik, aber ich konnte sie nicht erreichen. Hier weiß jemand hier, wie das geht? < /p>

Code: Select all



let autocomplete;

const input = document.getElementById('searchInput');
autocomplete = new google.maps.places.Autocomplete(input, {
types: ['(cities)', 'geocode'], // Allow both city and address searches
componentRestrictions: { country: 'do' }
});

// Handle place selection
autocomplete.addListener('place_changed', function() {
const place = autocomplete.getPlace();

if (!place.geometry) {
return;
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post