1

I am trying to import Table data into GEE. The original CSV file is at TERN Star Transects. I have followed the steps at GEE Importing Table Data (including making sure to specify either the x and y columns as "ref_x" and "ref_y", or the primary geometry column as "geom"), however I'm encountering two issues.

  1. Ingesting the Table (or seemingly any other table from a CSV file) increases the absolute value of the x and y coordinates of any point by around 7.
  2. Points appear as (160.84, 34.56) when they should be (160.84, -34.56), as they are in the CSV. This missing minus sign results in the points being placed off the coast of Japan when they should only be over Australia.

The code I'm using to display the points is

var STAR_TRANSECTS = ee.FeatureCollection("your_file_location");
print('STAR_TRANSECTS',STAR_TRANSECTS);
Map.addLayer(STAR_TRANSECTS, {}, 'STAR_TRANSECTS');

Some things I've tried:

  • A fresh new CSV test file: fixes the problem with negatives not appearing but doesn't solve the weird scaling issue.
  • Using someone else's CSV file they had attached to a StackExchange question. This works fine, including when I add negative values to their table!? Adding a CSV with GPS coordinates points to Google Earth Engine
  • Pulling the CSV file into R. R is able to read the negative sign. Exporting as a CSV from R and trying to upload that file to GEE did not solve the issues.

More details to help solve this:

At this point I'm not sure if I'm completely misunderstanding something about GEE or if there is a problem with the original data.

0

I wasn't able to identify what exactly was going wrong but below was my rough workaround by pulling the CSV into and out of R first before uploading to GEE. The problem must lie in the way some of the data is stored in this particular CSV. Making sure I could do numerical operations on the coordinates in R and removing a few of the unnecessary columns would appear to have solved the issue.

    library(readr)
star_transects <- read_csv("Downloads/star_transects.csv")

####----
#A Short test case
shrtst <- star_transects[1:50, 4:6]
shrtst[, 2:3] <- shrtst[, 2:3] * -1
shrtst[, 2:3] <- shrtst[, 2:3] * -1
write.csv(shrtst, "shrtst.csv", row.names = FALSE)

####----
#Applying to the whole dataset
fixed <- star_transects[, c(
  3,
  4,
  5,
  6,
  16,
  52,
  55,
  56,
  57,
  58,
  59,
  60,
  61,
  62,
  63,
  64,
  65,
  66,
  67,
  68,
  69,
  70,
  71,
  72,
  73,
  74,
  75,
  76,
  77,
  78,
  79,
  80,
  81,
  82,
  83,
  84,
  85,
  86,
  87,
  88,
  89,
  90,
  91,
  92,
  93,
  94
)]

fixed[, 3:4] <- fixed[, 3:4] * -1
fixed[, 3:4] <- fixed[, 3:4] * -1
write.csv(fixed, "fixed.csv", row.names = FALSE)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.