Converting ESRI ITable to .NET DataTable

April 30, 2008

Ran into this interesting ArcObjects utility class yesterday.
To convert records of an ITable to an inMemory DataTable, use ESRI.ArcGIS.Utility.Converter.ToDataSet.

This works really well for data viewing.
However this interface seems to be now depracated and replaced with ESRI.ArcGIS.ADF.
The ToDataSet method is missing in the new interface.

Sample code:
ITable table = featureWorkspace.OpenTable(tableName);
IRecordSetInit recordSetInit= new ESRI.ArcGIS.Geodatabase.RecordSetClass();
recordSetInit.SetSourceTable(table, new QueryFilterClass());
IRecordSet recordSet= recordSetInit as IRecordSet;

System.Data.DataSet netDS = ESRI.ArcGIS.Utility.Converter.ToDataSet(recordSet);


Five Best Practices for Maintaining an ArcSDE Geodatabase

April 29, 2008

ArcSDE team has a very good blog posting on best practices for maintaining an SDE geodatabase. A must read for all users who are involved with working and maintaining geodatabases.

Here is the link
(http://blogs.esri.com/Dev/blogs/geodatabase/archive/2008/04/03/Five-Best-Practices-for-Maintaining-an-Enterprise-Geodatabase.aspx)


ArcMap: Working with multiple DataFrames

April 26, 2008

(From ESRI) The viewer window is a new window that was introduced at 9.2 to enable users to work with one data frame at multiplescales. In the 9.2 release if you opened a viewer window and then activated a different data frame in your map document, the viewer window was automatically closed. In Service Pack 2, ESRI has enhanced viewer windows so that you can use them to view inactive data frames. Now if you activate a different data frame while a viewer window is open, that viewer window remains on-screen, enabling you to work with multiple data frames side by side.

When you work with an inactive data frame in a viewer window, you can easily make the viewer show the same location that is currently displayed in the active data frame in the main ArcMap window. Similarly, you can update the location shown in the active data frame in the main ArcMap window to match the location shown in any of your viewer windows.

The ability to work with multiple data frames side-by-side in ArcMap can be useful for analysis, historical change assessment, data evaluation, and other applications where you want to be able to see different datasets for the same area side by side, as opposed to working with all the data in one data frame, or working with multiple map documents.

Pictures and more details demonstrating this can be found here

http://downloads.esri.com/support/downloads/other_/Whats_New_In_ArcGIS_92_Service_Packs-v5.pdf


Add layer to Map with “autoArrange”

April 16, 2008

One of the very common operations programmers do in ArcObjects is adding a layer to the Map. To do this there are two ways, one using IMap.AddLayer or IMapLayers.AddLayer.

IMap.AddLayer adds the new layer on the top of all the layers in the map. This is not very useful as we normally want the point layers at the top followed by polyline followed by polygon layers. Adding polygon layers at the top would mask all other layers below.

IMapLayers.AddLayer is preferable because it has an option to autoArrange the newly added layer in the table of contents. If autoArrange is set to TRUE, the layer is added in the proper position as by its weight specified via ILayerPosition::LayerWeight. By default, this means that the layers are sorted by layer type - Annotation layers on top, followed by Point geometry layers, Polyline geometry layers, and at the bottom Polygon geometry layers.


Unit Testing with ArcGIS

January 14, 2008

As a part of writing any unit-test to test the add-ins (buttons/tools/extensions) and their behavior in ArcMap, it is essential to automate starting ArcMap and running the commands. Here is a good article on how to automate ArcMap.


Changing Bitmap on BaseCommands/Tools at runtime

October 26, 2007

A common scenario that ArcObjects developers come across is creating a button or tool in ArcMap whose image changes when clicked.

Example: Say you wish to create a “LogOn” button whose bitmap needs to change to “LogOff” bitmap once the user has logged in.

Just setting base.m_bitmap to the new bitmap does not update the bitmap in ArcMap. Instead you need to use the BaseCommand.UpdateBitmap method.

Per ESRI .Net documentation:
UpdateBitmap changes the Bitmap for the command. Call this method to update the icon used for the command at runtime, after the command has already been instantiated.


IWorkspaceFactorySchemaCache

October 17, 2007

When working with bulk editing or editing operations that might cause performance hits, try using IWorkspaceFactorySchemaCache and enable schema caching. This is supposed to improve the performance. Some people have reported improved performance (3 times) on even DifferenceCursors when enabling schema cache.


File based geodatabase and ADO.Net

January 17, 2007

In our applications, we use Access based Personal GDB files to cache data in order to limit network read/writes and also improve performance by doing processing locally. The best thing with Access was ability to use Jet OleDB provider and ADO.Net to read/write and do complex math on our data. That way we are not limited to use relatively slower and limited functionality ArcObjects. However, the problem with Access is the delay in flushing data. We would insert some data to a table and sometimes this data would not be flushed to the mdb file, hence immediate reading of the table would not return the just inserted records.

As we are investigating other options, I liked the idea of file based gdb in ArcGIS 9.2. However, the limitation is inability to use ADO.Net Oledb provider to access data. ESRI Oledb provider can be used for reads (no inserts and deletes), but there is no documentation if it supports file based gdb. My wishlist for ArcGIS 10.0 would be for ESRI to extend the ADO.Net Oledb provider and give native access to ESRI geodatabase data.


ArcGIS 9.2 SP1 now available

January 2, 2007

The first service pack for the ArcGIS 9.2 release is available for
download. For a detailed list of issues addressed and to download the
patch, visit the appropriate page—ArcGIS 9.2 SP1, ArcIMS 9.2 SP1, or ArcSDE 9.2 SP1.


Is ESRI going Microsoft way with licensing?

December 15, 2006

Here is a really nice video parody on how Microsoft would have marketed iPod if it were their product (link).

With ArcGIS Server 9.2, ESRI seems to be going completely MS way. They have 3 different editions (Advanced,Standard,Basic) of the product in 2 categories(Enterprise,Workgroup). When we do all the permutations and combinations, it comes to 6 different versions of a single product. Isn’t it overkill.

There has been a lot of discussion in the blogger world on the new licensing evilness. I am really confused. Why could ESRI not make just 2 types of licenses … Enterprise and Strandard. Can you imagine a person purchasing Enterprise license with a Basic Edition? Never, if the user is willing to pay for Enterprise why would they pinch money limiting it to single cpu (oh, is it a single socket or a single core … arghhhh).

Confused

For those interested, here is a white paper on ArcGIS Server licensing (link). I am disappointed ESRI.