---
title: "Load plot shape from CSV in CE"
url: "https://openforis.support/questions/1903/load-plot-shape-from-csv-in-ce"
tags: ["collectearth"]
status: "answered"
score: 0
answer_count: 2
asked: "2018-08-07T17:04:41"
last_activity: "2018-08-08T15:03:00"
source: "Open Foris Support - Q&A Forum"
license: "Copyright Open Foris, 2026. Some rights reserved under creative commons license."
---

# Load plot shape from CSV in CE

Asked by VContessa on 2018-08-07

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


## Answer (score 0, by collectearth on 2018-08-08)

Link: https://openforis.support/questions/1903/load-plot-shape-from-csv-in-ce/1904

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][1]

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>


  [1]: https://drive.google.com/open?id=111pWYVIaSpkWqShCbn-bCAVJqndDNGJB


## Answer (score 0, by VContessa on 2018-08-08)

Link: https://openforis.support/questions/1903/load-plot-shape-from-csv-in-ce/1906

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
