Mazaetos
Mazaetos

Reputation: 52

Leaflet GeoSearch: Google Provider not working

I'm trying to incorporate search in my map using the Google Provider (I'm using this (Smeijer/Leaflet-GeoSearch) plugin with Leaflet), however I'm not able to make it work. My code is very direct:

        const searchControl = new GeoSearch.GeoSearchControl({
            provider: new GeoSearch.GoogleProvider({
                apiKey: 'MY_GOOGLE_API_KEY'}),
            position: 'topright',
            style: 'bar',
            // provider: new GeoSearch.OpenStreetMapProvider(),
        });
        
        map.addControl(searchControl);

If I use the OSM provider (commented out in the code above), the search works fine (the results are kind of obsolete for my region, but it works) (Figure 1) . But if I use the Google Provider, nothing appears as a result of the search (Figure 2).

image

image

Some more details:

Upvotes: 0

Views: 175

Answers (0)

Related Questions