Hot answers tagged

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 ...


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()


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.


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 ...


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). ...


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 ...


2

I ended up doing it a different way, but stumbled on the subtype in <Item> declaration in toolbar tag--and it exposes the subtype. <Toolbars> <Toolbar id="gse_id" caption="gse caption" showInitially="true"> <Items> <Item refID="esriGeoprocessingUI.GPSystemToolCommand" subtype="1" ...


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.


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.


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()); ...


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

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 ...


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 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: ...


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 ...


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 ...



Only top voted, non community-wiki answers of a minimum length are eligible