Search code examples
google-mapsgoogle-maps-api-3point-of-interest

Display all of specific POI in a country - google maps


I am working on a project which happens to collaborate with google maps. I would like to display all of business POI in one country. I guess this is not enough:

 {
  featureType: "poi.business",
  elementType: "labels",
  stylers: [
   { visibility: "on" }
  ]
 }

It would be better to build up a function which counts the length of all the POI then displays them on the map, but I am quite new with the Google Maps api. Any ideas?


Solution

  • SOLVED

                var title = [];
                var first = ""; 
    
                /* Where markers[i] is already provided */
                for( var j in markers[i]["marker"] ) 
                {
                    if( !first )
                    {
                        first = j;
                    }
                    if( markers[i]["marker"][j]["name2"] )
                    {
                        title.push(markers[i]["marker"][j]["name2"]);
                    }
                    else
                    {
                        title.push(markers[i]["marker"][j]["name"]);
                    }
                }
    

    Then I call the map with the markers :D Thanks a lot people