Tag Info

Hot answers tagged

16

Shapefiles don't have any sort of symbology attached. Since you're working with ESRI tools, why not wrap them in a layer package? Here's how. From the link: "When users add a layer file to their maps, it will draw exactly as it was saved as long as they can get access to the data referenced by the layer." Just be careful to use relative paths, and keep ...


15

Most notably, always explicitly release cursors when you are done with them. I also release some enumeration objects which imply database access, for example IEnumRelationship you get from IRelationshipClass.GetRelationshipsForObject. Also, when you create a lot of COM instances which are short-lived (especially in tight loops), it is also a good idea to ...


10

According to System Design Strategies - Software Performance, an Esri technical article, file geodatabases are faster than shapefiles in their specific tests. They go into a lot of additional detail regarding what bottlenecks may exist and other performance considerations for various ArcGIS software use cases.


9

By "midpoint" I'm assuming you're asking about a centroid. For polygons, you'll want to cast it to an IArea object (see link for example), and then access the Centroid property. For points, you can simply get the X/Y property of the IPoint object. To get the feature, you can use various IFeatureClass methods such as GetFeature to access it using the ...


9

The trick to feedback is setting ISymbol.ROP to esriROPNotXOrPen and drawing the geometry twice, the first draw displays it, the second draw erases it. Be sure if you're using a multilayer symbol to set the ROP for each layer. public class MyTool : ESRI.ArcGIS.Desktop.AddIns.Tool { private ISymbol m_Symbol; private IPoint m_lastPoint; private ...


8

Yes, a shapefile in this context is a feature class just like any other feature class, regardless where it resides, be it folder-based (shapefiles), geodatabase or SDE workspace. There is no need for any conversion. Just open the shapefile feature class from the workspace and access the Fields property on the shapefile table. If you need to query for the ...


7

Take a look at the IRelationalOperator2 you can cast your polygon to that Interface and use the contains method.


7

I'd use a multilayer markersymbol with two symbol layers. The bottom symbol would be a picturemarkersymbol of a police car. On top of that would be one or more charactermarkersymbols, with the car number set via ICharactermarkersymbol.CharacterIndex. As I've said before, you really need to get Arcview arcmap if you haven't already done so. It has ...


7

It is probably best practice to confirm that a field exists before using it in a queryfilter. This can be done using the ITable.FindField or IFeatureclass.FindField method.


7

There are many options available for standalone windows app development. However the usability really depends on your programming platform and functionality requirements. GeoTools : GeoTools is an open source Java library that provides tools for geospatial data. SharpMap : SharpMap is an easy-to-use mapping library for use in web and desktop applications. ...


6

From the IGraphicsContainer.AddElement documentation: The parameter zorder is currently not utilized by all of the IGraphicsContainer implementations and is typically set to 0 when calling this method. You can alter the element z-order using methods like IGraphicsContainer.BringToFront, SendToBack, BringForward and SendBackward. I suppose ...


6

Often you can use the ISupportErrorInfo interface and GetErrorInfo system call in conjunction; many classes implement this to provide human-readable exception data. Also, some common HRESULT codes for geocoding.


6

So far I have not found anything to help me ease the debugging experience of the ESRI COMException, and therefore decided to try and do something about it. I put the solution on gist.github.com for everybody to use. I used the resource ArcObjects error codes and copied all the error messages with codes and enums into a text file, about 1900+ lines. Not all ...


6

To just see that other fields without caring about the geometry data, you can just open the dbf-file in any Excel, open office or something else reading dbf-files. Just be careful not to add or remove any rows, since that will corrupt the shapefile. /Nicklas


6

Using the MapDocument CoClass, you can do this (pseudocode, I don't know any .Net languages): void handle_layer(layer, data_sources) { data_layer = layer as IDataLayer group_layer = layer as ICompositeLayer if (data_layer != null) { data_sources.Insert(data_layer.DataSourceName.NameString) } if (group_layer != null) { ...


6

The layer's renderer can be accessed through IGeoFeatureLayer.Renderer. At this point, it depends on which type of renderer the layer uses, e.g. whether it is a simple renderer, unique values renderer, or something else. For list of common renderers, take a look at which classes implement the IFeatureRenderer interface. For example, if the layer uses ...


6

For the most part .NET garbage collection works well. There are some cases in ArcObjects that do important work on desctructors and the non-deterministic nature of the .NET wrappers can cause issues. This help topic covers the primary cases to be concerned about and how to manage releases.


6

Searching for arcengine+shapetype will help you find: IFeatureClass Or much faster if you like: check byte 32-35 of the file http://en.wikipedia.org/wiki/Shapefile


6

In general this shouldn't be a problem but there are some objects in the ArcObjects library that you want to be very careful about managing their lifetimes so that you don't tie up critical resources or keep locks on database tables for extended periods. Among lots of other good info, in this thread James MacKay lists some of the types of objects you should ...


6

I'm guessing you may have general performance issues such as labeling, layer scale rendering, transparencies..etc. If you have ArcGIS for Server license you may try using the Analyze button on the Service Editor to test a map document for these performance warnings. Service Editor helps you identify potential performance bottlenecks and errors that ...


5

The ArcGIS Engine software development toolkit is included for no extra charge as part of your annual subscription to the Esri Developer Network (EDN). Once you subscribe to EDN, you can download all of the software included with the bundle, including ArcGIS Engine through the Esri Customer Care Portal here: http://customers.esri.com/ For more ...


5

A simple renderer (ISimpleRenderer) will not do, you need to use an unique values renderer, which will work perfectly if you need to base your symbology on one column. It is implemented by the UniqueValueRenderer class, most of the work can be done via IUniqueValueRenderer interface. You basically map a column value (or a set of values) to a symbol. There ...


5

Feature classes and object classes do have their ids, which are unique within a single geodatabase. This very often satisfies most scenarios similar to yours. If you cannot uniquely identify a layer based on its feature class, you can leverage layer extensions to store arbitrary data with the layer. A layer extension can be added to a layer via ...


5

/// <summary> /// Places a marker on a map at an X and Y position. /// </summary> /// <param name="map">The map to place the dot on.</param> /// <param name="mapX">The X coordinate for the dot.</param> /// <param name="mapY">The Y coordinate for the dot.</param> /// <param ...


5

I'd leverage IEnvelope.Union. All IGeometry objects have an envelope, including points. Here's some pseudocode: envelope e = null Foreach point if e == null then e = point.Envelope else e.Union(point.Envelope) end if next point


5

I am going to go the other way and actually say that no, it is not a good performance improvement to separate the GeoDatabases for this particular use-case you described . You have to remember that there is a cost associated with a connection to a DB. In the case of the GeoDatabase, it is loading all the related metadata tables. So whenever you separate ...


5

I would try calling IScreenDisplay.InValidate, and pass in a cacheID for esriViewGraphics using IActiveView.ScreenCacheID. Do this after adding the graphics to the map by casting the map to IGraphicsContainer, and adding via AddElement.


5

ArcEngine Applications that you build, and Desktop Desktop applications that Esri builds both use ArcObjects under the hood. However, Esri did not use the controls in ArcEngine to build Desktop apps. For example the TOC Control in ArcMap, while it looks like the one found in ArcEngine, is really a different animal.


5

If you create an ancillary table with the attributes (fkey,xcell,ycell), populated from the objectid and a gridding of the maximum Y coordinate (or centroid coordinate or upper-center envelope coordinate), then you could use SQL to update the table, with something like: UPDATE poly SET num = vtab.rownum FROM ( SELECT row_number() over (order ...


4

You have my complete admiration for attempting this. You may be insane, but I'm discounting that possibility. Since you say ArcObjects / ArcEngine, I'm assuming a .NET implementation I would definitely start here. Somehow, you need to get generated classes from the XSD, and while you could do it yourself for whatever subset you need, it's gonna hurt. If ...



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