Hello,

in a Collect Earth project I would like to load the plot shapes from the CSV. The desired shapes are 40 ha projected hexagons with a square centroid of 1 ha.

From a fusion table I download this line (below an example) that goes into the "geometry" column in the Grid file of the project:

<polygon><outerboundaryis><linearring><coordinates>120.093914,-8.56532,0.0 120.092215,-8.562381,0.0 120.088809,-8.562381,0.0 120.087101,-8.56532,0.0 120.0888,-8.568258,0.0 120.092215,-8.568258,0.0 120.093914,-8.56532,0.0</coordinates></linearring></outerboundaryis><innerboundaryis><linearring><coordinates>120.090099,-8.565726,0.0 120.090916,-8.565726,0.0 120.090916,-8.564913,0.0 120.090099,-8.564913,0.0 120.090099,-8.565726,0.0</coordinates></linearring></innerboundaryis></polygon>

This works in Google Earth, but in the auxiliary Bing maps and Google Earth Engine windows, only the outer shape is loaded, the square centroid is missing.

This other trial

<multigeometry><polygon><linearring><coordinates>120.093914,-8.56532,0.0 120.092215,-8.562381,0.0 120.088809,-8.562381,0.0 120.087101,-8.56532,0.0 120.0888,-8.568258,0.0 120.092215,-8.568258,0.0 120.093914,-8.56532,0.0</coordinates></linearring></polygon><polygon><linearring><coordinates>120.090099,-8.565726,0.0 120.090916,-8.565726,0.0 120.090916,-8.564913,0.0 120.090099,-8.564913,0.0 120.090099,-8.565726,0.0</coordinates></linearring></polygon></multigeometry>

doesn't show the polygon in Google Earth either.

How can I solve this?

Valeria

asked 07 Aug, 17:04

VContessa's gravatar image

VContessa
112
accept rate: 0%

edited 07 Aug, 17:05


Dear Valeria,

The problem is that the format that Collect Earth expects the polygons to be is inside a MultiGeometry.

The KML geometry should look like this:

<MultiGeometry>
<Polygon>
<LinearRing>
<coordinates> .... </coordinates>
</LinearRing>
</Polygon>
<Polygon>
<LinearRing>
<coordinates> .... </coordinates>
</LinearRing>
</Polygon>
.
.
.
<MultiGeometry>

Also, in the eeCodeEditorScript.fmt file that you use in the survey you need to adapt it so that there is a piece of code that "paints" the polygons after the first one. So after the "processPlotInfo" method add these lines:

// START -- SPECIAL CODE TO ADD SUBPLOTS var subPlot;

<#list placemark.multiShape as subPlot>
    <#if subPlot?index gt 0> <#-- IGNORE the first subplot,as it will be the same as the plot polygon -->
subPlot = ee.Geometry.LinearRing([
    <#list subPlot as coord>[${coord.longitude}, ${coord.latitude}],</#list>
]);
Map.addLayer( subPlot, null, "Subplot", true );
    </#if>
</#list>
// END -- SPECIAL CODE TO ADD SUBPLOTS

You can for instance use this file that already has the changes implemented : eeCodeEditorScript.fmt

So. In your CSV file you will have instead a KML Multigeometry like this:

<MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>120.093914,-8.56532,0.0 120.092215,-8.562381,0.0 120.088809,-8.562381,0.0 120.087101,-8.56532,0.0 120.0888,-8.568258,0.0 120.092215,-8.568258,0.0 120.093914,-8.56532,0.0</coordinates></LinearRing></outerBoundaryIs></Polygon><Polygon><outerBoundaryIs><LinearRing><coordinates>120.090099,-8.565726,0.0 120.090916,-8.565726,0.0 120.090916,-8.564913,0.0 120.090099,-8.564913,0.0 120.090099,-8.565726,0.0</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry>
permanent link

answered 08 Aug, 11:54

collectearth's gravatar image

collectearth ♦
64015
accept rate: 16%

edited 08 Aug, 11:55

Thank you, now it works!

Related to this, do you know if is there is perhaps a way to export directly from Google Earth Engine a CSV file with the coordinates written as a KML Multigeometry? To avoid going through exporting the KML, transforming it in a Fusion Table and getting the polygon values as a CSV file.

Thanks,

Valeria

permanent link

answered 08 Aug, 15:02

VContessa's gravatar image

VContessa
112
accept rate: 0%

edited 08 Aug, 15:03

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×159

question asked: 07 Aug, 17:04

question was seen: 53 times

last updated: 08 Aug, 15:03