|
POST
|
Why not write a small class MyTool with 2 public properties string Name and IVariantArray Parameters, and then define the queue as Queue<MyTool>? That would work too. May take that idea and add some properties to the class for setting props on the GeoProcessor such as OverwriteOutput as well. I also observe that the tool DLL uses the .NET runtime 4.0, but what's worse in my case is that the assembly builder seems to hardcode the toolbox location into the DLL. Therefore, if you move the toolbox somewhere else, the DLL won't help you any more. Thanks for the information. The tbx I was looking at can in fact be in different locations depending if the OS is 32 or 64bit. I'll stick to using the string name & ivariantarray params for now. Terry
... View more
05-21-2013
09:35 AM
|
0
|
0
|
1085
|
|
POST
|
There's an XML file in the user's AppData folder that should list all folders they've added to the Add-In search path - C:\Users\<username>\AppData\Roaming\ESRI\Desktop10.1\AddInFoldersList.xml It can also be stored in the registry but only if a key was added manually and the user has permission to write to the registry. See the very end of this '>help topic I'd try the XML file and check each node under the appropriate appplication (ArcMap node for example) and see if the folder name without the drive letter matches the location. There are a couple of ways to convert the drive letter to a UNC path too if you want to make sure the user didn't map to another server with an identical folder name.
... View more
05-20-2013
09:10 AM
|
0
|
0
|
646
|
|
POST
|
Richard, My Add-In project is targeting 3.5 & that's what it shows in the properties, which is what I thought the Add Toolbox Reference what honor but it doesn't seem to be the case. I think the context menu in Visual Studio is really running the GPAssemblyBuilder.exe in C:\Program Files (x86)\ArcGIS\DeveloperKit10.1\IDEIntegration\VisualStudio\bin. I tried running that via command line but there doesn't seem to be any switches for the output target framework either.
... View more
05-16-2013
02:34 PM
|
0
|
0
|
1085
|
|
POST
|
I haven't tried it yet but seems like instead of using this-:
private Queue<IGPProcess> _myGPToolsToExecute = new Queue<IGPProcess>();
...
_myGPToolsToExecute.Enqueue(bufferTool);
_myGPToolsToExecute.Enqueue(clipTool);
_gp.ExecuteAsync(_myGPToolsToExecute.Dequeue());
why not this -
private Queue<string> _myGPToolsToExecute = new Queue<string>();
private Queue<IVariantArray> _myGPToolsParams = new Queue<IVariantArray>();
...
_myGPToolsToExecute.Enqueue(bufferTool);
_myGPToolsParams .Enqueue(bufferParams);
_myGPToolsToExecute.Enqueue(clipTool);
_myGPToolsParams .Enqueue(clipParams);
_gp.ExecuteAsync(_myGPToolsToExecute.Dequeue(),myGPToolsParams.Dequeue());
I'm still curious about my 2 questions re: converting the .tbx to a DLL though if anyone has thoughts on that.
... View more
05-16-2013
01:55 PM
|
0
|
0
|
1085
|
|
POST
|
I'm currently working on an Add-In in which I'll need to do some geoprocessing. In the ArcObjects samples (here) there's one that show how to queue up multiple geoprocessing tools to run in the background and not have existing data for inputs (e.g. tool2 uses tool1's output). This looks like something I'll need to implement, but when trying it today I hit an issue - some of the tools I need to run are in custom toolboxes so I can only execute them using GP.executeasync(string name, varArray params). I remembered that you can add a reference to an ArcGIS Toolbox in your Visual Studio project. I tried this, but the DLL created from the process has a Runtime version of 4 and I'm working in 3.5... 2 questions about this process: 1. Is there a way to control the .Net version the DLL is compiled against? Is it based on the version tied to the version of Visual Studio? 2. Will users of the Add-In still need the actual .tbx file I created the DLL from & in the exact same file location? Thanks, Terry
... View more
05-16-2013
12:55 PM
|
0
|
5
|
1960
|
|
POST
|
I know I can cast a dockablewindow to IWindowPosition and get it's State to see if it's floating (esriDockFlags.esriDockFloat) or docked (esriWindowState.esriWSNormal) but how do you determine where it's docked if it is docked? Terry
... View more
05-09-2013
08:51 AM
|
0
|
0
|
490
|
|
POST
|
Since you're working with an Add-In you can also just reference the internal ArcMap class & it's Document member which returns IMxDocument -
IMxDocument mxdoc = ArcMap.Document;
... View more
05-08-2013
11:20 AM
|
0
|
0
|
404
|
|
POST
|
so is it opening a browser window to google street view but still passing the coords as X,Y? I've had problems with an older version of the addin is still in the arcgis assembly cache folder (on Win7 usually C:\Users\<user>\Documents\ArcGIS\AddIns\Desktop10.1). Check to see if there's a folder with your addin's guid (you can find it in the config.esriaddinx file as the AddInID). If so, you might delete that, rebuild in visual studio and try debugging again.
... View more
05-01-2013
09:59 AM
|
0
|
0
|
1122
|
|
POST
|
That code should go between the line where create your point object & opening StreetView. On which line does it fail? Do you have a Using directive for Esri.ArcGIS.Geometry? If not, try one of the following : use the full namespace , ESRI.ArcGIS.Geometry.ISpatialReferenceFactory srFact = ESRI.ArcGIS.Geometry.new SpatialReferenceEnvironmentClass(); Other things to try - if it's failing on Type factoryType = null, either adding a Using directive for System or qualify the name = System.Type factoryType = null; instead of GetTypefromProgID try Type.GetTypeFromCLSID("") - the GUID for the SRfactory can be found here http://resources.arcgis.com/en/help/arcobjects-net/conceptualHelp/#/Interacting_with_singleton_objects/00010000043p000000/ you can also use ISpatialReferenceFactory srFact = new SpatialReferenceEnvironmentClass(); but see the warnings of doing do one the same page I linked to in the above bullet Updated code with namespaces here - ESRI.ArcGIS.Geometry.IPoint point = activeView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y) as ESRI.ArcGIS.Geometry.IPoint; //project pt to WGS84 System.Type factoryType = null; factoryType = System.Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment"); ESRI.ArcGIS.Geometry.ISpatialReferenceFactory srFact = new ESRI.ArcGIS.Geometry.SpatialReferenceEnvironmentClass(); ESRI.ArcGIS.Geometry.IGeographicCoordinateSystem srWGS84 = srFact.CreateGeographicCoordinateSystem(4326); point.Project(srWGS84); //Open IStreetView in default browser System.Diagnostics.Process.Start("http://maps.google.com/maps?q=&layer=c&cbll=" + point.X + "," + point.Y + "&cbp=12,100,0,0,0&output=svembed&t=m&z=17");
... View more
05-01-2013
06:09 AM
|
0
|
0
|
1122
|
|
POST
|
something like this should do the trick -
Type factoryType = null;
factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
ISpatialReferenceFactory srFact = (ISpatialReferenceFactory)Activator.CreateInstance(factoryType);
IGeographicCoordinateSystem srWGS84 = srFact.CreateGeographicCoordinateSystem(4326);
point.Project(srWGS84);
... View more
04-30-2013
02:13 PM
|
0
|
0
|
1122
|
|
POST
|
I've been reading through the documentation on SDS and am a bit confused. In the online help (http://resources.arcgis.com/en/help/main/10.1/index.html#/Editing_and_ArcGIS_Spatial_Data_Server/01sq0000000t000000/) it says "Currently, data using the SQL Server geography type in a database can only be queried" which contradicts the more general statement on the same page of "You can edit simple, two-dimensional vector data and its attributes in any database management system supported by ArcGIS Spatial Data Server, provided the table you want to edit contains an identifier field that the database populates with unique integer values." So does the limitation on editing data from SQL Server only apply to the Geography type? What if the data are using the Geometry type? Thanks, Terry
... View more
04-05-2013
08:38 AM
|
0
|
1
|
509
|
|
POST
|
Got it figured out. The server has no MS Office components installed. I installed the AccessDatabaseEngine from MS and now the code is running properly. All those little things to remember when rebuilding a server 🙂 link to Access 2010 runtime - http://www.microsoft.com/en-us/download/details.aspx?id=13255
... View more
02-13-2013
07:20 AM
|
0
|
0
|
946
|
|
POST
|
Thanks for the tip, I've tried that... I removed several debugging console.writeline() statements from the code posted. These statements seem to indicate they're valid objects -
//Open XLS as table & make XY layer
factoryType = Type.GetTypeFromProgID("esriDataSourcesOleDB.ExcelWorkspaceFactory", true);
Console.WriteLine("type " + factoryType.GetType().ToString() + " " + factoryType.Module.Assembly.ToString());
System.Object objFact= Activator.CreateInstance(factoryType);
WSFac = objFact as IWorkspaceFactory;
//WSFac = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
Console.WriteLine("factory created " + (WSFac != null).ToString());
... View more
02-13-2013
07:06 AM
|
0
|
0
|
946
|
|
POST
|
I recently upgraded a server w/ Engine installed to 10.1 sp1 from 10.0. I have some code in a simple console app that creates XY events from a spreadsheet and then writes those features into a SDE instance. Since the upgrade, the code bombs when I try to open a workspace from the spreadsheet - code below. Any ideas what I'm missing or may have changed from 10.0? Thanks, TG
Console.WriteLine("Import Starting - " + DateTime.Now.ToShortTimeString());
try
{
//Open XLS as table & make XY layer
factoryType = Type.GetTypeFromProgID("esriDataSourcesOleDB.ExcelWorkspaceFactory");
WSFac = (IWorkspaceFactory)Activator.CreateInstance(factoryType);
Console.WriteLine(WSFac.IsWorkspace(strXLSarchive));
Console.WriteLine("Looking for " + strXLSarchive);
Console.WriteLine("does file exists " + File.Exists(strXLSarchive).ToString());
WS = WSFac.OpenFromFile(strXLSarchive, 0); <-- falls into the Catch block here
Console.WriteLine("WS opened");
fWS = (IFeatureWorkspace)WS;
table = fWS.OpenTable(strXLSsheet);
ds = table as IDataset;
XYProps = new XYEvent2FieldsPropertiesClass()
{
XFieldName = strXField,
YFieldName = strYField
};
XYName = new XYEventSourceNameClass()
{
EventProperties = XYProps,
SpatialReference = srWGS84,
EventTableName = ds.FullName
};
XYEvent = (XYName as IName).Open() as IXYEventSource;
fcInput = XYEvent as IFeatureClass;
}
catch (Exception ex)
{
strMsg = "0;Failed to create XYEvents from XLS: " + ex.Message + ";" + ex.GetType().ToString();
Console.WriteLine(strMsg);
WriteLog(strMsg, true);
m_AOLicenseInitializer.ShutdownApplication();
return;
}
strMsg that's echoed and logged is - 0;Failed to create XYEvents from XLS: Exception from HRESULT: 0x80040213;System.Runtime.InteropServices.COMException;2/12/2013;1:41:13 PM my debugging WriteLine statements echo the correct file name and that it does exist. Code runs fine on my PC debugging in VS2010
... View more
02-12-2013
11:40 AM
|
0
|
4
|
1397
|
|
POST
|
Restarting IIS and the ArcGIS Server service seems to have fixed the issue for now. also, for clarification I could via the map services via ArcMap, web app, etc.. but others who are just in a User role could not.
... View more
02-12-2013
06:44 AM
|
0
|
0
|
1460
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2017 08:59 AM | |
| 1 | 06-15-2016 03:27 PM | |
| 1 | 01-14-2016 09:55 AM | |
| 2 | 12-14-2012 09:38 AM | |
| 2 | 10-23-2017 01:22 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-17-2024
08:14 PM
|