question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with parsing the coordinates in array format

See original GitHub issue

The main assumption of the data is to be like:

var data = [
  { name: 'Location A', category: 'Store', street: 'Market', lat: 39.984, lng: -75.343 },
  { name: 'Location B', category: 'House', street: 'Broad', lat: 39.284, lng: -75.833 },
  { name: 'Location C', category: 'Office', street: 'South', lat: 39.123, lng: -74.534 }
];

when the coordinates are within an array as below, the generated GeoJSON is not valid:

var data = [
  { name: 'Location A', category: 'Store', street: 'Market', coordinates: [39.984, -75.343] },
  { name: 'Location B', category: 'House', street: 'Broad', coordinates: [39.284, -75.833] },
  { name: 'Location C', category: 'Office', street: 'South', coordinates: [39.123, -74.534] }
];

I tried to parse the above-mentioned dataset as below and it didn’t work either: GeoJSON.parse(data, {Point: ['coordinates']});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
trandiepbangcommented, Oct 14, 2017

Same 😦

0reactions
caseycesaricommented, Feb 14, 2019

Fixed in #39

Read more comments on GitHub >

github_iconTop Results From Across the Web

parsing an array of an array of coordinates · Issue #22 - GitHub
I am trying to figure out how to parse an array of an array of coordinates, and have tried going through the section...
Read more >
Parsing array of objects to format data - Stack Overflow
I want to parse the coordinates position to get a more scalable object and get its properties nesting. This is what I've tried:...
Read more >
Solved: Parse JSON Help - Power Platform Community
I'm able to access all parameters just fine EXCEPT for the latitude and longitude "locked up" in the geometry/coordinates array:
Read more >
Parse a cell array of strings without looping - MATLAB Answers
I need to parse each string to separate the coordinates, convert the coordinates to numbers, do an operation on them, then put them...
Read more >
JSON functions | BigQuery - Google Cloud
JSON_QUERY, Extracts a JSON value, such as an array or object, or a JSON scalar value, such as a string, number, or boolean....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found