var uploadKml = new esriRequest({ url: config.KML_Conv + "/GPServer/uploads/upload", form: dom.byId('uploadForm'), content: { "f": "json" } }); uploadKml.then( function(response) { var random = (new Date()).getTime(); var itemID = response.item.itemID; var kmlTask = new Geoprocessor(config.KML_Conv + "/GPServer/KML_Conv3"); var dataFile = new DataFile(); dataFile.itemID = itemID; var params = {"KML": dataFile }; kmlTask.outSpatialReference = map.spatialReference; //pass file name and random ID to callbacks for reference. Note: cannot set ID to filename due to use of spaces or special chars var args = { fileName: response.item.itemName, random: random }; kmlTask.submitJob(params, lang.hitch(args, completeCallback), lang.hitch(args, statusCallback), lang.hitch(args,errCallback)); }, function (error) { console.log("An error has occured: " + error); }); }
function completeCallback(jobInfo){ var kmlURL = config.KML_Conv + "/MapServer/jobs/"; var kmlLayer = new ArcGISDynamicMapServiceLayer(kmlURL + jobInfo.jobId); map.addLayer(kmlLayer); $(".alert button#" + jobInfo.jobId).one("click", function() { map.removeLayer(kmlLayer); }); //zoom to new layer on(kmlLayer, "Load", function() { map.setExtent(kmlLayer.fullExtent, true); }); }
var kmlLayer = new ArcGISDynamicMapServiceLayer(kmlURL + jobInfo.jobId); map.addLayer(kmlLayer); }
This is great...thanks a lot jacobsj 🙂 this is what i wanted for csv.but still struggling with adding kmz locally.how to convert kmz into kml or unzip kmz and read its contents.
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.