Voilà le code HTML d'intégration correspondant à la carte interactive ci-dessus !
testnetworklink.html
<div data-owlappsmaplyrgroup = "yes">
<iframe style = "border:none;width:100%;min-height:550px;height:80%;" data-owlappsmap = "yes" >
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<open> 1 </open>
<visibility> 1 </visibility>
<NetworkLink>
<open> 1 </open>
<Snippet>
<![CDATA[
this is a first-level link and it has a refreshMode tag, so it has the "Unplug this network link" checkbox button, see below !
]]>
</Snippet>
<Link>
<href>
https://owlapps.000webhostapp.com/modules/owlapps_apps/embedmap/test_wfs.php
</href>
<refreshMode>
onChange
</refreshMode>
</Link>
<name>
My first first-level network link
</name>
<visibility>
1
</visibility>
</NetworkLink>
<NetworkLink>
<open> 0 </open>
<Snippet>
<![CDATA[
this is a first-level link and it has not refreshMode tag, so it has not the "Unplug this network link" checkbox button!
<br/>
Network link as a WMS geoservice because it delivers GroundOverlay tags.
]]>
</Snippet>
<Link>
<href>
https://owlapps.000webhostapp.com/modules/owlapps_apps/embedmap/test_wms.php
</href>
</Link>
<name>
My second first-level network link
</name>
<visibility>
1
</visibility>
</NetworkLink>
</Document>
</kml>
</iframe>
</div>
test_wms.php
<?php
header('Content-type: text/xml');
header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Connection: close");
header('Content-type: text/html; charset=UTF-8');
/* very important */
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
/*
Example of a PHP page code used as a WMS called by a given KML networklink
see at: https://developers.google.com/kml/documentation/kmlreference#networklink
*/
echo '<?xml version="1.0" encoding="ISO-8859-1"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<open>
1
</open>
<GroundOverlay>
<Snippet>
Satellite image on Sicilia island
</Snippet>
<description> __geolink__ </description>
<Icon>
<href> http://www.owlapps.net/modules/owlapps_apps/embedmap/img/etna.jpg </href>
</Icon>
<LatLonBox>
<north>37.91904192681665</north>
<south>37.46543388598137</south>
<east>15.35832653742206</east>
<west>14.60128369746704</west>
<rotation>-0.1556640799496235</rotation>
</LatLonBox>
<name>
Etna
</name>
</GroundOverlay>
</Document>
</kml>
';
?>
test_wfs.php
<?php
header('Content-type: text/xml');
header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Connection: close");
header('Content-type: text/html; charset=UTF-8');
/* very important */
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
/*
Example of a PHP page code used as a WFS called by a given KML networklink
see at: https://developers.google.com/kml/documentation/kmlreference#networklink
*/
$data = file_get_contents('php://input');
$b = json_decode($data);
$lon = ($b->{'BBOX'}[2] + $b->{'BBOX'}[0])/ 2; //longitude
$lat = ( $b->{'BBOX'}[1] + $b->{'BBOX'}[3] )/ 2; //latitude
sleep(1);
echo '<?xml version="1.0" encoding="ISO-8859-1"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<open> 1</open>
<Style id="myico">
<IconStyle id="myicon">
<scale>2</scale>
<Icon>
<href>http://www.owlapps.net/modules/owlapps_apps/embedmap/img/orangepin.png</href>
</Icon>
</IconStyle>
</Style>
<Folder>
<open>
1
</open>
<name>
Tutorial ' . rand(5, 150000) .
'</name>
<Placemark>
<name> polygon whose color varies with each refresh </name>
<Style>
<LabelStyle>
<minZoom>
19
</minZoom>
</LabelStyle>
<PolyStyle>
<fill> 0 </fill>
<outline> 0 </outline>
<richDecos>
<inner>
<colorize>
<color>
rgb(' . rand(0, 255) . ',' . rand(0, 255) . ',' . rand(0, 255) . ')
</color>
</colorize>
</inner>
</richDecos>
</PolyStyle>
</Style>
<Polygon>
<outerBoundaryIs>
<LinearRing>
<coordinates>
5.075540874379179,47.25902566581779,0 5.075739785686084,47.25899496298661,0 5.075757936424637,47.25908035000109,0 5.075577503345499,47.25911881544968,0 5.075540874379179,47.25902566581779,0
</coordinates>
</LinearRing>
</outerBoundaryIs>
</Polygon>
</Placemark>
<Placemark>
<Snippet>
This point is positioned in the center of the map each time you move on this same map!
</Snippet>
<styleUrl>
#myico
</styleUrl>
<name>
Wandering point ' . rand(5, 150000).
'</name>
<description>
<![CDATA[
<div style="overflow:auto;width:100%;height:100%;max-height:150px;" > $[name] Here is my description, this feature is generated dynamically by a php page used as a <a href="https://fr.wikipedia.org/wiki/Web_Feature_Service" >WFS</a> delivering <a href="https://developers.google.com/kml/documentation/kml_tut" target="_blank" >KML data</a>, <br/>
it receives by <a target="_blank" href="https://en.wikipedia.org/wiki/POST_(HTTP)" >POST method</a> a stringified json data: the coordinates (WGS84 Decimal degrees) of the bounding box of the current map view ( <strong>{BBOX:[longitude_west, latitude_south, longitude_east, latitude_north]}</strong> ) when the PHP page requested.
<br/>
BBOX received: [' . $b->{'BBOX'}[0] . ', ' . $b->{'BBOX'}[1] . ', ' . $b->{'BBOX'}[2] . ', ' . $b->{'BBOX'}[3] . '].<br/>
Have a look at: <a href="http://www.owlapps.net/modules/owlapps_apps/embedmap/" target="_blank" > OWLAPPS EMBEDMAP</a>
]]>
</description>
<Point>
<coordinates>' . $lon . ',' . $lat .
'</coordinates>
</Point>
</Placemark>
</Folder>
<NetworkLink>
<open>
1
</open>
<Link>
<href>
<![CDATA[
https://owlapps.000webhostapp.com/modules/owlapps_apps/embedmap/test_wfs.php
]]>
</href>
</Link>
<name>
Nested network link
</name>
<Snippet>
<![CDATA[
This nested link is the first-level link calling itself in fact !
<br/>
We are facing an infinite loop of death but fortunately this app has a safeguard limiting the number of consecutive link calls!
]]>
</Snippet>
<visibility>
1
</visibility>
</NetworkLink>
</Document>
</kml>
';
?>