The Google Maps API supports the KML and GeoRSS data formats for displaying geographic information. For more information, read the official documentation.
First of all, if you want to render a kml layer, you will need to build one. So let's go:
use Ivory\GoogleMap\Layer\KmlLayer;
$kmlLayer = new KmlLayer('http://www.domain.com/kml_layer.kml');
The kml layer constructor requires an url as first argument. It also accepts additional parameters such as options (default empty):
use Ivory\GoogleMap\Layer\KmlLayer;
$kmlLayer = new KmlLayer(
'http://www.domain.com/kml_layer.kml',
['suppressInfoWindows' => true]
);
A variable is automatically generated when creating a kml layer but if you want to update it, you can use:
$kmlLayer->setVariable('kml_layer');
If you want to update the kml layer url, you can use:
$kmlLayer->setUrl('http://www.domain.com/kml_layer.kml');
The kml layer options allows you to configure additional kml layer aspects. See the list of available options in the official documentation. Then, to configure them, you can use:
$kmlLayer->setOption('suppressInfoWindows', true);
After building your kml layer, you need to add it to a map with:
$map->getLayerManager()->addKmlLayer($kmlLayer);