Error importing KML

Hi

I’m trying to create activity log based on recent activity on AgOpenGPS.
I parse the filename of the most recent field worked on.

Also, I want to import the KML-file from AgOpenGPS with boundary, flags, ab-lines etc. When the field is done, and closed, the KML is generated.

But I’m confused. Some KML files I can import and some not.
All are created in AgOpenGPS, but could be different versions of the app.

Even a simple field with just a bondary is not working. I can open them in Google Earth even if the import fail.

It could be a quite cool activity log.
The KML also contains some stats like worked area etc…

KMLl file not working:

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
   <Document>
      <Folder>
         <name>Field Stats</name>
         <description>Field: 2024-02-22 test
Total Hectares: 12,6
Worked Hectares: 0,0
Missing Hectares: 12,59
Total Acres: 31,1
Worked Acres: 0,0
Missing Acres: 31,12
Tool Width: 4
Sections: 3
Section Overlap: 0
</description>
      </Folder>
      <Folder>
         <name>Boundaries</name>
         <Placemark>
            <name>2024-02-22 test</name>
            <Style>
               <LineStyle>
                  <color>ffdd00dd</color>
                  <width>4</width>
               </LineStyle>
               <PolyStyle>
                  <color>407f3f55</color>
               </PolyStyle>
            </Style>
            <Polygon>
               <tessellate>1</tessellate>
               <outerBoundaryIs>
                  <LinearRing>
                     <coordinates>12.2350154,58.2025084,0 12.2349950,58.2025061,0 12.2349745,58.2025037,0 12.2349541,58.2025013,0 12.2349336,58.2024989,0 12.2349132,58.2024965,0 12.2348927,58.2024941,0 12.2348723,58.2024918,0 12.2348518,58.2024894,0 12.2348314,58.2024870,0 12.2348109,58.2024846,0 12.2347905,58.2024822,0 12.2347700,58.2024798,0 12.2347496,58.2024775,0 12.2347291,58.2024751,0 12.2347087,58.2024727,0 12.2346882,58.2024703,0 12.2346678,58.2024679,0 12.2346473,58.2024655,0 12.2346269,58.2024632,0 12.2346064,58.2024608,0 12.2345859,58.2024584,0 12.2345655,58.2024560,0 12.2345450,58.2024536,0 12.2345246,58.2024512,0 12.2345041,58.2024488,0 12.2344837,58.2024465,0 12.2344632,58.2024441,0 12.2344428,58.2024417,0 12.2344223,58.2024393,0 12.2344019,58.2024369,0 12.2343814,58.2024345,0 12.2343610,58.2024322,0 12.2343405,58.2024298,0 12.2343201,58.2024274,0 12.2342996,58.2024250,0 12.2342792,58.2024226,0 12.2342587,58.2024202,0 12.2342383,58.2024179,0 12.2342178,58.2024155,0 12.2341974,58.2024131,0 12.2341769,58.2024107,0 12.2341565,58.2024083,0 12.2341360,58.2024059,0 12.2341156,58.2024035,0 12.2340951,58.2024012,0 12.2340746,58.2023988,0 12.2340542,58.2023964,0 12.2340337,58.2023940,0 12.2340133,58.2023916,0 12.2339928,58.2023892,0 12.2339724,58.2023869,0 12.2339519,58.2023845,0 12.2339315,58.2023821,0 12.2339110,58.2023797,0 12.2338906,58.2023773,0 12.2338701,58.2023749,0 12.2338497,58.2023726,0 12.2338292,58.2023702,0 12.2338088,58.2023678,0 12.2337883,58.2023654,0 12.2337679,58.2023630,0 12.2337474,58.2023606,0 12.2337270,58.2023582,0 12.2337065,58.2023559,0 12.2336861,58.2023535,0 12.2336656,58.2023511,0 12.2336452,58.2023487,0 12.2336247,58.2023463,0 12.2336042,58.2023439,0 12.2335838,58.2023416,0 12.2335633,58.2023392,0 12.2335429,58.2023368,0 12.2335224,58.2023344,0 12.2335020,58.2023320,0 12.2334815,58.2023296,0 12.2334611,58.2023273,0 12.2334406,58.2023249,0 12.2334202,58.2023225,0 12.2333997,58.2023201,0 12.2333793,58.2023177,0 12.2333588,58.2023153,0 12.2333384,58.2023129,0 12.2333179,58.2023106,0 12.2332975,58.2023082,0 12.2332770,58.2023058,0 12.2332566,58.2023034,0 12.2332361,58.2023010,0 12.2332157,58.2022986,0 12.2331952,58.2022963,0 12.2331748,58.2022939,0 12.2331543,58.2022915,0 12.2331339,58.2022891,0 12.2331134,58.2022867,0 12.2330930,58.2022843,0 12.2330725,58.2022820,0 12.2330520,58.2022796,0 12.2330316,58.2022772,0 12.2330111,58.2022748,0 12.2329907,58.2022724,0 12.2329702,58.2022700,0 12.2329498,58.2022676,0 12.2329293,58.2022653,0 12.2329089,58.2022629,0 12.2328884,58.2022605,0 12.2328680,58.2022581,0 12.2328475,58.2022557,0 12.2328271,58.2022533,0 12.2328066,58.2022510,0 12.2327862,58.2022486,0 12.2327657,58.2022462,0 12.2327453,58.2022438,0 12.2327248,58.2022414,0 12.2327044,58.2022390,0 12.2326839,58.2022367,0 12.2326635,58.2022343,0 12.2326430,58.2022319,0 12.2326226,58.2022295,0 12.2326021,58.2022271,0 12.2325817,58.2022247,0 12.2325612,58.2022223,0 12.2325407,58.2022200,0 12.2325203,58.2022176,0 12.2324998,58.2022152,0 12.2324794,58.2022128,0 12.2324589,58.2022104,0 12.2324385,58.2022080,0 12.2324180,58.2022057,0 12.2323976,58.2022033,0 12.2323771,58.2022009,0 12.2323567,58.2021985,0 12.2323362,58.2021961,0 12.2323158,58.2021937,0 12.2322953,58.2021914,0 12.2322749,58.2021890,0 12.2322544,58.2021866,0 12.2322340,58.2021842,0 12.2322135,58.2021818,0 12.2321931,58.2021794,0 12.2321726,58.2021770,0 12.2321522,58.2021747,0 12.2321317,58.2021723,0 12.2321113,58.2021699,0 12.2320908,58.2021675,0 12.2320704,58.2021651,0 12.2320499,58.2021627,0 12.2320295,58.2021604,0 12.2320090,58.2021580,0 12.2319885,58.2021556,0 12.2319681,58.2021532,0 12.2319476,58.2021508,0 12.2319272,58.2021484,0 12.2319067,58.2021461,0 12.2318863,58.2021437,0 12.2318658,58.2021413,0 12.2318454,58.2021389,0 12.2318249,58.2021365,0 12.2318045,58.2021341,0 12.2317840,58.2021317,0 12.2317636,58.2021294,0 12.2317431,58.2021270,0 12.2317227,58.2021246,0 12.2317022,58.2021222,0 12.2316818,58.2021198,0 12.2316613,58.2021174,0 12.2316409,58.2021151,0 12.2316204,58.2021127,0 12.2316000,58.2021103,0 12.2315795,58.2021079,0 12.2315591,58.2021055,0 12.2315386,58.2021031,0 12.2315182,58.2021008,0 12.2314977,58.2020984,0 12.2314773,58.2020960,0 12.2314568,58.2020936,0 12.2314364,58.2020912,0 12.2314159,58.2020888,0 12.2313954,58.2020864,0 12.2313750,58.2020841,0 12.2313545,58.2020817,0 12.2313341,58.2020793,0 12.2313136,58.2020769,0 12.2312932,58.2020745,0 12.2312727,58.2020721,0 12.2312523,58.2020698,0 12.2312318,58.2020674,0 12.2312114,58.2020650,0 12.2311909,58.2020626,0 12.2311705,58.2020602,0 12.2311500,58.2020578,0 12.2311296,58.2020555,0 12.2311091,58.2020531,0 12.2310887,58.2020507,0 12.2310682,58.2020483,0 12.2310478,58.2020459,0 12.2310273,58.2020435,0 12.2310069,58.2020411,0 12.2309864,58.2020388,0 12.2309660,58.2020364,0 12.2309455,58.2020340,0 12.2309251,58.2020316,0 12.2309046,58.2020292,0 12.2308842,58.2020268,0 12.2308637,58.2020245,0 12.2308433,58.2020221,0 12.2308228,58.2020197,0 12.2308024,58.2020173,0 12.2307819,58.2020149,0 12.2307614,58.2020125,0 12.2307410,58.2020102,0 12.2307205,58.2020078,0 12.2307001,58.2020054,0 12.2306796,58.2020030,0 12.2306592,58.2020006,0 12.2306387,58.2019982,0 12.2306183,58.2019958,0 12.2305978,58.2019935,0 12.2305774,58.2019911,0 12.2305569,58.2019887,0 12.2305365,58.2019863,0 12.2305160,58.2019839,0 12.2304956,58.2019815,0 12.2304751,58.2019792,0 12.2304547,58.2019768,0 12.2304342,58.2019744,0 12.2304138,58.2019720,0 12.2303933,58.2019696,0 12.2303729,58.2019672,0 12.2303524,58.2019649,0 12.2303320,58.2019625,0 12.2303115,58.2019601,0 12.2302911,58.2019577,0 12.2302706,58.2019553,0 12.2302502,58.2019529,0 12.2302297,58.2019506,0 12.2302093,58.2019482,0 12.2301888,58.2019458,0 12.2301684,58.2019434,0 12.2301479,58.2019410,0 12.2301274,58.2019386,0 12.2301070,58.2019362,0 12.2300865,58.2019339,0 12.2300661,58.2019315,0 12.2300456,58.2019291,0 12.2300252,58.2019267,0 12.2300047,58.2019243,0 12.2299843,58.2019219,0 12.2299638,58.2019196,0 12.2299434,58.2019172,0 12.2299229,58.2019148,0 12.2299025,58.2019124,0 12.2298820,58.2019100,0 12.2298616,58.2019076,0 12.2298411,58.2019053,0 12.2298207,58.2019029,0 12.2298002,58.2019005,0 12.2298006,58.2018880,0 12.2298009,58.2018756,0 12.2298012,58.2018631,0 12.2298016,58.2018507,0 12.2298019,58.2018382,0 12.2298022,58.2018257,0 12.2298026,58.2018133,0 12.2298029,58.2018008,0 12.2298032,58.2017884,0 12.2298036,58.2017759,0 12.2298039,58.2017635,0 12.2298042,58.2017510,0 12.2298046,58.2017385,0 12.2298049,58.2017261,0 12.2298053,58.2017136,0 12.2298056,58.2017012,0 12.2298059,58.2016887,0 12.2298063,58.2016762,0 12.2298066,58.2016638,0 12.2298069,58.2016513,0 12.2298073,58.2016389,0 12.2298076,58.2016264,0 12.2298079,58.2016140,0 12.2298083,58.2016015,0 12.2298086,58.2015890,0 12.2298089,58.2015766,0 12.2298093,58.2015641,0 12.2298096,58.2015517,0 12.2298099,58.2015392,0 12.2298103,58.2015268,0 12.2298106,58.2015143,0 12.2298110,58.2015018,0 12.2298113,58.2014894,0 12.2298116,58.2014769,0 12.2298120,58.2014645,0 12.2298123,58.2014520,0 12.2298126,58.2014396,0 12.2298130,58.2014271,0 12.2298133,58.2014146,0 12.2298136,58.2014022,0 12.2298140,58.2013897,0 12.2298143,58.2013773,0 12.2298146,58.2013648,0 12.2298150,58.2013524,0 12.2298153,58.2013399,0 12.2298156,58.2013274,0 12.2298160,58.2013150,0 12.2298163,58.2013025,0 12.2298167,58.2012901,0 12.2298170,58.2012776,0 12.2298173,58.2012652,0 12.2298177,58.2012527,0 12.2298180,58.2012402,0 12.2298183,58.2012278,0 12.2298187,58.2012153,0 12.2298190,58.2012029,0 12.2298193,58.2011904,0 12.2298197,58.2011780,0 12.2298200,58.2011655,0 12.2298203,58.2011530,0 12.2298207,58.2011406,0 12.2298210,58.2011281,0 12.2298213,58.2011157,0 12.2298217,58.2011032,0 12.2298220,58.2010908,0 12.2298224,58.2010783,0 12.2298227,58.2010658,0 12.2298230,58.2010534,0 12.2298234,58.2010409,0 12.2298237,58.2010285,0 12.2298240,58.2010160,0 12.2298244,58.2010036,0 12.2298247,58.2009911,0 12.2298250,58.2009786,0 12.2298254,58.2009662,0 12.2298257,58.2009537,0 12.2298260,58.2009413,0 12.2298264,58.2009288,0 12.2298267,58.2009163,0 12.2298270,58.2009039,0 12.2298274,58.2008914,0 12.2298277,58.2008790,0 12.2298281,58.2008665,0 12.2298284,58.2008541,0 12.2298287,58.2008416,0 12.2298291,58.2008291,0 12.2298294,58.2008167,0 12.2298297,58.2008042,0 12.2298301,58.2007918,0 12.2298304,58.2007793,0 12.2298307,58.2007669,0 12.2298311,58.2007544,0 12.2298314,58.2007419,0 12.2298317,58.2007295,0 12.2298321,58.2007170,0 12.2298324,58.2007046,0 12.2298327,58.2006921,0 12.2298331,58.2006797,0 12.2298334,58.2006672,0 12.2298338,58.2006547,0 12.2298341,58.2006423,0 12.2298344,58.2006298,0 12.2298348,58.2006174,0 12.2298351,58.2006049,0 12.2298354,58.2005925,0 12.2298358,58.2005800,0 12.2298361,58.2005675,0 12.2298364,58.2005551,0 12.2298368,58.2005426,0 12.2298371,58.2005302,0 12.2298374,58.2005177,0 12.2298378,58.2005053,0 12.2298381,58.2004928,0 12.2298384,58.2004803,0 12.2298388,58.2004679,0 12.2298391,58.2004554,0 12.2298395,58.2004430,0 12.2298398,58.2004305,0 12.2298401,58.2004181,0 12.2298405,58.2004056,0 12.2298408,58.2003931,0 12.2298411,58.2003807,0 12.2298415,58.2003682,0 12.2298418,58.2003558,0 12.2298421,58.2003433,0 12.2298425,58.2003309,0 12.2298428,58.2003184,0 12.2298431,58.2003059,0 12.2298435,58.2002935,0 12.2298438,58.2002810,0 12.2298441,58.2002686,0 12.2298445,58.2002561,0 12.2298448,58.2002437,0 12.2298452,58.2002312,0 12.2298455,58.2002187,0 12.2298458,58.2002063,0 12.2298462,58.2001938,0 12.2298465,58.2001814,0 12.2298468,58.2001689,0 12.2298472,58.2001565,0 12.2298475,58.2001440,0 12.2298478,58.2001315,0 12.2298482,58.2001191,0 12.2298485,58.2001066,0 12.2298488,58.2000942,0 12.2298492,58.2000817,0 12.2298495,58.2000692,0 12.2298498,58.2000568,0 12.2298502,58.2000443,0 12.2298505,58.2000319,0 12.2298509,58.2000194,0 12.2298512,58.2000070,0 12.2298515,58.1999945,0 12.2298519,58.1999820,0 12.2298522,58.1999696,0 12.2298525,58.1999571,0 12.2298529,58.1999447,0 12.2298532,58.1999322,0 12.2298535,58.1999198,0 12.2298539,58.1999073,0 12.2298542,58.1998948,0 12.2298545,58.1998824,0 12.2298549,58.1998699,0 12.2298552,58.1998575,0 12.2298555,58.1998450,0 12.2298559,58.1998326,0 12.2298562,58.1998201,0 12.2298566,58.1998076,0 12.2298569,58.1997952,0 12.2298572,58.1997827,0 12.2298576,58.1997703,0 12.2298579,58.1997578,0 12.2298582,58.1997454,0 12.2298586,58.1997329,0 12.2298589,58.1997204,0 12.2298592,58.1997080,0 12.2298596,58.1996955,0 12.2298599,58.1996831,0 12.2298602,58.1996706,0 12.2298606,58.1996582,0 12.2298609,58.1996457,0 12.2298612,58.1996332,0 12.2298616,58.1996208,0 12.2298619,58.1996083,0 12.2298623,58.1995959,0 12.2298626,58.1995834,0 12.2298629,58.1995710,0 12.2298633,58.1995585,0 12.2298636,58.1995460,0 12.2298639,58.1995336,0 12.2298643,58.1995211,0 12.2298646,58.1995087,0 12.2298649,58.1994962,0 12.2298653,58.1994838,0 12.2298656,58.1994713,0 12.2298659,58.1994588,0 12.2298663,58.1994464,0 12.2298666,58.1994339,0 12.2298669,58.1994215,0 12.2298673,58.1994090,0 12.2298676,58.1993966,0 12.2298680,58.1993841,0 12.2298683,58.1993716,0 12.2298686,58.1993592,0 12.2298690,58.1993467,0 12.2298693,58.1993343,0 12.2298696,58.1993218,0 12.2298700,58.1993093,0 12.2298703,58.1992969,0 12.2298706,58.1992844,0 12.2298710,58.1992720,0 12.2298713,58.1992595,0 12.2298716,58.1992471,0 12.2298720,58.1992346,0 12.2298723,58.1992221,0 12.2298726,58.1992097,0 12.2298730,58.1991972,0 12.2298733,58.1991848,0 12.2298737,58.1991723,0 12.2298740,58.1991599,0 12.2298743,58.1991474,0 12.2298747,58.1991349,0 12.2298750,58.1991225,0 12.2298753,58.1991100,0 12.2298757,58.1990976,0 12.2298760,58.1990851,0 12.2298763,58.1990727,0 12.2298767,58.1990602,0 12.2298770,58.1990477,0 12.2298773,58.1990353,0 12.2298777,58.1990228,0 12.2298780,58.1990104,0 12.2298783,58.1989979,0 12.2298787,58.1989855,0 12.2298790,58.1989730,0 12.2298794,58.1989605,0 12.2298797,58.1989481,0 12.2298800,58.1989356,0 12.2298804,58.1989232,0 12.2298807,58.1989107,0 12.2298810,58.1988983,0 12.2298814,58.1988858,0 12.2298817,58.1988733,0 12.2298820,58.1988609,0 12.2298824,58.1988484,0 12.2298827,58.1988360,0 12.2298830,58.1988235,0 12.2298834,58.1988111,0 12.2298837,58.1987986,0 12.2298840,58.1987861,0 12.2298844,58.1987737,0 12.2298847,58.1987612,0 12.2298850,58.1987488,0 12.2298854,58.1987363,0 12.2298857,58.1987239,0 12.2298861,58.1987114,0 12.2299089,58.1987118,0 12.2299317,58.1987121,0 12.2299545,58.1987125,0 12.2299772,58.1987128,0 12.2300000,58.1987132,0 12.2300228,58.1987135,0 12.2300456,58.1987139,0 12.2300684,58.1987143,0 12.2300912,58.1987146,0 12.2301140,58.1987150,0 12.2301368,58.1987153,0 12.2301596,58.1987157,0 12.2301824,58.1987160,0 12.2302052,58.1987164,0 12.2302280,58.1987168,0 12.2302508,58.1987171,0 12.2302736,58.1987175,0 12.2302964,58.1987178,0 12.2303192,58.1987182,0 12.2303420,58.1987185,0 12.2303648,58.1987189,0 12.2303876,58.1987193,0 12.2304104,58.1987196,0 12.2304332,58.1987200,0 12.2304560,58.1987203,0 12.2304788,58.1987207,0 12.2305016,58.1987211,0 12.2305244,58.1987214,0 12.2305472,58.1987218,0 12.2305700,58.1987221,0 12.2305928,58.1987225,0 12.2306156,58.1987228,0 12.2306384,58.1987232,0 12.2306612,58.1987236,0 12.2306840,58.1987239,0 12.2307068,58.1987243,0 12.2307296,58.1987246,0 12.2307524,58.1987250,0 12.2307752,58.1987253,0 12.2307980,58.1987257,0 12.2308208,58.1987261,0 12.2308436,58.1987264,0 12.2308664,58.1987268,0 12.2308892,58.1987271,0 12.2309120,58.1987275,0 12.2309348,58.1987278,0 12.2309576,58.1987282,0 12.2309804,58.1987286,0 12.2310032,58.1987289,0 12.2310260,58.1987293,0 12.2310488,58.1987296,0 12.2310716,58.1987300,0 12.2310944,58.1987303,0 12.2311172,58.1987307,0 12.2311400,58.1987311,0 12.2311628,58.1987314,0 12.2311856,58.1987318,0 12.2312084,58.1987321,0 12.2312312,58.1987325,0 12.2312540,58.1987329,0 12.2312768,58.1987332,0 12.2312996,58.1987336,0 12.2313224,58.1987339,0 12.2313452,58.1987343,0 12.2313680,58.1987346,0 12.2313908,58.1987350,0 12.2314136,58.1987354,0 12.2314364,58.1987357,0 12.2314592,58.1987361,0 12.2314820,58.1987364,0 12.2315048,58.1987368,0 12.2315276,58.1987371,0 12.2315504,58.1987375,0 12.2315732,58.1987379,0 12.2315960,58.1987382,0 12.2316188,58.1987386,0 12.2316416,58.1987389,0 12.2316644,58.1987393,0 12.2316872,58.1987396,0 12.2317100,58.1987400,0 12.2317328,58.1987404,0 12.2317556,58.1987407,0 12.2317784,58.1987411,0 12.2318011,58.1987414,0 12.2318239,58.1987418,0 12.2318467,58.1987422,0 12.2318695,58.1987425,0 12.2318923,58.1987429,0 12.2319151,58.1987432,0 12.2319379,58.1987436,0 12.2319607,58.1987439,0 12.2319835,58.1987443,0 12.2320063,58.1987447,0 12.2320291,58.1987450,0 12.2320519,58.1987454,0 12.2320747,58.1987457,0 12.2320975,58.1987461,0 12.2321203,58.1987464,0 12.2321431,58.1987468,0 12.2321659,58.1987472,0 12.2321887,58.1987475,0 12.2322115,58.1987479,0 12.2322343,58.1987482,0 12.2322571,58.1987486,0 12.2322799,58.1987489,0 12.2323027,58.1987493,0 12.2323255,58.1987497,0 12.2323483,58.1987500,0 12.2323711,58.1987504,0 12.2323939,58.1987507,0 12.2324167,58.1987511,0 12.2324395,58.1987514,0 12.2324623,58.1987518,0 12.2324851,58.1987522,0 12.2325079,58.1987525,0 12.2325307,58.1987529,0 12.2325535,58.1987532,0 12.2325763,58.1987536,0 12.2325991,58.1987540,0 12.2326219,58.1987543,0 12.2326447,58.1987547,0 12.2326675,58.1987550,0 12.2326903,58.1987554,0 12.2327131,58.1987557,0 12.2327359,58.1987561,0 12.2327587,58.1987565,0 12.2327815,58.1987568,0 12.2328043,58.1987572,0 12.2328271,58.1987575,0 12.2328499,58.1987579,0 12.2328727,58.1987582,0 12.2328955,58.1987586,0 12.2329183,58.1987590,0 12.2329411,58.1987593,0 12.2329639,58.1987597,0 12.2329867,58.1987600,0 12.2330095,58.1987604,0 12.2330323,58.1987607,0 12.2330551,58.1987611,0 12.2330779,58.1987615,0 12.2331007,58.1987618,0 12.2331235,58.1987622,0 12.2331463,58.1987625,0 12.2331691,58.1987629,0 12.2331919,58.1987633,0 12.2332147,58.1987636,0 12.2332375,58.1987640,0 12.2332603,58.1987643,0 12.2332831,58.1987647,0 12.2333059,58.1987650,0 12.2333287,58.1987654,0 12.2333515,58.1987658,0 12.2333743,58.1987661,0 12.2333971,58.1987665,0 12.2334199,58.1987668,0 12.2334427,58.1987672,0 12.2334655,58.1987675,0 12.2334883,58.1987679,0 12.2335111,58.1987683,0 12.2335339,58.1987686,0 12.2335567,58.1987690,0 12.2335795,58.1987693,0 12.2336023,58.1987697,0 12.2336251,58.1987700,0 12.2336478,58.1987704,0 12.2336706,58.1987708,0 12.2336934,58.1987711,0 12.2337162,58.1987715,0 12.2337390,58.1987718,0 12.2337618,58.1987722,0 12.2337846,58.1987725,0 12.2338074,58.1987729,0 12.2338302,58.1987733,0 12.2338530,58.1987736,0 12.2338758,58.1987740,0 12.2338986,58.1987743,0 12.2339214,58.1987747,0 12.2339442,58.1987751,0 12.2339670,58.1987754,0 12.2339898,58.1987758,0 12.2340126,58.1987761,0 12.2340354,58.1987765,0 12.2340582,58.1987768,0 12.2340810,58.1987772,0 12.2341038,58.1987776,0 12.2341266,58.1987779,0 12.2341494,58.1987783,0 12.2341722,58.1987786,0 12.2341950,58.1987790,0 12.2342178,58.1987793,0 12.2342406,58.1987797,0 12.2342634,58.1987801,0 12.2342862,58.1987804,0 12.2343090,58.1987808,0 12.2343318,58.1987811,0 12.2343546,58.1987815,0 12.2343774,58.1987818,0 12.2344002,58.1987822,0 12.2344230,58.1987826,0 12.2344458,58.1987829,0 12.2344686,58.1987833,0 12.2344914,58.1987836,0 12.2345142,58.1987840,0 12.2345370,58.1987844,0 12.2345598,58.1987847,0 12.2345826,58.1987851,0 12.2346054,58.1987854,0 12.2346282,58.1987858,0 12.2346510,58.1987861,0 12.2346738,58.1987865,0 12.2346966,58.1987869,0 12.2347194,58.1987872,0 12.2347422,58.1987876,0 12.2347650,58.1987879,0 12.2347878,58.1987883,0 12.2348106,58.1987886,0 12.2348334,58.1987890,0 12.2348562,58.1987894,0 12.2348790,58.1987897,0 12.2349018,58.1987901,0 12.2349246,58.1987904,0 12.2349474,58.1987908,0 12.2349702,58.1987911,0 12.2349930,58.1987915,0 12.2350158,58.1987919,0 12.2350386,58.1987922,0 12.2350614,58.1987926,0 12.2350842,58.1987929,0 12.2351070,58.1987933,0 12.2351298,58.1987936,0 12.2351526,58.1987940,0 12.2351754,58.1987944,0 12.2351982,58.1987947,0 12.2352210,58.1987951,0 12.2352438,58.1987954,0 12.2352666,58.1987958,0 12.2352894,58.1987962,0 12.2353122,58.1987965,0 12.2353350,58.1987969,0 12.2353578,58.1987972,0 12.2353806,58.1987976,0 12.2354034,58.1987979,0 12.2354262,58.1987983,0 12.2354490,58.1987987,0 12.2354718,58.1987990,0 12.2354946,58.1987994,0 12.2355174,58.1987997,0 12.2355402,58.1988001,0 12.2355629,58.1988004,0 12.2355857,58.1988008,0 12.2356085,58.1988012,0 12.2356313,58.1988015,0 12.2356541,58.1988019,0 12.2356769,58.1988022,0 12.2356997,58.1988026,0 12.2357225,58.1988029,0 12.2357199,58.1988174,0 12.2357172,58.1988319,0 12.2357145,58.1988464,0 12.2357118,58.1988609,0 12.2357091,58.1988754,0 12.2357065,58.1988899,0 12.2357038,58.1989043,0 12.2357011,58.1989188,0 12.2356984,58.1989333,0 12.2356957,58.1989478,0 12.2356930,58.1989623,0 12.2356904,58.1989768,0 12.2356877,58.1989912,0 12.2356850,58.1990057,0 12.2356823,58.1990202,0 12.2356796,58.1990347,0 12.2356769,58.1990492,0 12.2356743,58.1990637,0 12.2356716,58.1990781,0 12.2356689,58.1990926,0 12.2356662,58.1991071,0 12.2356635,58.1991216,0 12.2356609,58.1991361,0 12.2356582,58.1991506,0 12.2356555,58.1991650,0 12.2356528,58.1991795,0 12.2356501,58.1991940,0 12.2356474,58.1992085,0 12.2356448,58.1992230,0 12.2356421,58.1992375,0 12.2356394,58.1992519,0 12.2356367,58.1992664,0 12.2356340,58.1992809,0 12.2356314,58.1992954,0 12.2356287,58.1993099,0 12.2356260,58.1993244,0 12.2356233,58.1993389,0 12.2356206,58.1993533,0 12.2356179,58.1993678,0 12.2356153,58.1993823,0 12.2356126,58.1993968,0 12.2356099,58.1994113,0 12.2356072,58.1994258,0 12.2356045,58.1994402,0 12.2356019,58.1994547,0 12.2355992,58.1994692,0 12.2355965,58.1994837,0 12.2355938,58.1994982,0 12.2355911,58.1995127,0 12.2355884,58.1995271,0 12.2355858,58.1995416,0 12.2355831,58.1995561,0 12.2355804,58.1995706,0 12.2355777,58.1995851,0 12.2355750,58.1995996,0 12.2355724,58.1996140,0 12.2355697,58.1996285,0 12.2355670,58.1996430,0 12.2355643,58.1996575,0 12.2355616,58.1996720,0 12.2355589,58.1996865,0 12.2355563,58.1997010,0 12.2355536,58.1997154,0 12.2355509,58.1997299,0 12.2355482,58.1997444,0 12.2355455,58.1997589,0 12.2355428,58.1997734,0 12.2355402,58.1997879,0 12.2355375,58.1998023,0 12.2355348,58.1998168,0 12.2355321,58.1998313,0 12.2355294,58.1998458,0 12.2355268,58.1998603,0 12.2355241,58.1998748,0 12.2355214,58.1998892,0 12.2355187,58.1999037,0 12.2355160,58.1999182,0 12.2355133,58.1999327,0 12.2355107,58.1999472,0 12.2355080,58.1999617,0 12.2355053,58.1999761,0 12.2355026,58.1999906,0 12.2354999,58.2000051,0 12.2354973,58.2000196,0 12.2354946,58.2000341,0 12.2354919,58.2000486,0 12.2354892,58.2000630,0 12.2354865,58.2000775,0 12.2354838,58.2000920,0 12.2354812,58.2001065,0 12.2354785,58.2001210,0 12.2354758,58.2001355,0 12.2354731,58.2001500,0 12.2354704,58.2001644,0 12.2354677,58.2001789,0 12.2354651,58.2001934,0 12.2354624,58.2002079,0 12.2354597,58.2002224,0 12.2354570,58.2002369,0 12.2354543,58.2002513,0 12.2354517,58.2002658,0 12.2354490,58.2002803,0 12.2354463,58.2002948,0 12.2354436,58.2003093,0 12.2354409,58.2003238,0 12.2354382,58.2003382,0 12.2354356,58.2003527,0 12.2354329,58.2003672,0 12.2354302,58.2003817,0 12.2354275,58.2003962,0 12.2354248,58.2004107,0 12.2354222,58.2004251,0 12.2354195,58.2004396,0 12.2354168,58.2004541,0 12.2354141,58.2004686,0 12.2354114,58.2004831,0 12.2354087,58.2004976,0 12.2354061,58.2005121,0 12.2354034,58.2005265,0 12.2354007,58.2005410,0 12.2353980,58.2005555,0 12.2353953,58.2005700,0 12.2353926,58.2005845,0 12.2353900,58.2005990,0 12.2353873,58.2006134,0 12.2353846,58.2006279,0 12.2353819,58.2006424,0 12.2353792,58.2006569,0 12.2353766,58.2006714,0 12.2353739,58.2006859,0 12.2353712,58.2007003,0 12.2353685,58.2007148,0 12.2353658,58.2007293,0 12.2353631,58.2007438,0 12.2353605,58.2007583,0 12.2353578,58.2007728,0 12.2353551,58.2007872,0 12.2353524,58.2008017,0 12.2353497,58.2008162,0 12.2353471,58.2008307,0 12.2353444,58.2008452,0 12.2353417,58.2008597,0 12.2353390,58.2008741,0 12.2353363,58.2008886,0 12.2353336,58.2009031,0 12.2353310,58.2009176,0 12.2353283,58.2009321,0 12.2353256,58.2009466,0 12.2353229,58.2009611,0 12.2353202,58.2009755,0 12.2353175,58.2009900,0 12.2353149,58.2010045,0 12.2353122,58.2010190,0 12.2353095,58.2010335,0 12.2353068,58.2010480,0 12.2353041,58.2010624,0 12.2353015,58.2010769,0 12.2352988,58.2010914,0 12.2352961,58.2011059,0 12.2352934,58.2011204,0 12.2352907,58.2011349,0 12.2352880,58.2011493,0 12.2352854,58.2011638,0 12.2352827,58.2011783,0 12.2352800,58.2011928,0 12.2352773,58.2012073,0 12.2352746,58.2012218,0 12.2352719,58.2012362,0 12.2352693,58.2012507,0 12.2352666,58.2012652,0 12.2352639,58.2012797,0 12.2352612,58.2012942,0 12.2352585,58.2013087,0 12.2352559,58.2013232,0 12.2352532,58.2013376,0 12.2352505,58.2013521,0 12.2352478,58.2013666,0 12.2352451,58.2013811,0 12.2352424,58.2013956,0 12.2352398,58.2014101,0 12.2352371,58.2014245,0 12.2352344,58.2014390,0 12.2352317,58.2014535,0 12.2352290,58.2014680,0 12.2352263,58.2014825,0 12.2352237,58.2014970,0 12.2352210,58.2015114,0 12.2352183,58.2015259,0 12.2352156,58.2015404,0 12.2352129,58.2015549,0 12.2352103,58.2015694,0 12.2352076,58.2015839,0 12.2352049,58.2015983,0 12.2352022,58.2016128,0 12.2351995,58.2016273,0 12.2351968,58.2016418,0 12.2351942,58.2016563,0 12.2351915,58.2016708,0 12.2351888,58.2016852,0 12.2351861,58.2016997,0 12.2351834,58.2017142,0 12.2351807,58.2017287,0 12.2351781,58.2017432,0 12.2351754,58.2017577,0 12.2351727,58.2017722,0 12.2351700,58.2017866,0 12.2351673,58.2018011,0 12.2351647,58.2018156,0 12.2351620,58.2018301,0 12.2351593,58.2018446,0 12.2351566,58.2018591,0 12.2351539,58.2018735,0 12.2351512,58.2018880,0 12.2351486,58.2019025,0 12.2351459,58.2019170,0 12.2351432,58.2019315,0 12.2351405,58.2019460,0 12.2351378,58.2019604,0 12.2351351,58.2019749,0 12.2351325,58.2019894,0 12.2351298,58.2020039,0 12.2351271,58.2020184,0 12.2351244,58.2020329,0 12.2351217,58.2020473,0 12.2351191,58.2020618,0 12.2351164,58.2020763,0 12.2351137,58.2020908,0 12.2351110,58.2021053,0 12.2351083,58.2021198,0 12.2351056,58.2021343,0 12.2351030,58.2021487,0 12.2351003,58.2021632,0 12.2350976,58.2021777,0 12.2350949,58.2021922,0 12.2350922,58.2022067,0 12.2350895,58.2022212,0 12.2350869,58.2022356,0 12.2350842,58.2022501,0 12.2350815,58.2022646,0 12.2350788,58.2022791,0 12.2350761,58.2022936,0 12.2350735,58.2023081,0 12.2350708,58.2023225,0 12.2350681,58.2023370,0 12.2350654,58.2023515,0 12.2350627,58.2023660,0 12.2350600,58.2023805,0 12.2350574,58.2023950,0 12.2350547,58.2024094,0 12.2350520,58.2024239,0 12.2350493,58.2024384,0 12.2350466,58.2024529,0 12.2350439,58.2024674,0 12.2350413,58.2024819,0 12.2350386,58.2024963,0 12.2350359,58.2025108,0 </coordinates>
                  </LinearRing>
               </outerBoundaryIs>
            </Polygon>
         </Placemark>
      </Folder>
      <Folder>
         <name>AB_Lines</name>
         <visibility>0</visibility>
      </Folder>
      <Folder>
         <name>Curve_Lines</name>
         <visibility>0</visibility>
      </Folder>
      <Folder>
         <name>Recorded Path</name>
         <visibility>1</visibility>
         <Placemark>
            <visibility>1</visibility>
            <name>Path 1</name>
            <Style>
               <LineStyle>
                  <color>ff44ffff</color>
                  <width>2</width>
               </LineStyle>
            </Style>
            <LineString>
               <tessellate>1</tessellate>
               <coordinates></coordinates>
            </LineString>
         </Placemark>
      </Folder>
      <Folder>
         <name>Flags</name>
      </Folder>
      <Folder>
         <name>Sections</name>
      </Folder>
   </Document>
</kml>
4 Likes

This looks fun… :slight_smile:

Thanks for sharing the KML. I tried importing myself via the “Import geometry from uploaded files” and got the same error. The log message is the following, looks like it may just be invalid geometry data:

Exception: IllegalArgumentException: Points of LinearRing do not form a closed linestring in GEOSWKBReader->readHEX() (line 150 of /app/vendor/itamair/geophp/lib/geometry/Geometry.class.php).

It might be a bug from the software that is generating this KML. It would be nice if we could surface GeoPHP error messages like this to user.

I wonder if this might be the same or similar issue? Also interesting that it works in Google Earth. I wonder if they just “close” the linear ring automatically or something.

3 Likes

:100: Agreed! I wonder if we can catch those in our current code easily…

I just had it open to refresh when I saw your reply @paul121 :slight_smile:

2 Likes

:thinking:Maybe I do something wrong in AOG…

1 Like

Propably a bug with outer boundary not closing

1 Like

@mstenta @paul121

I guess it’s easy to upload the kml with the API.
But when I do this in the GUI, I have to “Import geometry from uploaded files”

Will that button have to be pushed manually for every log?
Can it be triggered from the API?

1 Like

Closing the boundary in Google Earth makes the KML importable :+1:

1 Like

No that button is only a UI feature. The difficulty in automating it via the API is we can’t know when you want to do that vs when you don’t.

The better approach is to leave that up to the application pushing to the API. You can set the geometry of the log directly when you push it via the API. It’s up to you to convert that from KML to WKT though. Although maybe you could try pushing KML directly to the geometry field… IIRC that actually works via the UI, and it converts it to WKT automatically.

Worth noting that conversion of KML to WKT is a lossy process! If there is other information stored in the KML beyond just the geometries, that will not be preserved in WKT.

Yea curious… if AgOpenGPS is creating this KML file, and they are designating that shape as a Polygon, then it is a bug in AgOpenGPS. Polygons must be closed according to WKT spec.

Do they have an issue queue? Might be worth raising this to their attention.

1 Like

Thanks for clarifying.
I’ll see what I can do

2 Likes

Adding the first coordinate to the end of the polygon closes it, and I can import it without errors.

The KML-import, does it use any library I can use in Node-Red?
Or does anyone know of some libraries?

3 Likes

I’m making progress and learning a few things on the way.

The KML may consist of some single points (flags).

Can the name of the flag be shown in the farmOS map too?
And can I set separate color for the geometries?

1 Like

Internally farmOS uses the GeoPHP library in most contexts, but the bulk KML importer/exporter is a little more custom. I think you will need to find a JavaScript library for Node Red.

The only way to do that in farmOS right now is to create a separate asset/log for each geometry/flag point. Assets and logs only store a single geometry.

It could be possible to build a module that uses a KML file as the “dataset” for rendering on the map, rather than the farmOS database, but that would take some work, and would probably end up being somewhat bespoke…

KML files can almost be thought of as their own self-contained database. Where a KML file organizes things into “Placemarks”, farmOS organizes them into “Assets”.

I could see some value in providing options in farmOS for storing smaller pieces of information (instead of full-blown assets). It reminds me of this idea: https://www.drupal.org/project/farm/issues/3175030

1 Like

It’s a great project @pat,
I agree with @mstenta, if you can’t find node-red nodes, JS libraries would be a close second and can be imported with function nodes. Obviously it makes the project a little less ‘low code’ but might not be too bad.

2 Likes

Thanks.

Good to know.

:+1:

I had GPT help with the code, and came up with this.
It gives a valid WKT I can paste into the geometry field of the log.

function kmlPointsToWKT(kmlData) {
    const placemarks = kmlData.Placemark || [];

    if (placemarks.length === 0) {
        return null;  // Ingen punkter å behandle
    }

    const wktPoints = placemarks.map(placemark => {
        const coordinates = placemark.Point[0].coordinates[0].split(',').map(coord => parseFloat(coord));
        return `POINT(${coordinates[0]} ${coordinates[1]})`;
    });

    return `GEOMETRYCOLLECTION(${wktPoints.join(',')})`;
}

// Eksempel på bruk:
const kmlData = msg.payload.kml.Document[0].Folder[5];
const wktResult = kmlPointsToWKT(kmlData);

msg.payload = wktResult;

return msg;

3 Likes

Wohaha!!!
Boundary, flags, and applied area. Just copy/paste from output of node-red yest, but the rest is easy peasy.

A little hard to tell what is applied or not without fill color. But it’s still pretty cool.

Flags are missing names, but the flag names can be added to the log note. That would at least give a clue about what the points represent…

That should wrap up this topic.

4 Likes