1

Following is the code to draw boundaries on google map using collection of Lat and Lnt.

var map;

    var markersList = [
    new google.maps.LatLng(50.835866, 4.258575),
    new google.maps.LatLng(50.818083, 4.244499),
    new google.maps.LatLng(50.811358, 4.276428),
    new google.maps.LatLng(50.813094, 4.302177),
    new google.maps.LatLng(50.773162, 4.338226),
    new google.maps.LatLng(50.764259, 4.384918),
    new google.maps.LatLng(50.793132, 4.482422),
    new google.maps.LatLng(50.810274, 4.450836),
    new google.maps.LatLng(50.821120, 4.476585),
    new google.maps.LatLng(50.852342, 4.462852),
    new google.maps.LatLng(50.866861, 4.421310),
    new google.maps.LatLng(50.895021, 4.430580),
    new google.maps.LatLng(50.911692, 4.413757),
    new google.maps.LatLng(50.912342, 4.395561),
    new google.maps.LatLng(50.898486, 4.377708),
    new google.maps.LatLng(50.900868, 4.328957),
    new google.maps.LatLng(50.889174, 4.293251),
    new google.maps.LatLng(50.880294, 4.297028),
    new google.maps.LatLng(50.861878, 4.279175),
    new google.maps.LatLng(50.855593, 4.288788),
    new google.maps.LatLng(50.837817, 4.282608),
    new google.maps.LatLng(50.835866, 4.259605)
    ];

    $(document).ready(function () {
        var latlng = new google.maps.LatLng(50.834999, 4.387665);
        var myOptions = {
            zoom: 11,
            center: latlng,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

        var MarkerHightlight;

        //DRAW THE POLYGON OR POLYLINE
        MarkerHightlight = new google.maps.Polygon({
            paths: markersList,
            strokeColor: "#6666FF",
            strokeOpacity: 0.8,
            strokeWeight: 2,
            fillColor: "#6666FF",
            fillOpacity: 0.0
        });
        MarkerHightlight.setMap(map);

But, I want to draw boundary on google map using zip code (like boundary of mumbai). So, how to get the collection lat/lng for boundaries using zip code of area.

user3783446
  • 425
  • 5
  • 11
  • Hi there you can do this with Google Maps API and it's already answered here: http://stackoverflow.com/questions/5585957/get-latlng-from-zip-code-google-maps-api – scgough Apr 11 '15 at 08:09
  • this code gives the lat/lng value of single spot. i.e. if i am putting zip code of mumbai, then it gives us the lat/lng value of mumbai to show the position of mumbai on the map (it can not draw the boundary for mumbai over map). It is not giving collection of lat/lng for boundary of mumbai. – user3783446 Apr 11 '15 at 08:30

0 Answers0