hi Dominic, I made a try with polygons from mysql-db for german administrative areas. The example is here: http://www.ralf-wessels.de/Beispiele/Bundesland_Bezirk_Kreise.html
It is not perfect, but it works at least for normal polygons. If you have polygons with 2 or more objects (like islands) or "donut"- polygons then you probably have to look for other solutions. you will find a detailed discussion here: http://groups.google.com/group/Google-Maps-API/browse_thread/thread/13cd2db3933b337b/bbf3950efa5e02a7?lnk=gst&q=ralf+wessels#bbf3950efa5e02a7 data is stored as Multipolygon in mysql here is the php-extract to read out the db and create a xml-file: // Select all the rows in the bezirke table $query = "SELECT *,AsText(ogc_geom) AS koords FROM Bezirke_neu WHERE $name=Land_id ORDER BY Bezirk ASC"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } // Iterate through the rows, adding XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE $bezirke_node = $doc->create_element("bezirke"); // $newnode = $parnode->append_child($node); $child_bezirke_node = $parnode->append_child($bezirke_node); $poly_node = $doc->create_element("polys"); $attribute = $child_bezirke_node->append_child($poly_node); $attribute->set_attribute("Bezirk", (UTF8_encode($row['Bezirk']))); $attribute->set_attribute("Land", (UTF8_encode($row ['Bundesland']))); $attribute->set_attribute("Kreise", (UTF8_encode($row ['Anzahl_Kreise']))); $attribute->set_attribute("Bezirk_id", (UTF8_encode($row ['Bezirk_id']))); $Split=$row['koords']; $Split=str_replace(")))","",$Split); $Split=str_replace("MULTIPOLYGON(((","",$Split); $points=explode(",", $Split); $numPts = sizeof($points); for ($i = 0; $i <= $numPts - 1; $i++) { $coordinates = explode(" ",$points[$i]); $punkte_node = $doc->create_element("Punkte"); $attribute = $child_bezirke_node->append_child ($punkte_node); $attribute->set_attribute("Lat", (substr($coordinates[1], 0,-6))); // Latitude $attribute->set_attribute("Lon", (substr($coordinates[0], 0,-6))); // Longitude } } have fun + best greetings from berlin ralf --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" 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-API?hl=en -~----------~----~----~----~------~----~------~--~---
