最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Google Maps API not showing places - Stack Overflow

programmeradmin3浏览0评论

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=";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?

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./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?

Share Improve this question asked Jan 16, 2015 at 0:23 sharfsharf 2,1434 gold badges26 silver badges48 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 9

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./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',

发布评论

评论列表(0)

  1. 暂无评论