Hot answers tagged c#
Assuming you have a reference to the feature class pFC: ERSI.ArcGIS.Geometry.ISpatialReference pSP = ((ESRI.ArcGIS.GeoDatabase.IGeoDataset)pFC).SpatialReference; coord=pSP.FactoryCode coord now contains the code for the coordinate system. Note that not all projected coordinate systems are defined in esriSRProjCSType, there are more constants ...
To select from the map using the current selection environment (you can turn off selectability and visibility of layers then this wont pick them up. Firstly you need to be creating a tool: using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.ArcMapUI; using ESRI.ArcGIS.Geometry; using ESRI.ArcGIS.Framework; using ESRI.ArcGIS.esriSystem; using ESRI.ArcGIS.Display; ...
I am going to write this in VB.Net since that is what I know, and hopefully you can figure out the C# way to do it: To find all the layers, use IEnumLayer interface: Dim pEnumLayer As IEnumLayer = My.ArcMap.Document.ActiveView.FocusMap.Layers(Nothing, True) The second argument determines if this drills down into composite layers. To get the layer from ...
Not sure by your question if you want the map spatial reference or a layer. For a map you may use the IMap.SpatialReference Property.
You would do something like this: dataset = "c:/data/landbase.gdb/Wetlands" spatial_ref = arcpy.Describe(dataset).spatialReference as per the ESRI help page here
Cast them to ints, add them and recast back to esriSnappingType, like: snappingEnvironment.SnappingType = (esriSnappingType) ((int)esriSnappingType.esriSnappingTypePoint + (int)esriSnappingType.esriSnappingTypeEndpoint + (int)esriSnappingType.esriSnappingTypeVertex + (int)esriSnappingType.esriSnappingTypeEdge);
Your code looked ok to me. I did simplify it a bit so I could run it to as an add-in Button and it worked fine in 10.2.2. You will be able to run this on two layers, The first layer in the Map will need to have a field called ID, and the Second layer needs a feature with OID 5 as written. What line is the code failing on? public class Button1 : ...
You can't cross thread boundaries with COM objects, I'm guessing that's your issue. Read this help topic for some strategies to get around this.
I found the solution thaks to : ArcObjects: Memory leak in IFeatureClass.Search (only on SDE with direct connect) Code correction : ITopologicalOperator4 topoOperateur = ((IClone)secteurPsr.Shape).Clone() as ITopologicalOperator4; IGeometry geomPsr = ((IClone)currentPsr.Value.Shape).Clone(); IPolyline polylinePsr = geomPsr ...
Only top voted, non community-wiki answers of a minimum length are eligible