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 8381309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:40:16+00:00 2026-06-09T16:40:16+00:00

I am trying to store the latitude and the longitude from an array where

  • 0

I am trying to store the latitude and the longitude from an array where its length is sometimes 1 ,sometimes 2 or 3 .

Here is the code:

    var latitude,longitude;
    $.each(data.results, function (i, item) {
    var name = item.from_user;
    var img = item.profile_image_url;
    var text=item.text;
    var profile_img=item.profile_image_url;
    var url=(item.entities.urls.length > 0 ? item.entities.urls[0].url : '');
    Placemaker.getPlaces(text,function(o){
    console.log(o);
    if (typeof(o.match!=='undefined') ||(o.length==1)){
     latitude=o.match.place.centroid.latitude, longitude=o.match.place.centroid.longitude; 
     console.log(latitude,longitude);}
     else if (typeof(o.match[0]!=='undefined') ||(o.match.length==2)){
        latitude=o.match[0].place.centroid.latitude, longitude=o.match[0].place.centroid.longitude; 
     console.log(latitude,longitude);
     }

    });
    array.push({name:name,img:img,text:text,latitude:latitude,longitude:longitude,profile_img:profile_img,url:url});

From this code I get only the latitude & longitude values when the array length is 1. So only the first if is executed. I am trying to fix the others so that I can get values from the other arrays as well, since when I use console.log to output the array, the values of latitude & longitude are not there. I guess that the loop has to finish getting all the values before putting them into the array.

I am trying to output the tweets on the google map via the tweets location. I am not using geocode but yahoo placemaker to geolocate the location from the text of the tweet.

here is a snapshot of the placemaker array structure http://www.flickr.com/photos/codepo8/3553188917/

this is the other array that am trying to get values Object { match=[2]}

  • 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-06-09T16:40:18+00:00Added an answer on June 9, 2026 at 4:40 pm

    typeof(o.match!=='undefined') is always “boolean”
    I think you want
    typeof(o.match)!=='undefined' or just typeof o.match!=='undefined'

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to store my data in memory here is what i have
I am trying to store latitude and longitude information in MySQL. I am using
Hi i am trying to get each longitude and latitude that arrives in this
Here is my array; $json = ' { 1:{ Device_ID:a9a3346be4375a92, Date:2012-05-31, Time:15:22:59, Latitude:51.4972912, Longitude:0.1108178
Im trying to store a list,collection of data objects in Hbase. For example ,a
I'm trying to store BitmapData from a MovieClip that is a PNG with transparency.
Trying to store property of C#/.NET type byte[] in SQLite . Here is my
I'm trying to store the print output from a function of another module imported,
I'm trying to store an array value so that I can reuse when Sub
I'm trying to store some data in DOM Elements ($.cache) on my plugin but

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.