<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Export graphics to KML/KMZ in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826952#M7912</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone tried exporting graphics created in the drawing widget for WAB 1.1 to KMZ or KML?&lt;/P&gt;&lt;P&gt;Should this happen server-side or is it possible within the javascript?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any feedback would be wonderful!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;George&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Apr 2015 15:47:27 GMT</pubDate>
    <dc:creator>GeorgeOulton1</dc:creator>
    <dc:date>2015-04-09T15:47:27Z</dc:date>
    <item>
      <title>Export graphics to KML/KMZ</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826952#M7912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone tried exporting graphics created in the drawing widget for WAB 1.1 to KMZ or KML?&lt;/P&gt;&lt;P&gt;Should this happen server-side or is it possible within the javascript?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any feedback would be wonderful!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;George&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2015 15:47:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826952#M7912</guid>
      <dc:creator>GeorgeOulton1</dc:creator>
      <dc:date>2015-04-09T15:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Export graphics to KML/KMZ</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826953#M7913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could do this client side you would just need to write a javascript function that converts the graphics into KML. Check out the &lt;A href="https://developers.google.com/kml/documentation/" title="https://developers.google.com/kml/documentation/"&gt;KML Documentation Introduction&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would need to convert the ESRI graphic geometry object into the equivalent KML geometry:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;ESRI Point - KML Point&lt;/LI&gt;&lt;LI&gt;ESRI Polyline (path) - KML LineString&lt;/LI&gt;&lt;LI&gt;ESRI Polygon - KML Polygon&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2015 21:54:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826953#M7913</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2015-04-09T21:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Export graphics to KML/KMZ</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826954#M7914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply Owen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was hoping to have it run along those lines, but my point of confusion is around the drawbox dijit. It seems all the graphics are added there and not to a graphics layer and I'm not too sure on how the drawbox works, is it like a graphics layer?.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UPDATE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see, I can inherit the map and get the current graphics layer from the map and then work from there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2015 22:20:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826954#M7914</guid>
      <dc:creator>GeorgeOulton1</dc:creator>
      <dc:date>2015-04-09T22:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Export graphics to KML/KMZ</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826955#M7915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi George,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The drawBox dijit use a graphic layer.&lt;/P&gt;&lt;P&gt;You can access the graphicLayer in the draw widget with :&lt;/P&gt;&lt;P&gt;this.drawBox.drawLayer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you could add your kmz export functionnality to the non-official eDraw widget&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/magis-nc/esri-webappbuilder-widget-eDraw" title="https://github.com/magis-nc/esri-webappbuilder-widget-eDraw"&gt;magis-nc/esri-webappbuilder-widget-eDraw · GitHub&lt;/A&gt; &lt;/P&gt;&lt;P&gt;This widget has allready a "json export/import" functionnality.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Apr 2015 22:56:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826955#M7915</guid>
      <dc:creator>JeremieCornet1</dc:creator>
      <dc:date>2015-04-09T22:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Export graphics to KML/KMZ</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826956#M7916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I know this is a very old post, but did anybody have success adding kml/kmz export functionality to the draw (or eDraw) widget?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Sep 2019 17:10:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826956#M7916</guid>
      <dc:creator>TylerArmstrong</dc:creator>
      <dc:date>2019-09-18T17:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: Export graphics to KML/KMZ</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826957#M7917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;I added export tool in the draw widget, at client side.&lt;BR /&gt;Because my maps aren't in WGS84, I needed to use&amp;nbsp;'esri/geometry/projection'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's perhaps not so optimal if there are very much graphics, but in my case the drawings done with Draw widget are not so many.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I'm looping in&amp;nbsp;this._graphicsLayer.graphics and I construct the KML as a string, based on the specification and analyzing ...geometry.geoType in order to create Point, LineString or Polygon objects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;kmlContent = kmlContent &lt;BR /&gt; + " &amp;lt;name&amp;gt;" + graphics&lt;I&gt;.attributes.OBJECTID + "&amp;lt;/name&amp;gt;\r\n"&lt;BR /&gt; + " &amp;lt;styleUrl&amp;gt;#drawing" + (i + 1) + "&amp;lt;/styleUrl&amp;gt;\r\n";&lt;BR /&gt; &lt;BR /&gt; for (var j = 0; j &amp;lt; geometry.paths.length; j++) {&lt;BR /&gt; kmlContent = kmlContent &lt;BR /&gt; + " &amp;lt;LineString&amp;gt;\r\n"&lt;BR /&gt; + " &amp;lt;altitudeMode&amp;gt;clampToGround&amp;lt;/altitudeMode&amp;gt;\r\n"&lt;BR /&gt; + " &amp;lt;coordinates&amp;gt;\r\n";&lt;/I&gt;&lt;/P&gt;&lt;P&gt;for (var k = 1; k &amp;lt; geometry.paths&lt;J&gt;.length; k++) { &lt;BR /&gt; var projPt1 = new Point({ x: geometry.paths&lt;J&gt;[k-1][0], y: geometry.paths&lt;J&gt;[k-1][1], spatialReference: mySpatialReference });&lt;BR /&gt; var projPt2 = new Point({ x: geometry.paths&lt;J&gt;&lt;K&gt;[0], y: geometry.paths&lt;J&gt;&lt;K&gt;[1], spatialReference: &lt;SPAN style="background-color: #f6f6f6;"&gt;my&lt;/SPAN&gt;SpatialReference });&lt;BR /&gt; &lt;BR /&gt; var geoPt1 = projection.project(projPt1, wgsSpatialReference);&lt;BR /&gt; var geoPt2 = projection.project(projPt2, wgsSpatialReference);&lt;BR /&gt; &lt;BR /&gt; kmlContent = kmlContent + " " + geoPt1.x + "," + geoPt1.y + ",0 " &lt;BR /&gt; + geoPt2.x + "," + geoPt2.y + ",0\r\n";&lt;BR /&gt; }&lt;BR /&gt; kmlContent = kmlContent &lt;BR /&gt; + " &amp;lt;/coordinates&amp;gt;\r\n"&lt;BR /&gt; + " &amp;lt;/LineString&amp;gt;\r\n";&lt;BR /&gt; }&lt;/K&gt;&lt;/J&gt;&lt;/K&gt;&lt;/J&gt;&lt;/J&gt;&lt;/J&gt;&lt;/J&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;geometry is this._graphicsLayer.graphics&lt;I&gt;.geometry;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;At the end I use the download function that exists in CSVUtils:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;return CSVUtils._download(filename, kmlContent);&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2020 10:16:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/export-graphics-to-kml-kmz/m-p/826957#M7917</guid>
      <dc:creator>GeoguichetGeoguichet</dc:creator>
      <dc:date>2020-10-12T10:16:03Z</dc:date>
    </item>
  </channel>
</rss>

