How to show Google Map for particular Country with selected Provinces?

How to show Google Map for particular Country with selected Provinces

Hello to all, welcome to therichpost.com. Today In this post, I will show, How to show Google Map for particular Country with selected Provinces?

If you new in Google map or you want know more about it then you can check my posts related to Google Maps.

This post is very interesting and I am hoping, you will all like this also very much.

How to show Google Map for particular Country with selected Provinces

Here is the working code and you can add this into your html file:

<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
      google.charts.load('current', {
        'packages':['geomap'],
        // Note: you will need to get a mapsApiKey for your project.
        // See: https://developers.google.com/chart/interactive/docs/basic_load_libs#load-settings
        'mapsApiKey': 'AIzaSyD-9tSrke72PouQMnMX-a7eZSW0jkFMBWY'
      });
      google.charts.setOnLoadCallback(drawRegionsMap);

      function drawRegionsMap() {
        var data = google.visualization.arrayToDataTable([
            ['Regions', 'Popularity'],
            ['New York', 200],
            ['Texas', 500],
            ['California', 600]
            
        ]);

         var options = {};
         options['region'] = 'US';
         options['resolution'] = 'provinces';
         

        var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));

        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="regions_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

If you have any query or you want more advance code related to this, then you can comment below or ask question.

Thank you,

Harjas,

TheRichPost

Comments

15 responses to “How to show Google Map for particular Country with selected Provinces?”

  1. Curious Avatar
    Curious

    Hi, Can we use this in Angular?

  2. Ajay Malhotra Avatar
    Ajay Malhotra

    yes we can

  3. Jasmeen kaur Avatar
    Jasmeen kaur

    Thank you for this post.

  4. Ajay Malhotra Avatar

    Your most welcome

  5. Hasviny rao Avatar
    Hasviny rao

    Hi. How about Malaysian cities? Can we add? Because I couldn’t find the city code.

  6. Ajay Malhotra Avatar

    May be with help of lat long.

  7. Utkarsh Avatar
    Utkarsh

    how to incorporate this in angular

  8. Ajay Malhotra Avatar

    Yes I have example on this.

  9. Utkarsh Avatar
    Utkarsh

    plz share…as I’m stuck over this for several hours

  10. Utkarsh Avatar
    Utkarsh

    plz share, as i’m stuck over this for several hours

  11. Ajay Malhotra Avatar

    Please search via blog search, thanks.

  12. Utkarsh Avatar
    Utkarsh

    plz share, as i’m stuck over this for several hours

  13. Utkarsh Avatar
    Utkarsh

    please provide a link

  14. Utkarsh Avatar
    Utkarsh

    Please share the link, i’m unable to find it.

  15. Utkarsh Avatar
    Utkarsh

    please share the link as i’m unable to find it