yeeah i need to look the field types! Many thanks Bro! Best regards. Solved.
On 1 Apr, 14:47, Marcelo <[email protected]> wrote: > On Apr 1, 1:46 am, niepere <[email protected]> wrote: > > > I wonder how I could do to always know the exact location in the array > > of the following data: > > - Region > > - Province > > - Cap > > - State > > - CodiceStato > > It's not a fixed array. It's an array of objects where each object > contains it own description within itself, so for each object you need > to examine the field "types" to find out what the object > contains.http://code.google.com/apis/maps/documentation/geocoding/#JSON > > I have been campaigning for a flat and consistent format for a couple > of years now, and things have improved, but we are not all the way > there yet. > This issue,http://code.google.com/p/gmaps-api-issues/issues/detail?id=606 > is now marked as "Fixed", but the format is not really flat. > > -- > Marcelo -http://maps.forum.nu > -- > > > Every time you make a query > > (tohttp://maps.google.com/maps/api/geocode/json?address=address..) > > results and change the index location is not always the same as in > > this case: > > > Look address_components[1] in the first array is equals to provincie, > > in the second array is equals to address > > > FIRST ARRAY: (query address to new geocoder v3=Via Torino, 20123 > > Milano, Italia) > > ( > > [status] => OK > > [results] => Array > > ( > > [0] => stdClass Object > > ( > > [types] => Array > > ( > > [0] => route > > ) > > > [formatted_address] => Via Torino, 20123 Milano, > > Italia > > [address_components] => Array > > ( > > [0] => stdClass Object > > ( > > [long_name] => Via Torino > > [short_name] => Via Torino > > [types] => Array > > ( > > [0] => route > > ) > > > ) > > > [1] => stdClass Object > > ( > > [long_name] => Milano > > [short_name] => Milano > > [types] => Array > > ( > > [0] => locality > > [1] => political > > ) > > > ) > > > [2] => stdClass Object > > ( > > [long_name] => Milano > > [short_name] => MI > > [types] => Array > > ( > > [0] => > > administrative_area_level_2 > > [1] => political > > ) > > > ) > > > [3] => stdClass Object > > ( > > [long_name] => Lombardia > > [short_name] => Lombardia > > [types] => Array > > ( > > [0] => > > administrative_area_level_1 > > [1] => political > > ) > > > ) > > > [4] => stdClass Object > > ( > > [long_name] => Italia > > [short_name] => IT > > [types] => Array > > ( > > [0] => country > > [1] => political > > ) > > > ) > > > [5] => stdClass Object > > ( > > [long_name] => 20123 > > [short_name] => 20123 > > [types] => Array > > ( > > [0] => postal_code > > ) > > > ) > > > ) > > > [geometry] => stdClass Object > > ( > > [location] => stdClass Object > > ( > > [lat] => 45.4620939 > > [lng] => 9.1859356 > > ) > > > [location_type] => GEOMETRIC_CENTER > > [viewport] => stdClass Object > > ( > > [southwest] => stdClass Object > > ( > > [lat] => 45.4589637 > > [lng] => 9.1816634 > > ) > > > [northeast] => stdClass Object > > ( > > [lat] => 45.4652589 > > [lng] => 9.1882641 > > ) > > > ) > > > [bounds] => stdClass Object > > ( > > [southwest] => stdClass Object > > ( > > [lat] => 45.4604606 > > [lng] => 9.1816634 > > ) > > > [northeast] => stdClass Object > > ( > > [lat] => 45.463762 > > [lng] => 9.1882641 > > ) > > > ) > > > ) > > > ) > > > ) > > > ) > > > AND SECOND ARRAY: > > (query address to new geocoder v3=Via Antonio Gramsci, 86/a, 50031 > > Barberino di Mugello FI, Italia) > > > ( > > [status] => OK > > [results] => Array > > ( > > [0] => stdClass Object > > ( > > [types] => Array > > ( > > [0] => street_address > > ) > > > [formatted_address] => Via Antonio Gramsci, 86/a, > > 50031 Barberino di Mugello FI, Italia > > [address_components] => Array > > ( > > [0] => stdClass Object > > ( > > [long_name] => 86/a > > [short_name] => 86/a > > [types] => Array > > ( > > [0] => street_number > > ) > > > ) > > > [1] => stdClass Object > > ( > > [long_name] => Via Antonio Gramsci > > [short_name] => Via Antonio > > Gramsci > > [types] => Array > > ( > > [0] => route > > ) > > > ) > > > [2] => stdClass Object > > ( > > [long_name] => Barberino di > > Mugello > > [short_name] => Barberino di > > Mugello > > [types] => Array > > ( > > [0] => locality > > [1] => political > > ) > > > ) > > > [3] => stdClass Object > > ( > > [long_name] => Firenze > > [short_name] => FI > > [types] => Array > > ( > > [0] => > > administrative_area_level_2 > > [1] => political > > ) > > > ) > > > [4] => stdClass Object > > ( > > [long_name] => Toscana > > [short_name] => Toscana > > [types] => Array > > ( > > [0] => > > administrative_area_level_1 > > [1] => political > > ) > > > ) > > > [5] => stdClass Object > > ( > > [long_name] => Italia > > [short_name] => IT > > [types] => Array > > ( > > [0] => country > > [1] => political > > ) > > > ) > > > [6] => stdClass Object > > ( > > [long_name] => 50031 > > [short_name] => 50031 > > [types] => Array > > ( > > [0] => postal_code > > ) > > > ) > > > ) > > > [geometry] => stdClass Object > > ( > > [location] => stdClass Object > > ( > > [lat] => 43.9939541 > > [lng] => 11.2394425 > > ) > > > [location_type] => RANGE_INTERPOLATED > > [viewport] => stdClass Object > > ( > > [southwest] => stdClass Object > > ( > > [lat] => 43.9905203 > > [lng] => 11.2367025 > > ) > > > [northeast] => stdClass Object > > ( > > [lat] => 43.9968156 > > [lng] => 11.2429978 > > ) > > > ) > > > [bounds] => stdClass Object > > ( > > [southwest] => stdClass Object > > ( > > [lat] => 43.9929934 > > [lng] => 11.2393758 > > ) > > > [northeast] => stdClass Object > > ( > > [lat] => 43.9943425 > > [lng] => 11.2403245 > > ) > > > ) > > > ) > > > ) > > > ) > > > ) > > > Some ideas or help? > > Thanks in advance. -- 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.
