0

If I have this geoJSON, how can I retrieve in Javascript the first pair of coordinates [ 13.18232, 42.767165 ]? Is data.features.geometry.coordinates[0] wrong?

{
"type": "FeatureCollection",
"name": "Tracks",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", 
"properties": 
{ 
"Name": "Traversata Castelluccio", 
"description": null, 
"begin": "2019\/07\/07 07:17:27+00", 
"end": "2019\/07\/07 12:41:59+00" 
}, 
"geometry": 
{ 
"type": "LineString", 
"coordinates": [ 
[ 13.18232, 42.767165 ], [ 13.182309, 42.76717 ], [ 13.182189, 42.76723 ], [ 13.18205, 42.767345 ], [ 13.181932, 42.767453 ], [ 13.181793, 42.767553 ], [ 13.181697, 42.767625 ] 
] 
} 
}
]
}
davide
  • 1
  • 1
  • You probably don't have JSON, but if you do, you parse it so that you aren't dealing with a string anymore. [JSON is a *textual notation* for data exchange. [(More here.)](http://stackoverflow.com/a/2904181/157247) If you're dealing with JavaScript source code, and not dealing with a *string*, you're not dealing with JSON.] – T.J. Crowder May 28 '20 at 12:52
  • I just noticed you didn't tag JavaScript (I thought you had): What language or environment do you want to do this in? – T.J. Crowder May 28 '20 at 12:54

0 Answers0