banner



How To Make Googlemap Animated Polygon In Javascript

  • Satyaprakash Samantaray
  • Updated date May 17, 2017
  • 13.iiig
  • 1

Google Maps - Polygon With Animated Marker Using Bootstrap In ASP.NET MVC.

Introduction

A polygon consists of a series of coordinates in an ordered sequence. All the same, polygons are designed to define place coordinates within a closed loop. Polygons are fabricated of straight lines.

Follow my Google Maps part ane- 5 blogs earlier you lot go through to part half dozen.

Description

A polygon supports the post-obit properties.

  1. path - specifies several LatLng coordinates for the line.
  2. strokeColor - specifies a hexadecimal color for the line.
  3. strokeOpacity - specifies the opacity of the line.
  4. strokeWeight - specifies the weight of the line'south stroke in pixels.
  5. fillColor - specifies a hexadecimal color for the surface area within the enclosed region.
  6. fillOpacity - specifies the opacity of the fill color.
  7. editable - defines whether the line is editable by users.
Steps

Create a Controller class file.

  1. using  Arrangement;
  2. using  System.Collections.Generic;
  3. using  System.Linq;
  4. using  System.Spider web;
  5. using  Organisation.Spider web.Mvc;
  6. namespace  SatyaGoogleMapBootstrapMVC.Controllers
  7. {
  8. public course  HomeController : Controller
  9.     {
  10. public  ActionResult Alphabetize()
  11.         {
  12. render  View();
  13.         }
  14. public  ActionResult Details()
  15.         {
  16. render  View();
  17.         }
  18. public  ActionResult Animate()
  19.         {
  20. return  View();
  21.         }
  22. public  ActionResult Icon()
  23.         {
  24. return  View();
  25.         }
  26.     }
  27. }

 Create a View file named "Icon.cshtml".

  1. @{
  2.     ViewBag.Title ="Satyaprakash Google Map Polygon" ;
  3. }
  4. <title>@ViewBag.Title</title>
  5. <h2 style="background-color: Yellow;color: Blue; text-marshal: eye; font-fashion: oblique" >Satyaprakash's Google Map Polygon Using MVC and BOOTSTRAP</h2>
  6. <fieldset>
  7.     <fable way="font-family: Arial Black; color: blue; font-size: big;" >Check Surface area Occupied By iii Cities Using Google Map Polygon</fable>
  8.     <meta charset="utf-viii" >
  9.     <meta proper name="viewport"  content= "width=device-width, initial-calibration=1" >
  10.     <link rel="stylesheet"  href= "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
  11.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js" ></script>
  12.     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" ></script>
  13.     <div id="map"  style= "width:100%;tiptop:500px" ></div>
  14.     <script>
  15. office  myMap() {
  16. var  Bhubaneswar = new  google.maps.LatLng(twenty.296100, 85.824500);
  17. var  Hyderabad = new  google.maps.LatLng(17.3850, 78.4867);
  18. var  Bangalore = new  google.maps.LatLng(12.9716, 77.5946);
  19. var  mapCanvas = document.getElementById( "map" );
  20. var  mapOptions = { center: Hyderabad, zoom: 6 };
  21. var  map = new  google.maps.Map(mapCanvas, mapOptions);
  22. var  flightPath = new  google.maps.Polygon({
  23.                 path: [Bhubaneswar, Hyderabad, Bangalore],
  24.                 strokeColor:"Dark-green" ,
  25.                 strokeOpacity: 0.8,
  26.                 strokeWeight: two,
  27.                 fillColor:"Yellowish" ,
  28.                 fillOpacity: 0.4
  29.             });
  30. var  marker1 = new  google.maps.Marker({
  31.                 position: Bhubaneswar,
  32.                 animation: google.maps.Animation.Bounce
  33.             });
  34. var  marker2 = new  google.maps.Marker({
  35.                 position: Hyderabad,
  36.                 animation: google.maps.Animation.BOUNCE
  37.             });
  38. var  marker3 = new  google.maps.Marker({
  39.                 position: Bangalore,
  40.                 blitheness: google.maps.Animation.BOUNCE
  41.             });
  42.             flightPath.setMap(map);
  43.             marker1.setMap(map);
  44.             marker2.setMap(map);
  45.             marker3.setMap(map);
  46.         }
  47.     </script>
  48.     <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCkVZYQFe4YYva_g5ulymGDt9EBoVjjZJ8&callback=myMap" ></script>
  49. </fieldset>
  50. <footer>
  51.     <p style="background-color: Yellow; font-weight: bold; color:blue; text-align: eye; font-way: oblique" >© @DateTime.Now.ToLocalTime()</p> @*Add Date Time*@
  52. </footer>

 Here, I have mentioned iii cities with their proper longitude and latitude details.

  1. var  Bhubaneswar = new  google.maps.LatLng(20.296100, 85.824500);
  2. var  Hyderabad = new  google.maps.LatLng(17.3850, 78.4867);
  3. var  Bangalore = new  google.maps.LatLng(12.9716, 77.5946);

Then, I mentioned the polygon border colour and fill up colour followed by opacity.

  1. var  flightPath = new  google.maps.Polygon({
  2.                 path: [Bhubaneswar, Hyderabad, Bangalore],
  3.                 strokeColor:"Green" ,
  4.                 strokeOpacity: 0.eight,
  5.                 strokeWeight: 2,
  6.                 fillColor:"Xanthous" ,
  7.                 fillOpacity: 0.4
  8.             });

Finally, I put the animated mark for 3 different cities with polygon.

  1. var  marker1 = new  google.maps.Marking({
  2.                 position: Bhubaneswar,
  3.                 animation: google.maps.Animation.Bounce
  4.             });
  5. var  marker2 = new  google.maps.Marker({
  6.                 position: Hyderabad,
  7.                 animation: google.maps.Animation.Bounciness
  8.             });
  9. var  marker3 = new  google.maps.Marking({
  10.                 position: Bangalore,
  11.                 animation: google.maps.Animation.Bounce
  12.             });

OUTPUT

Desktop View
(with Satelite and Map View)

Mobile View (with Satelite and Map View)

Summary

In this web log, we learned the following.

  1. What is Google Maps Polygon.
  2. How to implement information technology in MVC and Bootstrap.
  3. Purpose behind Google Maps Polygon.
  4. Using animated mark with Google Maps Polygon.

Source: https://www.c-sharpcorner.com/blogs/google-map-polygon-with-animated-marker-using-bootstrap-in-asp-net-mvc-part6

Posted by: seayiling1998.blogspot.com

0 Response to "How To Make Googlemap Animated Polygon In Javascript"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel