Select to view content in your preferred language

Create LasDataset Geoprocessing tool using the Arcpro sdk for C#

139
2
05-20-2024 05:53 PM
ReilDeal92
New Contributor

Can someone help me understand what I'm doing wrong when trying to call the CreateLasDataset geoprocessing tool? I have trouble with calling the geoprocessing tools in general, this is for C#.  

 

Here is my current helper method to call the create lasdataset geoprocessing tool.  

createlasmethod.PNG

I set up the tool and extract the spatial reference from an existing layer within the map then call the helper method here in this code snippet below. Note, I also extract the wkid, maybe I should use this instead and get the spatial reference within the createlasdataset helper method?

setup.PNG

When I run the tool manually, then copy and past the arcpy command I get this result, my thinking was to recreate this order of parameters but I'm not having much luck.  I highlighted the spatial reference to try and make this easier to read.   

arcpy.management.CreateLasDataset(r"G:\GS\Projects\Reil_Delivery\ArcProAddins\SchulerSwathTool\lasfilelocation", r"G:\GS\Projects\Reil_Delivery\ArcProAddins\SchulerSwathTool\lasfilelocation.lasd", "NO_RECURSION", None, 'PROJCS["NAD_1983_UTM_Zone_12N",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-111.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]', "COMPUTE_STATS", "ABSOLUTE_PATHS", "NO_FILES", "DEFAULT", None, "INTERSECTED_FILES")

 

Could someone help me understand how to do this correctly? This is my first time asking a question like this, I'm unfamiliar with how to format properly.   

 

 

0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

I would suggest you invest a little bit in geoprocessing events handling. More info you can find here (section Executing a tool with event handling). Be careful with _cts.Cancel();. It could close your tool and with right workflow. It will let you to find invalid parameters and get more information about process workflow.

0 Kudos
UmaHarano
Esri Regular Contributor

Hi @ReilDeal92 

Another alternative to create a LasDatasetLayer is to use the .NET API. At 3.2, we added support for working with 3D Layers such as LASDataset layers.  ProConcepts: 3D Analyst Layers   ProConcepts: 3D Analyst Data 

Here is a code snippet to use create a LASDataset layer from an existing LAS Dataset.

QueuedTask.Run(() =>
{
//Use the various constructors available to create a LasDatasetLayerCreationParams object from an Item, LasDataset, etc. Refer to https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic20557.html  
var lasDatasetCreationParams = new LasDatasetLayerCreationParams(new Uri(@"C:\Data\lasDataset.lasd"))
  {
    Name = "LasLayerUsingAPI",
  };
  var lasLayer = LayerFactory.Instance.CreateLayer<LasDatasetLayer>(lasDatasetCreationParams, MapView.Active.Map);
});