Trying to add a polygon to my map below is my code
$center = new \dosamigos\leaflet\types\LatLng(['lat' => 37.7900,
'lng' => -122.401]);
$polygon = new dosamigos\leaflet\layers\Polygon(
[
'name' => 'poly',
//'map' => 'map',
'clientOptions' => [
'color' => 'red'
]
]);
$polygon->setLatLngs([
new \dosamigos\leaflet\types\LatLng(['lat' => 37.786617, 'lng' => -122.404654]),
new \dosamigos\leaflet\types\LatLng(['lat' => 37.797843, 'lng' => -122.407057]),
new \dosamigos\leaflet\types\LatLng(['lat' => 37.798962, 'lng' => -122.398260]),
new \dosamigos\leaflet\types\LatLng(['lat' => 37.794299, 'lng' => -122.395234]),
]);
$leaflet->addLayer($marker) // add the marker
->addLayer($tileLayer)
->addLayer($polygon); // add the tile layer
echo $leaflet->widget(['options' => ['style' => 'min-height: 500px']]);
if i add a polygon to the leaflet, map is not showing but when i remove the polygon and just leave a marker the map is showing.
Can someone assist with a working example of adding a polygon to the map using this extension.
Trying to add a polygon to my map below is my code
if i add a polygon to the leaflet, map is not showing but when i remove the polygon and just leave a marker the map is showing. Can someone assist with a working example of adding a polygon to the map using this extension.