I am writing a php library for the Google Maps Api v3. I have written a simple function that stores the results from google for a given geocode query.
I use SimpleXML and xml results from the API. I want to store the postal code (zip) from the results I get. And so I write the following php code: $postalcode = $xml->Response->Placemark[$i]->AddressDetails->Country- >AdministrativeArea->SubAdministrativeArea->Locality->PostalCode- >PostalCodeNumber; In the same level (Locality) there is also the ‘ThoroughfareName’ tag which I store as well. This works fine for most of the cases. But not all. There are certain results that include these two tags in an additional level after the ‘Locality’ one named ‘DependentLocality’. So the path to the needed tags is now: $xml->Response->Placemark[$i]->AddressDetails->Country- >AdministrativeArea->SubAdministrativeArea->Locality-> DependentLocality->PostalCode->PostalCodeNumber You can reproduce this result with the following url: http://maps.google.com/maps/geo?output=xml&key=PUTYOURKEYHERE&q=nafsikas+12 (Don’t forget to ‘put your key here’) This is of course breaking my code. The OASIS CIQ V2.0 Specifications / Standards which google Maps uses do indeed use the ‘ThoroughfareName’tag but in no case do they include the ‘postalcode’ and ‘thoroughfarename’ in it. These tags are always kept under the ‘Locality’ tag. So what am I supposed to do? Is this a bug that will be fixed? Should I bombard my code with ‘if’s in hope of catching all the cases? The SimpleXML functions are very weak to tackle the issue using them… Help! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
