-2

I want to show in my website only certain places using GoogleMap.It shouldn't show any small places.Only major places should be visilble in map.What is procedure to obtain this?

1 Answers1

0

Set your lat/lon to the location of a post office (or other city indicator). Then, use the zoom property to fix to the level you want to encompass.

See: https://developers.google.com/maps/documentation/javascript/examples/marker-simple

Here is the code form the example:

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Simple markers</title>
    <style>
      /* Always set the map height explicitly to define the size of the div
       * element that contains the map. */
      #map {
        height: 100%;
      }
      /* Optional: Makes the sample page fill the window. */
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <div id="map"></div>
    <script>

      function initMap() {
        var myLatLng = {lat: -25.363, lng: 131.044};

        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 4,
          center: myLatLng
        });

        var marker = new google.maps.Marker({
          position: myLatLng,
          map: map,
          title: 'Hello World!'
        });
      }
    </script>
    <script async defer
    src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
    </script>
  </body>
</html>

Try that script at map.zoom = 16. Should be close to city view. London I think.

You can also set map bounds, but that is a lot harder. You would need to find your location, then plot geometry around that area, define the points, and then, zoom all points into view. All of this is possible, but you showed me no code, so I'm not showing any back.

Hope you found something useful,

JRodd
  • 267
  • 4
  • 13
  • If your going to down vote, explain what is wrong. I'll fix my answer or delete it. – JRodd Aug 01 '17 at 04:02
  • I did not give code because the question was vague and they gave me nothing to fix but an idea. Now, I have placed code on the page which is subject to change because in this case, the link was a better source than the code. I will not be maintaining the post as Google Maps will be maintaining that developer link. And I try to help. – JRodd Aug 01 '17 at 04:11
  • Thanks for the idea.Sorry that the question was vague. – Satish Awal Aug 01 '17 at 06:42