Geographic Information Systems Asked by user174442 on June 18, 2021
I am using Google Earth Engine, I have a FeatureCollection in which I extract a single Linestring into a "Feature" item.
(JSON output is included below)
I can extract any items from the "properties" objects using the ee.Feature.get() function.
However, I am unable to grab the coordinates from the "geometry" section.
How can I grab the coordinates of this line and export them to separate variables?
-edit-
I was able to find a workaround by using GIS, making table entries for begin and end X and Y values, the read the data in Earth Engine with a .getInfo() call from the new properties entries.
You can do it in one go, but I'm doing it in steps so you can see how to access it. First you need to take the Geometry out of the Feature. Then you access the coordinates through the geometry functions. (if you look at the print, it tells you what object is made of).
var myGeometry = myLinestring.geometry();
print(myGeometry);
var myCoordinates = myGeometry.coordinates();
print(myCoordinates);
var firstCoordinate = myCoordinates.get(0);
var lastCoordinate = myCoordinates.get(-1);
print(firstCoordinate);
print(lastCoordinate);
Correct answer by Sean Roulet on June 18, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP