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

  • SEARCH
  • Home
  • 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 3616552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:30:47+00:00 2026-05-18T22:30:47+00:00

this is a part of my geocoding code. I want it to show only

  • 0

this is a part of my geocoding code. I want it to show only country of the selected place, but it shows all address components, My problem is I cant specify the address components object. There is a way of doing it that is written on documentation but I didnt understand, can you do it for me.

 if (geocoder) {
                geocoder.geocode({'latLng': latlng}, function(results, status) {
                    if (status == google.maps.GeocoderStatus.OK) {
                        var str = "";
                        $.each(results, function(){
                            str += "address components: <ul>"
                            $.each(this.address_components, function(){
                                str +="<li>"+this.types.join(", ")+": "+this.long_name+"</li>";
                            });
                            str +="</ul>";
                        });
                        $("#geocode_info").html(str);
  • 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-18T22:30:47+00:00Added an answer on May 18, 2026 at 10:30 pm

    I guess you need only country from the response that comes.
    Need some work.Need to parse the json for country name.
    Try following for geocoding response.

    for(var addComponent in json.results[0].address_components){
        var component = json.results[0].address_components[addComponent];
        for(typeIndex in component.types ){
            if(component.types[typeIndex]=='country') {
                console.log(component.long_name);
            }
        }   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this part of code: ->filter('username', 'Security::xss_clean') ->filter('url', 'Security::xss_clean') ->filter('text', 'Security::xss_clean') but it
I'm trying this part of my script and it work perfectly if win32gui.GetCursorInfo()[1] ==
How do I fix up this part of my stored procedure? The select will
The Getting Started Rails Guide kind of glosses over this part since it doesn't
This code compiles on msvc/g++: class A{ protected: int i; class B{ public: A*
I have this dicT in my code that contain some positions. position = ['712,352',
I have this variable on the beginning of the code: enterActive = False and
This is my code so far: The HTML: <form> <label>First Name</label> <input type=text class=first
I just ran into this line of code: if( lineDirection.length2() ){...} where length2 returns
I'm sure this is simple, but I'm tripping up over a scope issue in

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.