Select to view content in your preferred language

Javascript create Laz and zLas files

397
0
12-23-2021 03:17 AM
KiroAndreevGDI
Emerging Contributor

Dear,

I have custom widget which can drawing geometry and upload SHP file. In booth  sceneries graphics i must to use for creating .Laz or zLas files. The code for reading SHP zip file and present on the map is:

var fileToRead = document.getElementById("shpFileUpload");
if (fileToRead != null)
fileToRead.addEventListener("change", function (event) {
apiUrl = _that.appConfig.apiCallsUrl;
var fileUpload = $("#shpFileUpload").get(0);
var files = fileUpload.files;
var data = new FormData();
if (files[0].name.indexOf(".zip") !== -1) {
var portal = new arcgisPortal.Portal('https://aknlidarappprod.katastar.gov.mk/portal/');
var fileName = files[0].name;
document.getElementById("chooseFileId").innerHTML = fileName;
var name = fileName.split(".");
name = name[0].replace("c:\\fakepath\\", "");
var params = {
'name': name,
'targetSR': _this.map.spatialReference,
'maxRecordCount': 1000,
'enforceInputFileSizeLimit': true,
'enforceOutputJsonSizeLimit': true
};
var extent = scaleUtils.getExtentForScale(_this.map, 40000);
var resolution = extent.getWidth() / _this.map.width;
params.generalize = true;
params.maxAllowableOffset = resolution;
params.reducePrecision = true;
params.numberOfDigitsAfterDecimal = 0;

/* data.append(files[0].name, files[0]);*/
data.append("file", files[0]);
var job = {
map: _this.map,
sharingUrl: portal.portalUrl,
baseFileName: name,
fileName: files[0].name,
fileType: "Shapefile",
publishParameters: params,
generalize: true,
numFeatures: 0
};

_this._analyze(job, data).then(function (response) {

return _this._generateFeatures(job, data);

}).then(function (response) {
array.forEach(response.featureCollection.layers, function (layer) {
var featureLayer = new FeatureLayer(layer, {
outFields: ["*"]
});
featureLayer.xtnAddData = true;
if (featureLayer.graphics) {
graphic = new esri.Graphic(featureLayer.graphics[0].geometry, sfs, {
keeper: true
});
_this.map.graphics.clear();
_this.map.graphics.add(graphic);
_this.map.setExtent(featureLayer.graphics[0].geometry.getExtent());
/* $('#shpFileUpload').val("");*/
job.numFeatures += featureLayer.graphics.length;
}

});
})

}
else
alert(i18nStrings.zipFile)

}, false);

My question is, if it possible to create .Laz and .zLas file similar of presented code above? Can I create custom PointCloudLayers which will create .Laz or .zLas files?In attached file is video of my custom widget, and when i click on "Add to Cart", can I create .Laz or .zLas file using javascript esri api?



Best Regard.

 

0 Replies