arcobjects

How to Convert ILayer to IPolygon In ArcObjects

Having trouble converting an Ilayer to an IPolygon. I am developing a toolbar for ArcMap and I grab a layer via code from the side table of contents. The Layer is a Polygon, but the code won't convert it to a IPolygon. Can anyone help me out? This is the code I am using to try and convert it to a IPolygon... IPolygon poly = m_docum...

How to Capture an OnMouseDown Event in a ArcMap Control?

I have a Control in ArcMap in which I created with buttons, A Listbox and some more buttons. I want to add coordinate items to the list box. Scenario: A user clicks a Add a Coordinate button on the control. The user then clicks on the map to add the coordinate find the coordinate on the map. The coordinate gets added to the list box....

ArcObjects: Why is my StandaloneTableCount 0? (IStandaloneTableCollection)

When I do: IStandaloneTableCollection collection = (IStandaloneTableCollection)MxDoc.FocusMap Then collection.StandaloneTableCount returns 0. I have created the new table via ArcCatelog and registered it as versioned. What am I missing? ...

How do I get the DropDown selection from a Command Button in ArcObjects?

I have a dropdown and a Icommand button in the same toolbar in ArcMap. I can't seem to get access to the dropdowns selection when I am using the command button. How can I find the dropdown so I can find out what the user just selected? Thanks Scott ...

Adding a Image Service layer to an ArcMap project with ArcObjects

I would like to add an ArcGIS Image Service programmaticaly using ArcObjects. My Image Service specs are below. Data Type: ArcGIS Image Service Service Name: Aerial Imagery 2008 AIS Service URL: ImageService://gisimage/2008_DOQQ Data Representation Type: RGB Thanks in advance. Jorge ...

selecting row among duplicated ones in VBA

ArcGIS 9.3 Arcobject I wanna select one row of each duplicated SIDs in a field below. (an attribute table of a shape file) The priority is R > S = I > 0 Therefore, among SID 87, FID1 will be selected. (SID 88, STATUS will be S+I) (SID 89, FID 6 will be chosen) Please kindly advise VBA cord to run the selection and thanks. FID SID...

MapScale not being persisted properly in mxd when programmatically changed outside of ArcMap environment

I am trying to change the scale of a map in an mxd OUTSIDE of ArcMap in a standalone Windows application. The problem is the scale is never persisted - the best code I have come up with is the following: private void UpdateMapScaleInMxd(double scale, string mxdFullPath) { IMapDocument mapDocument = new MapDocumentCl...

How to add the ToPoint and FromPoint of a line on one layer to another layer / feature class

I have a roads layer. I need to ad a point to another, point layer where ever roads intersect. How can I add such points to the existing points layer. In hand I have the line layer, the line feature / To and From Points, and the points layer. I just need a pointer as to how to create points in the points layer. I am using C# Thank you...

How to find points that intersect an envelope of a line, but not the line itself? (Envelope of a geometry)

I have 2 layers. A lines layer and a points layer. For any given line, how can I find the points that intersect the envelope of the line, but not the line itself, or more specifically, not the to point or from point of the line. I can obviously find all the points that intersect the line's envelope, and then do 1 by 1 tests on the foun...

Getting an Access 2007 table (.accdb extension) in ArcMap programmatically

I have recently found a script from ArcScripts on how to get an Access table in ArcGIS programmatically and it works well. But this is for Access 2003 (.mdb extension) and earlier. The code is posted below, and I want to know how to modify it for using Access 2007 (.accdb extension) and later databases. Attribute VB_Name = "Access_conne...

Unable to cast COM object (IMapServer --> IMapServerObjects)

I have just deployed an AGS-based application to our web server. This app worked great in development, but after deployment to the server I get the following errror: Unable to cast COM object of type 'System.__ComObject' to interface type 'ESRI.ArcGIS.Carto.IMapServerObjects'. This operation failed because the QueryInterface call on the...

How do you save an object to a fooSettings.settings file in Visual Studio?

Can you save an object to a settings.settings file in Visual Studio? If so how? I think you can make your object serializable and it should persist, but I'm not sure if I'm doing it right i.e. when I try to get the object back it is always null. Here is the code: [Serializable()] [XmlRoot(ElementName = "LayerTCA", IsNullable ...

ITopologicalOperator and Z Values

Hi, I have 2 polygon featureclasses with Polygon ZM features. I am trying to do a ITopologicalOperator.Difference() on these featureclasses but it errors saying that: Geometry cannot have Z values Does anyone know a way round this? PS - I am trying to emulate the same functionality as the Erase function in the Geoprocessing API -...

IEqualityComparer and weird results

Hello guys! Take a look at this class: public class MemorialPoint:IMemorialPoint,IEqualityComparer<MemorialPoint> { private string _PointName; private IPoint _PointLocation; private MemorialPointType _PointType; private DateTime _PointStartTime; private DateTime _PointFinishTime; private string _NeighborName; ...

Should I create a new geoprocessor object for each geoprocessing tool?

Common story: I develop an ArcMap extension using C#. Most problems can be solved by using all kinds of geoprocessing tools from ArcToolbox. What is generally more advisable: Creating a new geoprocessor object for each tool? Re-using one single geoprocessor object? When 1) is recommended, do I have to release the com object after a s...

How do I finding multiple Intersection results via ReverseGeoCoding in ArcObjects?

The project I'm working on requires me to find intersections near a point (searching a street centerline layer). For 90+% of my searches, I seem to be getting the appropriate results, however in certain instances I'm getting intersections that are technically intersections as far as ArcObjects is concerned, but not as far as what I need...

How to create variables from strings in arcobjects?

This hopefully is a simple question with a simple answer. If I have a list box or something that has a list of like 4 years (like 2006 through 2009), how do I programmatically make variables of these years with names like pTable2006, pTable2007, etc (as ITable of course). If this isn't possible and I have publicly declared these tables...

Writing an extension method for type T; how can I add a type constraint for a field of T?

Initial situation: I am working with a proprietary framework (ESRI's ArcGIS Engine) which I want to extend with some new functionality. I've chosen to use extension methods in C# for this. Shown below are the parts of the framework API that are relevant to this question: +------------------------+ IGeometry |...

Find Dangles of road shapefile

I have a road shapefile n I want to find Dangles without creating a topology, is it possible to find Dangles without topology with arcobjects please assest me coz its too much headach to create geodatabase, toplogy, n all things please assest me? Thanx in advance ...

Getting started with arcobjects, without aiming to be developer?

What is the best route or place to get started with arcobjects if one is not a developer and not aiming to become one? I've been using gis professionally for a long time, almost two decades, arcinfo/arcgis for most of that; I'm pretty good. I'm learning software development, and even have a modestly successful small python application u...