Thanks for your answer. You're right, my kml output is nearly empty. and that's what I'm trying to fix. Please help me guys ! If it was possible to generate custom maps directy from yahoo pipes, that would be great !
What I'm trying to do is : 1-My input is a dynamic kml file generated with yahoo pipes : http://pipes.yahoo.com/pipes/pipe.run?_id=05d488cc3681dcf152902bca4373ccc7&_render=kml 2-I want to add custom icons using rss2kml.php 3- the output should be a modified kml output with custom icon in the kml structure. What I've done for the moment : - the rss2kml.php is stored here : http://www.activitypedia.org/rss2kml.php (the code is at the bottom of this message) - for security reason I had to change the rss2kml.php "get file" with "curl". It seems to work fine : I manage to get the kml file from yahoo.. - When I try it with yahoo pipes, it doesn't work (you can try it with : http://www.activitypedia.org/rss2kml.php?url=http%3A//pipes.yahoo.com/pipes/pipe.run%3F_id%3D05d488cc3681dcf152902bca4373ccc7%26_render%3Dkml&icon=http://www.activitypedia.org/img/gmap/gmap1.png ) output is only the icon part. -When I try it with a copy of the yahoo pipes kml stored on my server, it works great. - here is the copy on my server : http://www.activitypedia.org/pipe.ashx - and my example : http://www.activitypedia.org/rss2kml.php?url=http://www.activitypedia.org/pipe.ashx&icon=http://www.activitypedia.org/img/gmap/gmap1.png Same kml used, only the url is different... It can't be a proxy problem 'cause I manage to echo the kml input... anyone has an idea ? rss2kml.php code : <?php function startElement($parser, $name, $attribs) { global $latitude, $longitude, $currentTag, $withinItem, $icon, $kml; $currentTag = strtolower($name); switch ($currentTag) { case "item": $withinItem = true; $kml[] = "<Placemark>"; if ($icon) { $kml[] = "<styleUrl>#icon</styleUrl>"; } $latitude = 0; $longitude = 0; break; case "title": if ($withinItem) { $kml[] = "<name>"; } break; case "description": if ($withinItem) { $kml[] = "<description>"; } break; } } function endElement($parser, $name) { global $latitude, $longitude, $currentTag, $withinItem, $kml; switch (strtolower($name)) { case "item": $withinItem = false; $kml[] = "<Point><coordinates>$longitude,$latitude,0</ coordinates></Point>"; $kml[] = "</Placemark>"; break; case "title": if ($withinItem) { $kml[] = "</name>"; } break; case "description": if ($withinItem) { $kml[] = "</description>"; } break; } $currentTag = ""; } function characterData($parser, $data) { global $latitude, $longitude, $currentTag, $withinItem, $kml; switch ($currentTag) { case "item": case "title": case "description": if ($withinItem) { $kml[] = htmlspecialchars(trim($data)); } break; case "geo:lat": $latitude = $data; break; case "geo:long": $longitude = $data; break; } } $file = $_GET['url']; $icon = $_GET["icon"]; $render = $_GET["_render"]; if ($render) { $file=$file.'&_render=kml'; } $currentTag = ""; $withinItem = false; $latitude = 0; $longitude = 0; $kml = array(); $kml[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; $kml[] = "<kml xmlns=\"http://www.opengis.net/kml/2.2\">"; $kml[] = "<Document>"; if ($icon) { $kml[] = "<Style id=\"icon\">"; $kml[] = "<IconStyle>"; $kml[] = "<scale>10</scale>"; $kml[] = "<Icon><href>$icon</href></Icon>"; $kml[] = "</IconStyle>"; $kml[] = "</Style>"; } $xmlParser = xml_parser_create(); xml_set_element_handler($xmlParser, "startElement", "endElement"); xml_set_character_data_handler($xmlParser, "characterData"); //Initialize the Curl session $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $file); //Execute the fetch $xml_data = curl_exec($ch); curl_close($ch); xml_parse($xmlParser, $xml_data, true); xml_parser_free($xmlParser); $kml[] = "</Document>"; $kml[] = "</kml>"; header("Content-Type: application/vnd.google-earth.kml +xml;charset=UTF-8"); echo implode($kml);?> -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
