Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps API not showing places

I've been using a Google maps API v3 (Javascript) for a map, everything's been working great.

Recently we got a Google API for Work account. So, we've incorporated our client ID in our map call:

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?client=gme-clientid&v=3.18"></script>

And ever since then, restaurants, banks, stores, etc. do not appear on the map. Only big places, like Universities, state parks, airports, etc.

Removing the client parameter from the src restores the expected functionality.

Can anyone explain why this is happening, or how to restore the desired functionality?

like image 552
sharf Avatar asked Oct 24 '25 19:10

sharf


1 Answers

I assume either by default for when a client ID is specified, or perhaps setup specifically for your account, that those types of features are disabled. Perhaps when you create the map if you explicitly say you want those features enabled, they should appear I would expect.

See https://developers.google.com/maps/documentation/javascript/styling#map_features

I'm guessing these are in the poi.business category of features. You could try something like:

var map = new google.maps.Map(mapDiv, {
    center: {lat: coordinates.latitude, lng: coordinates.longitude},
    zoom: 13,
    styles: [{
        featureType: 'poi.business',
        elementType: 'labels',
        stylers: [{
            visibility: 'on'
        }]
    }]
});

If that doesn't work, try featureType: 'all',

like image 152
duncan Avatar answered Oct 26 '25 08:10

duncan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!