POST
|
Hey all, We have a number of widgets built with 4.x in Typescript and end to end testing for testing these components as part of a web application but I'm struggling to figure out how to load up the API and then the widgets for unit testing in a framework such as Chutzpah, Jasmine, or Comma. I'm thinking that surely ESRI has a preferred test framework that they use while developing the API, Widgets, and other components. Does anyone have experience setting this up and could you help point me in the right direction? Thanks!
... View more
09-14-2017
12:41 PM
|
1
|
0
|
300
|
POST
|
Hey All, I am attempting to create a TIN from a Raster Dataset: private void Example(IRasterDataset rasterDataset, IGeometry aoi)
{
ITin tin = new TinClass();
ITinEdit tinEdit = (ITinEdit)tin;
tinEdit.InitNew(aoi.Envelope);
var raster = rasterDataset.CreateDefaultRaster();
var rasterProps = (IRasterProps)raster;
var cellsize = rasterProps.MeanCellSize();
IPnt blocksize = new PntClass();
blocksize.SetCoords(Math.Floor(aoi.Envelope.Width / cellsize.X), Math.Floor(aoi.Envelope.Height / cellsize.Y));
//IRasterCursor rasterCursor = raster2.CreateCursorEx(blocksize);
var rasterCursor = ((IRaster2)raster).CreateCursorEx(blocksize);
var pixelBlock = rasterCursor.PixelBlock;
//Get the pixel blocks
IPnt tlc = new PntClass();
tlc.SetCoords(Math.Floor((aoi.Envelope.XMin - rasterProps.Extent.XMin) / cellsize.X), Math.Ceiling((rasterProps.Extent.YMax - aoi.Envelope.YMax) / cellsize.Y));
raster.Read(tlc, pixelBlock);
IPixelBlock3 pixelBlock3 = (IPixelBlock3)pixelBlock;
var pixels = (System.Array)pixelBlock3.get_PixelDataByRef(0);
object maxPoints = 3000000;
object toleranceAchieved = false;
object nodata = -9999.0;
try
{
tinEdit.AddFromPixelBlock(aoi.Envelope.XMin + (cellsize.X / 2), aoi.Envelope.YMax - (cellsize.Y / 2), cellsize.X, cellsize.Y, nodata, pixelBlock, 1, ref maxPoints, out toleranceAchieved);
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
}
} But I get a "Value does not fall within expected range" message on the exception. Any ideas?
... View more
08-04-2015
09:39 AM
|
0
|
1
|
2760
|
POST
|
Just a note: InvokeModal will always run in the foreground whereas Invoke will honour the Geoprocessing options for running in the background.
... View more
07-31-2015
07:23 AM
|
1
|
0
|
669
|
POST
|
That's exactly what I was looking for! @Freddie - this does work; tried it out this morning. I was just missing getting the IArray ParameterInfo and setting the parameters directly. I was previously passing in an IVariantArray and none of it would show up in the modal window. I have the suspicion that we can also do this right through the Geoprocessor since there is a .SetValue and .GetValue that says it references the current tool but haven't figured that out yet. Thanks so much for this!
... View more
07-31-2015
06:56 AM
|
0
|
1
|
669
|
POST
|
Thanks, Freddie It is the latter and I want to avoid creating the custom dialog and wiring of events. I've done this with the simple ProgressDialog but we lose the consistent ArcMap experience that we are trying to achieve. This is in ArcMap. No problem opening the tool window but there we are trying to avoid having user's need to know all of the data paths and there are some config items that get pulled in as well. This is for a custom tool in a larger process and the users don't care about the details.
... View more
07-29-2015
07:15 AM
|
0
|
0
|
669
|
POST
|
Echoing Freddie. Probably something to do with validation on the output file param. Try making the parameter an input that is simply a path to the output location and have a separate derived output parameter. You can validate and / or update the name in the validation step to make sure that the path is a .zip file.
... View more
07-29-2015
07:04 AM
|
0
|
0
|
283
|
POST
|
I am calling GPs by calling Geoprocessor.Execute("gpname", IVariantArray) but the only way I see to display a dialog is to create a new Progressor / StepProgressor and handle GP messages and update the dialog myself. How can I just launch the standard dialog as though the user had filled in the all the info themselves and launched from the Application? Users like the message logging window which isn't part of the Progressor UI. Thanks!
... View more
07-28-2015
09:45 AM
|
0
|
6
|
3401
|
POST
|
Try using the IRasterWorkspaceEx.SaveAsRasterDataset() method. e.g. var rasterWorkspace = (IRasterWorkspaceEx) workspace;
IRasterProps propsSource = sourceRaster as IRasterProps;
IRasterDef rasterDef = new RasterDef();
rasterDef.SpatialReference = propsSource.SpatialReference;
var raster = ((IRasterDataset3)tempClipRaster).CreateFullRaster();
((IRasterProps)raster).NoDataValue = propsSource.NoDataValue // Ensure that this is the value you expect.
IRasterDataset3 clipOutput = rasterWorkspace.SaveAsRasterDataset(rasterName, raster, null, null, rasterDef, null);
... View more
04-08-2015
02:15 PM
|
0
|
0
|
482
|
POST
|
Hello, I want to use the ILasSurface.InterpolateRaster method to get a DSM raster from the LasDataset but it only works if I pass in a RasterDataset that was created with LONG pixel type - what I really want is DOUBLE or FLOAT. However, the method throws a "Value does not fall within the expected range" argument exception if I pass it a RasterDataset that is DOUBLE or FLOAT. Is it even possible to get this result? Why would it be locked to LONG type? public IRasterDataset3 LasDatasetToDSM(ILasDataset lasDataset, IGeometry envelope)
{
esriSurfaceInterpolationType interpolationType = esriSurfaceInterpolationType.esriNaturalNeighborInterpolation
ILasSurface lasSurface = lasDataset.CreateDynamicSurface();
ILasFilter lasFilter = (ILasFilter)new LasFilter();
lasFilter.AreaOfInterest = envelope;
ILongArray @returns = new LongArray();
@returns.Add(1);
lasFilter.Returns = @returns;
IRasterDataset rd = CreateTempRasterDataset(envelope.Envelope, LTK.Properties.Settings.Default.Cellsize, rstPixelType.PT_FLOAT);
try
{
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
lasSurface.InterpolateRaster(null, lasFilter, rd, -1, esriTinPointSelectionMethod.esriTinPointSelectionZmax, interpolationType, 1.0);
sw.Stop();
Logger.Log("DSM Created in " + sw.Elapsed.ToString());
return rd;
}
catch (Exception e)
{
Logger.Log(e.Message + " " + e.StackTrace, LogLevel.Error);
}
return null;
}
... View more
02-25-2015
06:15 AM
|
0
|
0
|
3579
|
POST
|
I have a portion of my application that creates temporary tiled raster datasets and then mosaics them back into a geodatabase raster dataset: private void MosaicRasterIntoRasterDataset(IRaster raster, IRasterDataset rasterDataset) { IRasterDatasetEdit3 rdEdit = (IRasterDatasetEdit3)rasterDataset; rdEdit.Mosaic(raster, 0.01); ((IRasterDataset3)rasterDataset).PrecalculateStats(0); ((IRasterDataset3)rasterDataset).Refresh(); } I'm not sure if PrecalculateStats or Refresh are even necessary here. I release the reference to rasterDataset and the geodatabase workspace in the calling block before closing the thread. Here's the issue: when I load this raster dataset into ArcMap, there are portions of the pyramids missing at different pyramid levels and sometimes the raster data doesn't display at full resolution either or recognize that there has been a change in extent. I say sometimes because it is truly hit or miss. Attempting to build pyrmids doesn't appear to do anything (takes 0-1 second) but restarting the application and deleting pyramids and then rebuilding them usually resolves these issues. Am I missing something in the mosaic process to trigger the approporiate pyramids to be reconstructed? Does my thread need to stay open after I've made this call in order for the appropriate actions to happen in the GDB? Is this a bug in ESRI software (I've seen similar posts that make me think it might be but aren't definitive on this). Note that I'm developing at Basic so Mosaic Dataset isn't an option here.
... View more
02-24-2015
05:20 AM
|
0
|
0
|
3542
|
POST
|
Let's try to solve this one for you since we're not having any luck on the COM Exception! Facility_ID_Tool__AddIn.dll vs. Facility_ID_Tool _AddIn.dll There are 2 underscores before AddIn in the first and one in the second.
... View more
02-10-2015
05:58 AM
|
0
|
0
|
163
|
POST
|
No match for that error code - I still think that this is an RCW thing but hard to tell without seeing it run through in debug mode. Note that setting cursor references to null doesn't always release the references right away. Either use the ComReleaser class by adding each cursor to the comReleaser.ManageLifetime(any_cursor): //More than one WaterMain could be returned!!! selectedWaterMain = SelectByLocation(waterMainLayer, (IPoint)feature.Shape); comReleaser.ManageLifetime(selectedWaterMain); and selectedWaterService = SelectByLocation(waterServiceLayer, (IPoint)feature.Shape); comReleaser.ManageLifetime(selectedWaterService); or explicitly call Marshal.ReleaseComObject(cursor) where you are setting them to null, e.g.: int wsCount = Marshal.ReleaseComObject(selectedWaterService); System.Diagnostics.Debug.WriteLine(wsCount.ToString() + " water service references remaining."); // Just to see how many are remaining. One more thing I noticed is that in case 0, UpdateFeature is called as well. I'm not sure if that would have anything to do with it... This looks so much like a case of a reference to a feature cursor not being released before you open another one up. If explicitly releasing them doesn't work, I would start looking at how you are opening the workspaces ..( ArcObjects 10 .NET SDK Help )
... View more
02-09-2015
04:26 PM
|
0
|
1
|
477
|
POST
|
I couldn't find a match for the error code you had posted, what other information is there about the error? If we can match it to an ESRI error code we might be able to narrow it down further. Are you managing / releasing all the other cursors here as well (e.g. selectedWaterMain, selectedWaterService)? You say that this is with one particular feature... is there anything strange about the geometry? If you make a new feature class with only that feature, do you still get the error?
... View more
02-09-2015
12:39 PM
|
0
|
3
|
477
|
POST
|
Try using the ComReleaser class to manage the lifetime of the update FeatureCursor. The ComReleaser will release the cursor objects when it goes out of scope and decrement the number of Runtime Callable Wrappers (RCWs). You can read more on COM Interop and RCWS in the documentation; I'm sure that my use of terms is not quite right. What happens is that as you open up new cursors, the number of RCWs starts to add up and that's when things go awry. So it makes sense that it would run a few times and then fail and that when you restart it works fine again. //create a cursor for the fittings ICursor cursor; selSet.Update(null, false, out cursor); using (ComReleaser comReleaser = new ComReleaser()) { IFeatureCursor fCursor = (IFeatureCursor)cursor; comReleaser.ManageLifetime(fCursor); // ... everything until you are done with the cursor; }
... View more
02-09-2015
11:33 AM
|
0
|
5
|
477
|
POST
|
Hi there! Can you post the entire method block where this error occurs? I'd have a few suggestion off the top of my head but seeing just a little more about how you open the workspace & feature class and how you are handling the feature cursor would help narrow things down.
... View more
02-06-2015
06:01 PM
|
0
|
0
|
477
|
Title | Kudos | Posted |
---|---|---|
1 | 07-31-2015 07:23 AM | |
1 | 01-05-2015 10:32 AM | |
1 | 09-14-2017 12:41 PM |
Online Status |
Offline
|
Date Last Visited |
03-28-2022
12:45 PM
|