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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:20:34+00:00 2026-05-27T17:20:34+00:00

I would like to read geographic data (logitude/latitude) from two sources into one Javascript

  • 0

I would like to read geographic data (logitude/latitude) from two sources into one Javascript array. I created an javascript object with an array to hold this data

This is my object definition:

var GeoObject = {   
    "info": [ ]
};

When reading the two sources of data, if the key RecordId already exists in an array, then append new array elements (lat&lon) to existing GeoObject, otherwise add a new array record.

for instance, if the RecordId 99999 does not already exist then add array (like an SQL add)

GeoObject.info.push( 
{  "RecordId": "99999" , "Bing_long": -75.0000, "Bing_lat": 41.0000 } )

if record 99999 already exists, then append new data to existing array (like an SQL update).

GeoObject.info.update???( 
{  "RecordId": "99999" , "Google_long": -75.0001, "Google_lat": 41.0001 } )

When the application is finished, each array in the object should have five array elements including the RecordId. Examples:

[  "RecordId": "88888" , "Bing_long": -74.0000, "Bing_lat": 40.0001, "Google_long": -74.0001, "Bing_long": -70.0001 ]
[  "RecordId": "99999" , "Bing_long": -75.0000, "Bing_lat": 41.0001, "Google_long": -75.0001, "Bing_long": -75.0001 ]

I hope that I am clear. This pretty new and a bit complex for me.

Maybe the object definition is not ideal for this case.

  • 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-27T17:20:35+00:00Added an answer on May 27, 2026 at 5:20 pm

    I’d make an object of objects.

    var GeoObject = {
      // empty
    }
    
    function addRecords(idAsAString, records) {
      if (GeoObject[idAsAString] === undefined) {
        GeoObject[idAsAString] = records;
      } else {
        for (var i in records) {
          GeoObject[idAsAString][i] = records[i];
        }
      }
    }
    
    // makes a new
    addRecords('9990', { "Bing_long": -75.0000, "Bing_lat": 41.0000 });
    //updates:    
    addRecords('9990', { "Google_long": -75.0001, "Google_lat": 41.0001 });
    

    This gives you an object that looks like this:

    GeoObject = { '9990' : { "Bing_long": -75.0000, 
                             "Bing_lat": 41.0000,
                             "Google_long": -75.0001,
                             "Google_lat": 41.0001 }
    }
    

    With a second record it would look like this:

    GeoObject = { '9990' : { "Bing_long": -75.0000, 
                             "Bing_lat": 41.0000,
                             "Google_long": -75.0001,
                             "Google_lat": 41.0001 },
    
                  '1212' : { "Bing_long": -35.0000, 
                             "Bing_lat": 21.0000 }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to read the value from the e.Item.DataItem into a string but
I would like to read strings into Matlab from an excel file ID =
I would like to read some data from a stream I have using std::getline
I would like to read a text file into an array of strings using
I would like to read data from a plist, add some elements and the
I would like to read a 2d array of integers from stdin (or from
I would like to read a drawable image from an external package into a
I would like to read a text file and input its contents into an
I would like to read the xsi:type attribute from the current node in a
I would like to get access to the Tomcat internal data from a servlet

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.