mercredi 9 février 2022

How can get polygon from database and show draw on map by using laravel language؟

This is store in database as string parameter polygon [{"long":44.2102114567917,"lat":15.369831802551733},{"long":44.2102114567917,"lat":15.369831802551733},{"long":44.2102114567917,"lat":15.369831802551733},{"long":44.2102114567917,"lat":15.369831802551733}]

      // and this my code  to do polygon




  <script>

function initMap() {
  const map = new google.maps.Map(document.getElementById("map"), {
    zoom: 13,
    center: {lat: 40.7484404, lng: -73.9878441 },
    
  });
  const poly = new google.maps.Polygon({
    strokeColor: "#000000",
    strokeOpacity: 1,
    strokeWeight: 3,
    map: map,
  });

 
                
  var x =[
    { "lat": 15.362825469475341, "lng": 44.212589263916016 },
    { "lat": 15.359997572657216, "lng": 44.2021433720749 },
    { "lat": 15.354369485881188, "lng": 44.20334500171357 },
    { "lat": 15.351238223587876, "lng": 44.215850830078125 },

    ];
  


  const flightPath = new google.maps.Polygon({
    path: x,
    geodesic: true,
    strokeColor: "#00008b",
    strokeOpacity: 1.0,
    strokeWeight: 2,
  });
  
 
 
  flightPath.setMap(map);  
 
}
</script>

my problem is how I can put that polygon from database instead of value for var x (to get latLng from db) and I am using Laravel languge



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire