Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Setting control layers #46

@arjenmeijer

Description

@arjenmeijer

I am trying to add tilelayers combined with the Markercluster plugin.
This is working and provided as documentation:
...
use dosamigos\leaflet\layers\TileLayer;
use dosamigos\leaflet\controls\Layers;
...
$center = new LatLng(['lat' => (float)$latitude, 'lng' => (float)$longitude]);

$openstreet = new TileLayer([
'urlTemplate' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
'clientOptions' => [
OpenStreetMap contributors'
]
]);

$arogis = new TileLayer([
'urlTemplate' => 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
'clientOptions' => [
OpenStreetMap contributors'
]
]);

$baseLayers = new Layers();
$baseLayers->setBaseLayers(['Card' => $openstreet, 'Photo' => $arogis]);

$leaflet = new LeafLet([
'tileLayer' => $openstreet,
'center' => $center,
'zoom'=> 13,
]);

$leaflet
->setControls([$baseLayers]);

Adding Markercluster works also.

$cluster = new MarkerCluster([
'url' => Url::to(['you rur lreturning json']),
]);
and changing $leaflet to:
$leaflet
->setControls([$baseLayers]);
$leaflet
->installPlugin($cluster);

Do to:
a. Setting grouplayers
b. Combining groupslayer control and MarkerCluster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions