Multiple coordinates
Ldectus_gr - July 29, 2007 - 09:44
| Project: | KML module |
| Version: | 5.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Good day.
Due to the fact that my site is based on trips we make around Greece and the world, my nodes (trip documentary) contains more than one geolocation data. Some times it can have up to 7 location data, which then I add to gmap module and I've got a nice overview map of our trips.
Problem with this module is that once it creates the KML file, it contains ONLY the first location data.
Is it possible for the module to pickup all the location data from a specific node by itself and wrap them all up at a kml file ?
Thanks alot, in advance

#1
I've been meaning to do this for a while. I think the best way to do it would be to create a folder for nodes that have more than one location, then a placemark within that folder for each of the locations, using the location name as the name of the placemark.
#2
I'm not exactly sure if I can follow you. What do you mean "create a folder for nodes" ?
Forgive me if i can't get it....
#3
Well, after nearly six month, I now realised that I didn't knew so much (I was young! :))) ). Here I am again.
Since I wanted to implement the abovementioned feature, I looked carefully at your code and found out that at the function kml_format_placemark, you didn't "search" for the rest of the locations (if any). As i said, some nodes of mine are already filled with up to 7 geolocations. So, after a lot of trial and error, i managed to succeed it:
1.On line 693, I end up prematurely the Placemark that's opened at the beginning of the function.
$output .= " <TimeStamp><when>". $timestamp ."</when></TimeStamp>\n";}
}
$output .= " </Placemark>\n";
EXACTLY below, I add an sql query, based on the 'eid' field on the 'location' table, which *IF* I'm not mistaken, points to the actual node number. So we should have many identical 'eid' values with different 'lid' values:
$testsql = "SELECT eid, lid, name, latitude, longitude FROM location where eid = '$item->nid'";
$resultloc = mysql_query($testsql);
while($row = mysql_fetch_array($resultloc, MYSQL_ASSOC)) {
// Coordinate information
// $lat = $item->location['latitude']; // Removed
// $long = $item->location['longitude']; // Removed
$lat = $row['latitude'];
$long = $row['longitude'];
if ($lat && $long) {
$output .= ' <Placemark id="' .$row['lid'] .'">' ."\n";
$output .= " <name>" .$row['name'] ."</name>\n";
$output .= " <description>" .$row['name'] ."</description>\n";
Finally, near line 718 (ok, above the two brackets, before the next comments), I have to end up the new placemark:
}$output .= ' <coordinates>'. $long .','. $lat .','. $alt ."</coordinates>\n";
$output .= " </Point>\n";
$output .= " </Placemark>\n"; // Added by me
}
}
I have to admit, that this is the "rough" way to get to do what I wanted. I'm very sure it can be worked a little bit to look better. I just don't know if I'm braking up something else, by adding the above code.
Thanks Geodaniel !!!
#4
Subscribing