Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6157947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:52:15+00:00 2026-05-23T20:52:15+00:00

I’m trying to extract some extra information from a location using google map api.

  • 0

I’m trying to extract some extra information from a location using google map api. I take a look and it’s possible but I don’t understand well where I’ve to put the bounds parameter. This is my request:

var address = document.getElementById("address").value;
    geocoder.geocode( { 'address': address}, function(results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        alert(results[0].formatted_address);    
    } else {
        alert("Geocode was not successful for the following reason: " + status);
    }
});

I suppose to add the bound after ‘address’:address but not clear how. I tryied with that but it doesn’t works:

geocoder.geocode( { 'address': address, "types":["sublocality","political"]}, function(results, status) {

I don’t know if have familiar with Italian province but I need something like that:

Request: Venezia
Response: VE or Venezia

Request: Murano
Response: VE or Venezia

—- Improved:

Using http://maps.googleapis.com/maps/api/geocode/json?address=murano&sensor=false I can obtain this:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Murano",
               "short_name" : "Murano",
               "types" : [ "natural_feature" ]
            },
            {
               "long_name" : "Venezia",
               "short_name" : "Venezia",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Venezia",
               "short_name" : "VE",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "Veneto",
               "short_name" : "Veneto",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Italia",
               "short_name" : "IT",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "30141",
               "short_name" : "30141",
               "types" : [ "postal_code" ]
            }
         ],

Trying to print using alert(results[0].address_components); it doesn’t show me anything, how can I extract this:

           "long_name" : "Venezia",
           "short_name" : "VE",
           "types" : [ "administrative_area_level_2", "political" ]

thanks,
Andrea

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:52:16+00:00Added an answer on May 23, 2026 at 8:52 pm

    I do not see any other solution than iterate by address_components and match first data with short_name that contains 2 letters.

    var len = results[0].address_components.length;
    var data;
    for ( var i = 0; i < len; i++ ) {
        if ( results[0].address_components[i].short_name.length == 2 ) {
            data = results[0].address_components[i];
            break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.