New answers tagged

0

I've not programmed in Engine but looking at the help file for Interface IEngineFeatureSnapAgent the method Snap states: Snapping the passed in point means changing its x,y location properties. Because an IPoint interface pointer is passed into this function ByValue, direct edits of the point's parameters are possible. Resetting the IPoint ...


2

This is something I've never done so not sure if I am suggesting a red herring? You need to look at the page Creating Property Pages in the ArcObjects API help, from here there is a link to some sample code on a page called Layer property page and property sheet.


0

In Visual Studio 2013, to fix this check Use Managed Compatibility mode in VS2013 > Options > Debugging > General (last option in the list). Original answer by Preston McCormick here


0

I came up with this solution by looking up the IExtensionManager/IExtensionConfig. The 'Child' extension is set to showInExtensionDialog="false" autoLoad="false" Parent Extension: (called after IDocumentEvents_OpenDocumentEventHandler) private bool LoadChildExtensions() { var child = ...


2

As @mkennedy says the LayerFile is a "pointer" to the actual data but it can hold stuff like symbology, definition queries and basic metadata. You can set up the IMapGeographicTransformations or how about doing away with the whole problem by projecting your data into OSGB, create a LayerFile for your data (now in OSGB) and load that? I suggest this ...


2

You need to point edit to an existing workspace object not the base class. So you need to get a handle on the workspace you intend to edit before you point an IWorkspaceEdit interface to it. Search the API help for the page "Editing with the geodatabase API" there are several code samples to get you going.


0

Finally I found that , space in input feature class directory creates problem in topoToRaster tool execution. from this link :https://geonet.esri.com/thread/51293 ... and the "_inputFeature" is like this: _inputFeature = "D:\Temp\line.shp Max_depth CONTOUR"// "shape_file_path..space..Field..space..TYPE" thanks all....


0

As commented by the asker, this was their solution: I have solved the problem. All attempts inside the geoprocessing (arcgisscripting) failed even if I constructed completely new objects from scratch setting vertices' coordinate values. So, I resorted to Osgeo.ogr library to create new shape file. The data had been imported using WKT data format ...


0

I would use the IFeatureSelection interface to obtain the selection set from an existing selection (so all pink polygons intersecting green polygons) and invert it. Below is some VBA code to show you how to use ArcObjects and invert a selection. Public Sub InvertSelection() ' Get map document Dim pMXDoc As IMxDocument Set pMXDoc = ThisDocument ...


1

Try this, use IActiveView interface to set the current view of map private void button4_Click(object sender, EventArgs e) { IMap map = mxdoc.FocusMap; // get activview of the map IActiveView activeView = (IActiveView)map; gl.map = map; ILayer layer = gl.getSelectedLayer(comboBox1.SelectedItem.ToString()); ...


11

I assume you have installed comtypes successfully, according to the following SE Q/A: -How do I access ArcObjects from Python? import arcpy from snippets102 import * from comtypes.client import GetModule, CreateObject import comtypes.gen.esriFramework as esriFramework import comtypes.gen.esriArcMapUI as esriArcMapUI import comtypes.gen.esriCarto as ...


1

The solution to the problem is to use the RGB rendering by setting the property below. rle2.Force2RGB = true; For some reason the exported raster file has to be RGB. The second thing - once I imported the produced raster to ArcMap the colors where wrong. This is because ArcMap applies some default renderer properties to the raster. To overcome this ...


2

If the featurelayer is selected in the TOC then you can use the DeleteLayer method of IMap. Otherwise you need to first disconnect it from the data source by casting the layer to IDataLayer2 and then calling the disconnect method. This is mentioned at the bottom of the help file: IMap.DeleteLayer Method Also it would be a good idea to catch your exception ...


0

I got it working. Seems I had to assign my dockwindow to Nothing before I use the getDockableWindow() method. Also had to change show() method. Protected Overrides Sub OnClick() Try ' Only get/create the dockable window if it's not there Dim dockWindow As ESRI.ArcGIS.Framework.IDockableWindow dockWindow = Nothing If ...


0

Here's a complete sample that shows how to use the DockableWindowManager (C#, sorry): var w = ArcMap.DockableWindowManager.GetDockableWindow(new UIDClass { Value = ThisAddIn.IDs.DockableWindow1 }); if (w != null) { w.Show(true); } In VB.Net, the ID's are in My.ThisAddIn.IDs.


2

One way would be to use ICurve QueryPointAndDistance to and get the DistanceAlongCurve value for your 'B' point. Then call ICurve.GetSubcurve twice (with the DistanceAlongCurve + 2 and DistanceAlongCurve - 2) and the fromDistance parameter as 0. And the asRatio as false. The "To" points of the resulting subcurves would be your 'A' and 'C'. ...


2

You can not cast a FeatureClass into a ILayer! Here's the proper way to reach an ILayer from a FeatureClass: .... IFeatureLayer fl = new ESRI.ArcGIS.Carto.FeatureLayer() fl.FeatureClass = FC; var l = fl as ILayer; axMapControl1.AddLayer(l); I am assuming all of your previous methods are correct and you have a valid IFeatuerClass (FC).


2

You have to start an edit-session before you can open an edit-operation (which is only a deeper closure). In ArcMap an edit-session automatically creates an edit-operation which can then be redone/undone. When doing this programmatically you have to manually open that operation. So call this before starting your operation: editor.StartEditing(myWorkspace). ...


0

Changed flag that I wanted sets by IEditor.StartOperation and IEditor.StopOperation methods: UID eUID = new UIDClass(); eUID.Value = "esriEditor.Editor"; IEditor editor = (IEditor)ArcMap.Application.FindExtensionByCLSID(eUID); editor.StartOperation(); /** edits **/ editor.StopOperation("My edits");


1

You can do a left join using the "Tables" property. IQueryDef queryDef = ((IFeatureWorkspace)hoja.Workspace).CreateQueryDef(); queryDef.Tables = "User LEFT JOIN Country ON User.ID = Country.ID"; queryDef.SubFields = "User.ID, User.Name, Country.Name"; Works fine with left, right and inner joins, but no idea how to make a full join. Also, you can use ...


2

You can use the IGpValueTableObject to be Using value tables: A value table is a flexible object that can be used as input for a multivalue parameter. Examples of multivalue parameter values focus on the text value of the parameter that can become difficult to use when there are numerous values with complex paths. The value table is used to ...


1

You can compile it for lowest supported version. As long as you aren't using features that were added in a later version it will be forward compatible. So in your case build it for 10.2. Be sure to test that things work as expected in each version to be supported since various bug fixes, etc between version can cause issues in your Add-in. Also see here: ...


0

Works fine now. Here is the code for anyone interested. Useful if you need to copy OSGB1936 co-ordinates into Google Maps. Seems the way I was inserting the text into the clipboard was crashing ArcMap. Also should be tool not button. Protected Overrides Sub OnMouseDown(ByVal arg As ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs) MyBase.OnMouseDown(arg) ...


1

I had a devil of time trying to use a Direct Connection to Oracle. At the end, I used a .sde file to load up in memory, then parsed out the PropertySet for it so I could see how it was working. This code works for me: public static IWorkspace Connect(string serverName, int port, string dbName, string user, string password) { ...


1

You can use the IGeoProcessor to call any of the geoprocessing tools, have a look at his page. Having said that you have asked for an alternative method. I would have used Ipolyline.QueryPointAndDistance() and extracted points out along a single polyline.


1

Basically you CAN run any SQL-statement towards your database, as ArcGIS does this internally also. However the question is: why should you want to do this? In particular there is no gain on using this kind of statement towards your current approach. When you´re interested in a single value of one single row you may limit the selected columns as done by ...


0

Normally you would return a row using a cursor as you have done. There is the GetFeatures() method and this would return a single feature but it relies on you knowing the ObjectID. Personally I would stick what you have as you have optimised the cursor by set sub-fields. May be adding an attribute index would speed things up?


3

Addins are not backwards compatible and cannot be installed on an earlier version of ArcMap. You'll have to set up a development machine or VM with ArcGIS 10.0 and Visual Studio 2010 to compile the addin then it can be distributed to PCs running later versions of ArcGIS.


4

Something like the following should work: GetModule('esriCarto.olb') import comtypes.gen.esriCarto as esriCarto pMapDocument = CreateObject(esriCarto.MapDocument, esriCarto.IMapDocument) pMapDocument.Open(path) #Do stuff pMapDocument.Save()


0

You'll need to ask Esri why, but it is not possible to access any sys tables directly using SE_table_describe, which means that any interface which accesses the system view piecemeal will fail. The underlying ArcSDE functions can create a stream accessing the sys.columns view, and it's possible to generate a Query Layer on sys.columns, but ...


0

This worked. As long as i didnt use the ESRI ArcMap Addin form template it was ok. With ArcMap addin forms it always gives an error about using Hooks. When you call the form must have a hook variable passed through it or something. Didnt quite understand it. But using the standard VB.net form was ok. Dim oform As New ArcMapAddin2.Form2() oform.ShowDialog() ...


-1

Install ArcFM Object Reader Depending on your ArcMap Version Eg: For 10.2 ArcGIS install object Reader 10.2 Below is the link https://infrastructurecommunity.schneider-electric.com/servlet/JiveServlet/download/5372-2-16431/Object_Reader_x32_x64_1021a_for_ArcGIS_10.3_1102.zip If it not recognizing the ArcGIS open your Arcmap and then try to install. After ...



Top 50 recent answers are included