<?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 Re: Display KML File in 4.X API in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325947#M30034</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I couldn't find/remember my link because I still had it just on my machine's Localhost.&amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways, I've uploaded it and you can access it here:&amp;nbsp;&lt;A href="https://umpqualsogproject.org/ra32screener/"&gt;https://umpqualsogproject.org/ra32screener/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's an app I've been developing but it's not finished. It's a long story but the&amp;nbsp;part where you upload your KML &lt;STRONG&gt;&lt;EM&gt;should&lt;/EM&gt;&lt;/STRONG&gt; work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Jan 2020 07:24:54 GMT</pubDate>
    <dc:creator>SteveCole</dc:creator>
    <dc:date>2020-01-09T07:24:54Z</dc:date>
    <item>
      <title>Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325938#M30025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to display data from a KML file in a KMLLayer. I found some code at the bottom of this post&amp;nbsp;&lt;A href="https://community.esri.com/thread/158828"&gt;Is it possible to load KML from a file?&lt;/A&gt;, that works for displaying KML files in the 3.x api. Is there something similar that can be done in the 4.x api?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jan 2020 14:25:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325938#M30025</guid>
      <dc:creator>CalebSchwind</dc:creator>
      <dc:date>2020-01-06T14:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325939#M30026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/372855"&gt;Caleb Schwind&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, KMLLayer is supported in the 4.x api since version 4.5:&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-KMLLayer.html" title="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-KMLLayer.html"&gt;KMLLayer | ArcGIS API for JavaScript 4.14&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You might have a look at this sample: &lt;A class="link-titled" href="https://developers.arcgis.com/javascript/latest/sample-code/layers-kml/index.html" title="https://developers.arcgis.com/javascript/latest/sample-code/layers-kml/index.html"&gt;KMLLayer | ArcGIS API for JavaScript 4.14&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Egge-Jan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jan 2020 14:32:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325939#M30026</guid>
      <dc:creator>Egge-Jan_Pollé</dc:creator>
      <dc:date>2020-01-06T14:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325940#M30027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A href="https://community.esri.com/migrated-users/331608"&gt;Egge-Jan Pollé&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sample shows how to load a KMLLayer using a url. Is there a way to display a KMLLayer from local files on the user's machine in 4.x? In my app, I've added the ability for a user to select local files and have them displayed on the map.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jan 2020 14:47:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325940#M30027</guid>
      <dc:creator>CalebSchwind</dc:creator>
      <dc:date>2020-01-06T14:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325941#M30028</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you use &lt;A href="https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL"&gt;URL.createObjectURL&lt;/A&gt; to create a URL to pass to KMLLayer?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 01:02:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325941#M30028</guid>
      <dc:creator>MikeHorn</dc:creator>
      <dc:date>2020-01-07T01:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325942#M30029</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just tried using URL.createObjectURL, but the&amp;nbsp;&lt;A class="link-titled" href="https://utility.arcgis.com/sharing/kml?url=&amp;lt;generatedUrl&amp;gt;" title="https://utility.arcgis.com/sharing/kml?url=&amp;lt;generatedUrl&amp;gt;"&gt;https://utility.arcgis.com/sharing/kml?url=&amp;lt;generatedUrl&amp;gt;&lt;/A&gt;&amp;nbsp;web service ,that is called when the KMLLayer is initialized, immediately returns an "Invalid URL" error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The url that is generated looks like "blob:http://mysite.com/56f7c728-05d6-4fb1-8a4e-0e76714ca57c". If I remove the "blob:" part of the&amp;nbsp;url, then the &lt;A href="https://utility.arcgis.com/sharing/kml"&gt;https://utility.arcgis.com/sharing/kml&lt;/A&gt;&amp;nbsp;service will spin for a while and eventually return a "File not found. Wrong url or out of memory" error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like the web service that supports the KMLLayer rejects any url with something before "http".&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 14:25:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325942#M30029</guid>
      <dc:creator>CalebSchwind</dc:creator>
      <dc:date>2020-01-07T14:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325943#M30030</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can directly call the &lt;A href="https://utility.arcgis.com/sharing/kml"&gt;https://utility.arcgis.com/sharing/kml&lt;/A&gt;&amp;nbsp;web service with the contents of the file that I loaded in, but I don't see any way to make a KMLLayer from the response. When I do this I get the following response:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/477523_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The last post in&amp;nbsp;&lt;A _jive_internal="true" class="" data-containerid="2128" data-containertype="14" data-objectid="158828" data-objecttype="1" href="https://community.esri.com/thread/158828" style="color: #287433; background-color: #ffffff; border: 0px; padding: 1px 0px 1px calc(12px + 0.35ex);"&gt;Is it possible to load KML from a file?&lt;/A&gt;&amp;nbsp;shows how to create the KMLLayer from the above response in the 3.X api, but the KMLLayer in 4.X doesn't have the parameters necessary to use this method.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 14:41:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325943#M30030</guid>
      <dc:creator>CalebSchwind</dc:creator>
      <dc:date>2020-01-07T14:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325944#M30031</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Caleb, I ran into some similar headaches a while back. I wanted to just create a layer from a KML file on the local machine, but the sharing/kml service refused to accept just the kml file contents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you have a back-end that you can add to?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, create 2 REST endpoints. One POST endpoint for uploading the KML file and one GET endpoint for retrieving it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the front-end, the user "opens" the file, which uploads it to the POST endpoint. Then,&amp;nbsp;after a successful upload, use the GET endpoint to provide the url for the kml layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's a little clunky, but it's what I had to do, since the KML service refused to work with anything other than a web-accessible file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2020 22:31:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325944#M30031</guid>
      <dc:creator>CharlieElverson</dc:creator>
      <dc:date>2020-01-07T22:31:10Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325945#M30032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately, I don't have a back-end that I can add to.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2020 12:55:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325945#M30032</guid>
      <dc:creator>CalebSchwind</dc:creator>
      <dc:date>2020-01-08T12:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325946#M30033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do this, but you have to cobble a solution together. I don't have my own link handy at the moment but I'll post the link to a working example tonight.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways, the strategy is to use the File &amp;amp; FileReader API of HTML 5 to allow your user to specify their desired KML file and to read its contents in. The next step is to convert the KML into JSON/geoJSON and then make your JS API map layer from that. There are &lt;A href="https://github.com/mapbox/togeojson#using-it-as-a-console-utility"&gt;JS libraries&lt;/A&gt; that facilitate this conversion.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I will say that the working example I'll share later was written with simple KMLs in mind (a single polygon or several). I don't know how well it might work if the KML files you intend to support are more complex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways, more later..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jan 2020 16:24:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325946#M30033</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2020-01-08T16:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325947#M30034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I couldn't find/remember my link because I still had it just on my machine's Localhost.&amp;nbsp;&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways, I've uploaded it and you can access it here:&amp;nbsp;&lt;A href="https://umpqualsogproject.org/ra32screener/"&gt;https://umpqualsogproject.org/ra32screener/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's an app I've been developing but it's not finished. It's a long story but the&amp;nbsp;part where you upload your KML &lt;STRONG&gt;&lt;EM&gt;should&lt;/EM&gt;&lt;/STRONG&gt; work fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Steve&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2020 07:24:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325947#M30034</guid>
      <dc:creator>SteveCole</dc:creator>
      <dc:date>2020-01-09T07:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Display KML File in 4.X API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325948#M30035</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to get the KML file import working, using this method. Some of my KMLs are more complex, but I think I can&amp;nbsp;use the results from&amp;nbsp;&lt;A class="" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Futility.arcgis.com%2Fsharing%2Fkml" rel="nofollow" style="color: #287433; background-color: #ffffff; border: 0px; text-decoration: none; padding: 0px calc(12px + 0.35ex) 0px 0px;" target="_blank"&gt;https://utility.arcgis.com/sharing/kml&lt;/A&gt;&amp;nbsp;to get what I need that is missing from the kml to geoJSON conversion.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jan 2020 15:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/display-kml-file-in-4-x-api/m-p/325948#M30035</guid>
      <dc:creator>CalebSchwind</dc:creator>
      <dc:date>2020-01-09T15:47:49Z</dc:date>
    </item>
  </channel>
</rss>

