<?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: Is there any way to add KML,KMZ and CSV file from local drive/folder in web app? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660637#M61671</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can add local CSV using this library:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://github.com/WSDOT-GIS/CSV-Reader"&gt;https://github.com/WSDOT-GIS/CSV-Reader&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jun 2014 22:29:00 GMT</pubDate>
    <dc:creator>JeffJacobson</dc:creator>
    <dc:date>2014-06-12T22:29:00Z</dc:date>
    <item>
      <title>Is there any way to add KML,KMZ and CSV file from local drive/folder in web app?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660633#M61667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Though it is mentioned that kml file has to be available publically(or hosted on server),&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am looking for a solution to add kml files only from local drive.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 05:35:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660633#M61667</guid>
      <dc:creator>GauriDeshmukh</dc:creator>
      <dc:date>2014-06-10T05:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to add KML,KMZ and CSV file from local drive/folder in web app?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660634#M61668</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You are right, the KML Layer requires a KML hosted on a URL.&amp;nbsp; So, assuming you have ArcGIS Server, you can get around this...I was able to implement the uploading of KML/KMZ files by publishing a geoprocessing task on my ArcGIS Server.&amp;nbsp; This is basically a Modelbuilder model that takes a KML file and converts it to a feature layer.&amp;nbsp; When published as a GP Service, this feature layer is then available on the server and can be added as a dynamic service layer.&amp;nbsp; Here's what my model looks like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]34470[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use esri/request to upload\retrieve the file from the server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var uploadKml = new esriRequest({
&amp;nbsp;&amp;nbsp; url: config.KML_Conv + "/GPServer/uploads/upload",
&amp;nbsp;&amp;nbsp; form: dom.byId('uploadForm'),
&amp;nbsp;&amp;nbsp; content: { "f": "json" }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp; 
&amp;nbsp; uploadKml.then(
&amp;nbsp;&amp;nbsp; function(response) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var random = (new Date()).getTime();
&amp;nbsp;&amp;nbsp;&amp;nbsp; var itemID = response.item.itemID; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; var kmlTask = new Geoprocessor(config.KML_Conv + "/GPServer/KML_Conv3");
&amp;nbsp;&amp;nbsp;&amp;nbsp; var dataFile = new DataFile();
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataFile.itemID = itemID;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var params = {"KML": dataFile };
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlTask.outSpatialReference = map.spatialReference;
&amp;nbsp;&amp;nbsp;&amp;nbsp; //pass file name and random ID to callbacks for reference.&amp;nbsp; Note: cannot set ID to filename due to use of spaces or special chars
&amp;nbsp;&amp;nbsp;&amp;nbsp; var args = { fileName: response.item.itemName, random: random };
&amp;nbsp;&amp;nbsp;&amp;nbsp; kmlTask.submitJob(params, lang.hitch(args, completeCallback), lang.hitch(args, statusCallback), lang.hitch(args,errCallback));
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; },
&amp;nbsp;&amp;nbsp; function (error) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("An error has occured: " + error);
&amp;nbsp;&amp;nbsp; });
 }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's the callback:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function completeCallback(jobInfo){
&amp;nbsp;&amp;nbsp; var kmlURL = config.KML_Conv + "/MapServer/jobs/";
&amp;nbsp;&amp;nbsp; var kmlLayer = new ArcGISDynamicMapServiceLayer(kmlURL + jobInfo.jobId);
&amp;nbsp;&amp;nbsp; map.addLayer(kmlLayer);
&amp;nbsp;&amp;nbsp; $(".alert button#" + jobInfo.jobId).one("click", function() { 
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.removeLayer(kmlLayer);
&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp; //zoom to new layer
&amp;nbsp;&amp;nbsp; on(kmlLayer, "Load", function() {
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.setExtent(kmlLayer.fullExtent, true);
&amp;nbsp;&amp;nbsp; }); 
 }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's some more information on GP services: &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000005w000000" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00570000005w000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You could presumably publish another Model as a Geoprocessing Task that handles CSV files in the same fashion...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:57:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660634#M61668</guid>
      <dc:creator>ScottGunn</dc:creator>
      <dc:date>2021-12-12T03:57:11Z</dc:date>
    </item>
    <item>
      <title>Is there any way to add KML,KMZ and CSV file from local drive/folder in web app?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660635#M61669</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks sagunn&amp;nbsp; got new approach &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; I tried by this way -&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; I converted the input kml to geojson format and then geojson to esri format.then added as esri graphics on map.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 05:07:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660635#M61669</guid>
      <dc:creator>GauriDeshmukh</dc:creator>
      <dc:date>2014-06-12T05:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to add KML,KMZ and CSV file from local drive/folder in web app?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660636#M61670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
&amp;nbsp;&amp;nbsp; var kmlLayer = new ArcGISDynamicMapServiceLayer(kmlURL + jobInfo.jobId);
&amp;nbsp;&amp;nbsp; map.addLayer(kmlLayer);
&amp;nbsp;&amp;nbsp; 
 }&lt;/PRE&gt;&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Why you have used dynamic service layer, is there any reason?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead of ArcGISDynamicServiceLAyer, we can use directly &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var kmlLayer = new esri.layers.KMLLayer(url);&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:57:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660636#M61670</guid>
      <dc:creator>GauriDeshmukh</dc:creator>
      <dc:date>2021-12-12T03:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to add KML,KMZ and CSV file from local drive/folder in web app?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660637#M61671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can add local CSV using this library:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://github.com/WSDOT-GIS/CSV-Reader"&gt;https://github.com/WSDOT-GIS/CSV-Reader&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2014 22:29:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660637#M61671</guid>
      <dc:creator>JeffJacobson</dc:creator>
      <dc:date>2014-06-12T22:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to add KML,KMZ and CSV file from local drive/folder in web app?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660638#M61672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is great...thanks a lot jacobsj &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;this is what i wanted for csv.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;but still struggling with adding kmz locally.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;how to convert kmz into kml or unzip kmz and read its contents.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 07:49:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660638#M61672</guid>
      <dc:creator>GauriDeshmukh</dc:creator>
      <dc:date>2014-06-13T07:49:53Z</dc:date>
    </item>
    <item>
      <title>Re: Is there any way to add KML,KMZ and CSV file from local drive/folder in web app?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660639#M61673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is great...thanks a lot jacobsj &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;this is what i wanted for csv.&lt;BR /&gt;but still struggling with adding kmz locally.&lt;BR /&gt;how to convert kmz into kml or unzip kmz and read its contents.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that I haven't personally used the libraries listed below, but they look like they will do what you want.&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;BR /&gt;&lt;LI&gt;For unzipping the KMZ archive (which is just a ZIP archive containing KML): &lt;A href="https://github.com/gildas-lormeau/zip.js"&gt;zip.js&lt;/A&gt;.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;For converting KML to GeoJSON: &lt;A href="https://github.com/mapbox/togeojson"&gt;mapbox/togeojson&lt;/A&gt;.&lt;/LI&gt;&lt;BR /&gt;&lt;LI&gt;To convert from GeoJSON to ArcGIS JSON: &lt;A href="http://terraformer.io/arcgis-parser/"&gt;Terraformer.ArcGIS&lt;/A&gt;. (This library is written by Esri.)&lt;/LI&gt;&lt;BR /&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 22:28:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-there-any-way-to-add-kml-kmz-and-csv-file-from/m-p/660639#M61673</guid>
      <dc:creator>JeffJacobson</dc:creator>
      <dc:date>2014-06-13T22:28:52Z</dc:date>
    </item>
  </channel>
</rss>

