📜 ⬆️ ⬇️

Using PHP and MySQL to create KML

Gag


Cross-post of the fourth translation of tutorials on the Google Maps API from my blog .

This tutorial is intended for developers who are familiar with PHP and MySQL and want to learn how to generate a KML file using data from a MySQL database. In this tutorial, you will create two scripts that dynamically create a KML file containing data about the establishments of Seattle. The first script creates a set of coordinates and determines the type of institution - a bar or restaurant - and marks them on the map. When the user clicks on the marker, an info-window will appear containing the name and address of the establishment. The task of the second script is to connect all the restaurants with a solid line. Also in this tutorial you will learn how you can display the generated KML file using Google Earth.
This lesson is based on the article “Using a bunch of PHP and MySQL with Google Maps” written by Pamela Fox and showing how to export data from a database table to Google Maps using PHP. You can skip the first two steps of this tutorial if you have already read Pamela's article. The remaining steps are quite different from what was described in the above article - we, nevertheless, will deal with KML.
The lesson is divided into the following parts:picture

Step 1: Create a table


Note: in this lesson, places are used whose latitude and longitude values ​​are already known and are used to draw markers on the map. If you try to use your information without having data on the coordinates of a place, then use the geocoding service to convert the address of the place to its coordinates. Here is a list of some geocoding services: http://groups.google.com/group/Google-Maps-API/web/resources-non-google-geocoders .
If you prefer to create tables in the database using phpMyAdmin, then below is a screenshot of the table creation:
picture
If you do not have access to phpMyAdmin or give preference to pure SQL, the SQL query code is shown below:
CREATE TABLE `markers` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR (60) NOT NULL ,
`address` VARCHAR (80) NOT NULL ,
`lat` FLOAT (10, 6) NOT NULL ,
`lng` FLOAT (10, 6) NOT NULL ,
`type` VARCHAR (30) NOT NULL
) ENGINE = MYISAM;

Step 2: Filling the table


After creating the table, it's time to fill it with information. Data on 10 places in Seattle are shown below. In phpMyAdmin, you can use the IMPORT option to insert data stored in various formats into the table, including CSV. MS Excel and Google Spreadsheets applications support exporting data to CSV format. So you can easily transfer data from these applications to the MySQL database using the export / import options.
Here is the information provided in CSV format:
Pan Africa Market, "1521 1st Ave, Seattle, WA", 47.608941, -122.340145, restaurant
Buddha Thai & Bar, "2222 2nd Ave, Seattle, WA", 47.613591, -122.344394, bar
The Melting Pot, "14 Mercer St, Seattle, WA", 47.624562, -122.356442, restaurant
Ipanema Grill, "1225 1st Ave, Seattle, WA", 47.606366, -122.337656, restaurant
Sake House, "2230 1st Ave, Seattle, WA", 47.612825, -122.34567, bar
Crab Pot, "1301 Alaskan Way, Seattle, WA", 47.605961, -122.34036, restaurant
Mama's Mexican Kitchen, "2234 2nd Ave, Seattle, WA", 47.613975, -122.345467, bar
Wingdome, "1416 E Olive Way, Seattle, WA", 47.617215, -122.326584, bar
Piroshky Piroshky, "1908 Pike pl, Seattle, WA", 47.610127, -122.342838, restaurant

And here is a screenshot showing the import of data from CSV to the database table:
picture
If you do not use phpMyAdmin, then below is the query code to the database in SQL language:
INSERT INTO `markers` (` name`, `address`,` lat`, `lng`,` type`) VALUES ( 'Pan Africa Market' , '1521 1st Ave, Seattle, WA' , '47 .608941 ' , ' - 122.340145 ' , ' restaurant ' );
INSERT INTO `markers` (` name`, `address`,` lat`, `lng`,` type`) VALUES ( 'Buddha Thai & Bar' , '2222 2nd Ave, Seattle, WA' , '47 .613591 ' , ' -122.344394 ' , ' bar ' );
INSERT INTO `markers` (` name`, `address`,` lat`, `lng`,` type`) VALUES ( 'The Melting Pot' , '14 Mercer St, Seattle, WA ' , '47 .624562' , '- 122.356442 ' , ' restaurant ' );
INSERT INTO `markers` (` name`, `address`,` lat`, `lng`,` type`) VALUES ( 'Ipanema Grill' , '1225 1st Ave, Seattle, WA' , '47 .606366 ' , ' -122.337656 ' , ' restaurant ' );
INSERT INTO `markers` (` name`, `address`,` lat`, `lng`,` type`) VALUES ( 'Sake House' , '2230 1st Ave, Seattle, WA' , '47 .612825 ' , ' -122.34567 ' , ' bar ' );
INSERT INTO `markers` (` name`, `address`,` lat`, `lng`,` type`) VALUES ( 'Crab Pot' , '1301 Alaskan Way, Seattle, WA' , '47 .605961 ' , ' -122.34036 ' , ' restaurant ' );
INSERT INTO `markers` (` name`, `address`,` lat`, `lng`,` type`) VALUES ( 'Mama Mexican Kitchen' , '2234 2nd Ave, Seattle, WA' , '47. 613975 ' , ' - 122.345467 ' , ' bar ' );
INSERT INTO `markers` (` name`, `address`,` lat`, `lng`,` type`) VALUES ( 'Wingdome' , '1416 E Olive Way, Seattle, WA' , '47 .617215 ' , ' -122.326584 ' , ' bar ' );
INSERT INTO `markers` (` name`, `address`,` lat`, `lng`,` type`) VALUES ( 'Piroshky Piroshky' , '1908 Pike pl, Seattle, WA' , '47 .610127 ' , ' -122.342838 ' , ' restaurant ' );

Step 3: Display information in KML using PHP


At this point, you should have a database table (called markers) filled with data. Now you need to write some PHP code that allows you to connect to the database, take the necessary information from it and export it to a KML file. If you have never written to PHP code that allows you to connect to the database, then you need to visit the site php.net and read about the functions mysql_connect() , mysql_select_db() , my_sql_query() , and mysql_error() .
Now you need to transfer information about connecting to the database in a separate file. Below is the PHP code in which you must enter your own username, password and database name:
<?
$username="username";
$password="password";
$database="username-databaseName";
?>

Using PHP5 DOM functions to generate a KML file
That's just from this point and go new material. In a previous article, Pamela introduced you to PHP4 code, which used the dom_xml extension to create a simple file with markers, which was subsequently processed using JavaScript. In this tutorial you need to get a KML file. Instead of parsing KML with JavaScript, we will immediately build this file with Placemark-specific tags. Further, both methods of generating a KML file will be shown: using the built-in DOM functionality in PHP5 and using the dom_xml extension in PHP4.
First, check if the DOMDocument() works on your PHP server. If the DOM functionality is disabled, you can try to create an XML file, as described in the Pamela article. Or use the KML creation methods shown below.
If you do decide to use DOM functions, then we will start creating markers for each row from the database table. First, you need to initialize a new XML document and create the parent node “kml” in it. Add the KML namespace to it as an attribute. After creating the base KML <document> , you must create two styles - one for restaurants, the other for bars - which will later represent the markers through the <styleURL> .
Next, we connect to the database and execute a SELECT * query (select all) to the table with markers and go through all the results of this sample. For each row in the table, create a <Placemark> element. The information extracted from the database is used to create child elements for <Placemark> such as <name> , <description> , <styleURL> , <Point> . The value written in the <styleURL> will depend on the value of the type entry. Then add the <Placemark> child element to <Placemark> , and as the value of this element, we write down the coordinates of the institution contained in the lat and lng fields.
The following PHP creates a KML file with the corresponding HTML header. After generating the KML file, you should check this file for errors.
<?php
require('phpsqlajax_dbinfo.php');

// MySQL-.

$connection = mysql_connect ($server, $username, $password);

if (!$connection)
{
die(' : ' . mysql_error());
}
// .
$db_selected = mysql_select_db($database, $connection);

if (!$db_selected)
{
die(' : ' . mysql_error());
}

// markers.
$query = 'SELECT * FROM markers WHERE 1';
$result = mysql_query($query);

if (!$result)
{
die(' : ' . mysql_error());
}

// .
$dom = new DOMDocument('1.0', 'UTF-8');

// KML .
$node = $dom->createElementNS('http://earth.google.com/kml/2.1', 'kml');
$parNode = $dom->appendChild($node);

// Document KML.
$dnode = $dom->createElement('Document');
$docNode = $parNode->appendChild($dnode);

// : , . KML.
$restStyleNode = $dom->createElement('Style');
$restStyleNode->setAttribute('id', 'restaurantStyle');
$restIconstyleNode = $dom->createElement('IconStyle');
$restIconstyleNode->setAttribute('id', 'restaurantIcon');
$restIconNode = $dom->createElement('Icon');
$restHref = $dom->createElement('href', 'http://maps.google.com/mapfiles/kml/pal2/icon63.png');
$restIconNode->appendChild($restHref);
$restIconstyleNode->appendChild($restIconNode);
$restStyleNode->appendChild($restIconstyleNode);
$docNode->appendChild($restStyleNode);

$barStyleNode = $dom->createElement('Style');
$barStyleNode->setAttribute('id', 'barStyle');
$barIconstyleNode = $dom->createElement('IconStyle');
$barIconstyleNode->setAttribute('id', 'barIcon');
$barIconNode = $dom->createElement('Icon');
$barHref = $dom->createElement('href', 'http://maps.google.com/mapfiles/kml/pal2/icon27.png');
$barIconNode->appendChild($barHref);
$barIconstyleNode->appendChild($barIconNode);
$barStyleNode->appendChild($barIconstyleNode);
$docNode->appendChild($barStyleNode);

// Placemark.
while ($row = @mysql_fetch_assoc($result))
{
// Placemark Document.

$node = $dom->createElement('Placemark');
$placeNode = $docNode->appendChild($node);

// id.
$placeNode->setAttribute('id', 'placemark' . $row['id']);

// name description .
$nameNode = $dom->createElement('name',htmlentities($row['name']));
$placeNode->appendChild($nameNode);
$descNode = $dom->createElement('description', $row['address']);
$placeNode->appendChild($descNode);
$styleUrl = $dom->createElement('styleUrl', '#' . $row['type'] . 'Style');
$placeNode->appendChild($styleUrl);

// Point.
$pointNode = $dom->createElement('Point');
$placeNode->appendChild($pointNode);

// coordinates.
$coorStr = $row['lng'] . ',' . $row['lat'];
$coorNode = $dom->createElement('coordinates', $coorStr);
$pointNode->appendChild($coorNode);
}

$kmlOutput = $dom->saveXML();
header('Content-type: application/vnd.google-earth.kml+xml');
echo $kmlOutput;
?>

Using the PHP4 dom_xml extension
PHP4 code using the dom_xml extension is very similar to the code written above:
<?php
require('phpsqlajax_dbinfo.php');

// MySQL-.
$connection=mysql_connect ($server, $username, $password);
if (!$connection)
{
die(' : ' . mysql_error());
}
// .
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected)
{
die (' : ' . mysql_error());
}

// markers.
$query = 'SELECT * FROM markers WHERE 1';
$result = mysql_query($query);
if (!$result)
{
die(' : ' . mysql_error());
}

// .
$dom = new domxml_new_doc('1.0');

// KML .
$node = $dom->create_element_ns('http://earth.google.com/kml/2.1', 'kml');
$parNode = $dom->append_child($node);

// Document KML.
$dnode = $dom->create_element('Document');
$docNode = $parNode->append_child($dnode);

// : - , - .
$restStyleNode = $dom->create_element('Style');
$restStyleNode->set_attribute('id', 'restaurantStyle');
$restIconstyleNode = $dom->create_element('IconStyle');
$restIconstyleNode->set_attribute('id', 'restaurantIcon');
$restIconNode = $dom->create_element('Icon');
$restHref = $dom->create_element('href', 'http://maps.google.com/mapfiles/kml/pal2/icon63.png');
$restIconNode->append_child($restHref);
$restIconstyleNode->append_child($restIconNode);
$restStyleNode->append_child($restIconstyleNode);
$docNode->append_child($restStyleNode);
$barStyleNode = $dom->create_element('Style');
$barStyleNode->set_attribute('id', 'barStyle');
$barIconstyleNode = $dom->create_element('IconStyle');
$barIconstyleNode->set_attribute('id', 'barIcon');
$barIconNode = $dom->create_element('Icon');
$barHref = $dom->create_element('href', 'http://maps.google.com/mapfiles/kml/pal2/icon27.png');
$barIconNode->append_child($barHref);
$barIconstyleNode->append_child($barIconNode);
$barStyleNode->append_child($barIconstyleNode);
$docNode->append_child($barStyleNode);

// Placemark.
while ($row = @mysql_fetch_assoc($result))
{
// Placemark Document.
$node = $dom->create_element('Placemark');
$placeNode = $docNode->append_child($node);
// id.
$placeNode->set_attribute('id', 'placemark' . $row['id']);

// name description .
$nameNode = $dom->create_element('name',htmlentities($row['name']));
$placeNode->append_child($nameNode);
$descNode = $dom-> create_element('description', $row['address']);
$placeNode->append_child($descNode);
$styleUrl = $dom->create_element('styleUrl', '#' . $row['type'] . 'Style');
$placeNode->append_child($styleUrl);
// Point.
$pointNode = $dom->create_element('Point');
$placeNode->append_child($pointNode);

// coordinates.
$coorStr = $row['lng'] . ',' . $row['lat'];
$coorNode = $dom->create_element('coordinates', $coorStr);
$pointNode->append_child($coorNode);
}

$kmlOutput = $dom->dump_mem(TRUE, 'UTF-8');
header('Content-type: application/vnd.google-earth.kml+xml');
echo $kmlOutput;
?>

As you can see, all the difference lies only in the name of the function responsible for creating the XML element ( createElement ). In PHP4, this name is written in lower case with the “_” character necessary to separate the words in the function name.
The exception is the name of the function that initializes the new document: in PHP5 it is called DOMDocument , and in PHP4 it is domxml_new_doc .
Using the PHP echo function to output KML
If you do not have access to the PHP DOM functionality, you can use the echo function to display information in a KML form.
  1. Connect to the database and execute a SELECT * query to the table with markers;
  2. Create a string array, the elements of which will contain the basic structure of a KML document;
  3. Pass through the results of sampling data from the database and add them to the array;
  4. For each entry in the table, we create a <Placemark> element and pass it the values ​​of the name of the institution and its address through the htmlentities function to exclude the entry of special characters;
  5. We join all the elements of the array in one line, attach the header to the file and print the string we received.
The code of the corresponding script:
<?php
require('phpsqlajax_dbinfo.php');

// MySQL-.
$connection = mysql_connect ($server, $username, $password);
if (!$connection)
{
die(' : ' . mysql_error());
}

// .
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected)
{
die (' : ' . mysql_error());
}

// markers.
$query = 'SELECT * FROM markers WHERE 1';
$result = mysql_query($query);
if (!$result)
{
die(' : ' . mysql_error());
}

// .
$kml = array('<? xml version="1.0" encoding="UTF-8"?>');
$kml[] = '<kml xmlns="http://earth.google.com/kml/2.1">';
$kml[] = ' <Document>';
$kml[] = ' <Style id="restaurantStyle">';
$kml[] = ' <IconStyle id="restuarantIcon">';
$kml[] = ' <Icon>';
$kml[] = ' <href>http://maps.google.com/mapfiles/kml/pal2/icon63.png</href>';
$kml[] = ' </Icon>';
$kml[] = ' </IconStyle>';
$kml[] = ' </Style>';
$kml[] = ' <Style id="barStyle">';
$kml[] = ' <IconStyle id="barIcon">';
$kml[] = ' <Icon>';
$kml[] = ' <href>http://maps.google.com/mapfiles/kml/pal2/icon27.png</href>';
$kml[] = ' </Icon>';
$kml[] = ' </IconStyle>';
$kml[] = ' </Style>';

// .
while ($row = @mysql_fetch_assoc($result))
{
$kml[] = ' <Placemark id="placemark' . $row['id'] . '">';
$kml[] = ' <name>' . htmlentities($row['name']) . '</name>';
$kml[] = ' <description>' . htmlentities($row['address']) . '</description>';
$kml[] = ' <styleUrl>#' . ($row['type']) .'Style</styleUrl>';
$kml[] = ' <Point>';
$kml[] = ' <coordinates>' . $row['lng'] . ',' . $row['lat'] . '</coordinates>';
$kml[] = ' </Point>';
$kml[] = ' </Placemark>';

}

// XML-
$kml[] = ' </Document>';
$kml[] = '</kml>';
$kmlOutput = join("\n", $kml);
header('Content-type: application/vnd.google-earth.kml+xml');
echo $kmlOutput;
?>

We check the correctness of the received KML file.
Call our script and check the correctness of displaying KML in the browser. If everything is alright, then you should see something like this:
<? xml version = "1.0" encoding = "UTF-8" ? >
< kml xmlns = "http://earth.google.com/kml/2.1" >
< Document >
< Style id = "restaurantStyle" >
< IconStyle id = "restuarantIcon" >
< Icon >
< href > http://maps.google.com/mapfiles/kml/pal2/icon63.png </ href >
</ Icon >
</ IconStyle >
</ Style >
< Style id = "barStyle" >
< IconStyle id = "barIcon" >
< Icon >
< href > http://maps.google.com/mapfiles/kml/pal2/icon27.png </ href >
</ Icon >
</ IconStyle >
</ Style >
< Placemark id = "placemark1" >
Pan Africa Market </ name >
< description > 1521 1st Ave, Seattle, WA </ description >
< styleUrl > #restaurantStyle </ styleUrl >
< Point >
< coordinates > -122.340141,47.608940 </ coordinates >
</ Point >
</ Placemark >
< Placemark id = "placemark2" >
< name > Buddha Thai & Bar </ name >
< description > 2222 2nd Ave, Seattle, WA </ description >
< styleUrl > #barStyle </ styleUrl >
< Point >
< coordinates > -122.344391,47.613590 </ coordinates >
</ Point >
</ Placemark >
< Placemark id = "placemark3" >
< name > The Melting Pot </ name >
< description > 14 Mercer St, Seattle, WA </ description >
< styleUrl > #restaurantStyle </ styleUrl >
< Point >
< coordinates > -122.356445,47.624561 </ coordinates >
</ Point >
</ Placemark >
< Placemark id = "placemark4" >
< name > Ipanema Grill </ name >
< description > 1225 1st Ave, Seattle, WA </ description >
< styleUrl > #restaurantStyle </ styleUrl >
< Point >
< coordinates > -122.337654,47.606365 </ coordinates >
</ Point >
</ Placemark >
< Placemark id = "placemark5" >
< name > Sake House </ name >
< description > 2230 1st Ave, Seattle, WA </ description >
< styleUrl > #barStyle </ styleUrl >
< Point >
< coordinates > -122.345673,47.612823 </ coordinates >
</ Point >
</ Placemark >
< Placemark id = "placemark6" >
< name > Crab Pot </ name >
< description > 1301 Alaskan Way, Seattle, WA </ description >
< styleUrl > #restaurantStyle </ styleUrl >
< Point >
< coordinates > -122.340363,47.605961 </ coordinates >
</ Point >
</ Placemark >
< Placemark id = "placemark7" >
< name > Mama's Mexican Kitchen </ name >
< description > 2234 2nd Ave, Seattle, WA </ description >
< styleUrl > #barStyle </ styleUrl >
< Point >
< coordinates > -122.345467,47.613976 </ coordinates >
</ Point >
</ Placemark >
< Placemark id = "placemark8" >
< name > Wingdome </ name >
< description > 1416 E Olive Way, Seattle, WA </ description >
< styleUrl > #barStyle </ styleUrl >
< Point >
< coordinates > -122.326584,47.617214 </ coordinates >
</ Point >
</ Placemark >
< Placemark id = "placemark9" >
< name > Piroshky Piroshky </ name >
< description > 1908 Pike pl, Seattle, WA </ description >
< styleUrl > #restaurantStyle </ styleUrl >
< Point >
< coordinates > -122.342834,47.610126 </ coordinates >
</ Point >
</ Placemark >
</ Document >
</ kml >

Create a line
One of the remarkable features of the database is the ability to combine the information contained in them. For example, having the data on the coordinates, you can easily make the necessary sequence of them - a line. Let's write a script that creates the structure of a single <Placemark> element. <linestring> inside <Placemark> . Then we will perform a query to the database and sample the coordinates by the id field.
This is the PHP code that creates a line connecting all the restaurants:
<?php
require('phpsqlajax_dbinfo.php');

// MySQL-
$connection = mysql_connect ($server, $username, $password);

if (!$connection)
{
die(' : ' . mysql_error());
}

//
$db_selected = mysql_select_db($database, $connection);

if (!$db_selected)
{
die (' : ' . mysql_error());
}

// markers

$query = " SELECT GROUP_CONCAT(lng, ',', lat, ',', '100' separator ' ') AS coordinates FROM markers WHERE type = 'restaurant';";

$result = mysql_query($query);
if (!$result)
{
die(' : ' . mysql_error());
}

// KML-,
$dom = new DOMDocument('1.0','UTF-8');
// KML Document
$node = $dom->createElementNS('http://earth.google.com/kml/2.1','kml');
$parNode = $dom->appendChild($node);

// Folder
$fnode = $dom->createElement('Folder');
$folderNode = $parNode->appendChild($fnode);

//
$row = @mysql_fetch_assoc($result);

// Placemark
$node = $dom->createElement('Placemark');
$placeNode = $folderNode->appendChild($node);

// id
$placeNode->setAttribute('id','linestring1');

// name, description adress
$nameNode = $dom->createElement('name','My path');
$placeNode->appendChild($nameNode);
$descNode= $dom->createElement('description', 'This is the path that I took through my favorite restaurants in Seattle');
$placeNode->appendChild($descNode);

// LineString
$lineNode = $dom->createElement('LineString');
$placeNode->appendChild($lineNode);
$exnode = $dom->createElement('extrude', '1');
$lineNode->appendChild($exnode);
$almodenode =$dom->createElement(altitudeMode,'relativeToGround');
$lineNode->appendChild($almodenode);

// coordinates
$coorNode = $dom->createElement('coordinates',$row['coordinates']);
$lineNode->appendChild($coorNode);
$kmlOutput = $dom->saveXML();

// KML
header('Content-type: application/vnd.google-earth.kml+xml');
echo $kmlOutput;
?>

You should get something like this:
<? xml version = '1.0' encoding = 'UTF-8' ? >
< kml xmlns = 'http: //earth.google.com/kml/2.1' >
< Folder >
< Placemark id = 'linestring1' >
< path > my path </ name >
< description >
< LineString >
< extrude > 1 </ extrude >
< altitudeMode > relativeToGround </ altitudeMode >
< coordinates > -122.340141,47.608940,100 -122.356445,47.624561,100
-122.337654,47.606365,100 -122.340363,47.605961,100
-122.342834,47.610126,100
</ coordinates >
</ LineString >
</ Placemark >
</ Folder >
</ kml >

Step 4: Display the KML file


Mapping to Google Earth
You can easily and simply display this data in Google Earth. The easiest way is to create a NetworkLink file pointing to the script. If you frequently update the information, you can set the update time. Here is an example of a file that will work as it should:
<? xml version = '1.0' encoding = 'UTF-8' ? >
< kml xmlns = 'http://earth.google.com/kml/2.1' >
< Folder >
< NetworkLink >
< Link >
< href > http://example.com/phpsql_genkml.kml </ href >
< refreshMode > onInterval </ refreshMode >
< refreshInterval > 3600 </ refreshInterval >
</ Link >
</ Networklink >
< NetworkLink >
< Link >
< href > http://example.com/phpsql_genkml_ls.kml </ href >
< refreshMode > onInterval </ refreshMode >
< refreshInterval > 3600 </ refreshInterval >
</ Link >
</ Networklink >
</ Folder >
</ kml >

The <href> element is responsible for locating the KML file on the server.
picture
To display this file in Google Maps, you need to add a link to this script or to the NetworkLink file. For example:
function load ()
{
var map;
var geoXml;

if (GBrowserIsCompatible ())
{
map = new GMap2 ( document .getElementById ( 'map' ));
map.addControl ( new GSmallMapControl ());
map.addControl ( new GMapTypeControl ());
geoXml = new GGeoXml ( 'http://example.com/phpmysql_kmlnl.kml' );
map.addOverlay (geoXml);
map.setCenter ( new GLatLng (47.613976, -122.345467), 13);
}
}

The card should look something like this: picture

Step 5: What else can you think of


What else can be done with the existing database? The databases are good, you can add any data to the database. A format KML is good because it can dilute the contents of your cards. If you combine it together, you can do something interesting.
And it will turn out much better than if you used only KML. Use some of the unique features of Google Earth, such as <NetworkLink> files, that use <viewFormat> . This function allows you to send any parameters to your script. You can also use this function to modify the returned data. Or use <TimeStamp> or <TimeSpan> , which allow you to animate your tags. You can also create a database table with a more complex structure, which will store data about polygons <Polygons> , which can also be displayed on the map. Or create a page with which other people can also add new data to your card. You have endless possibilities!

')

Source: https://habr.com/ru/post/38448/


All Articles