Archive for the ‘ArcEngine’ Category

MXD Path update

August 8, 2009

Many times  I have faced same problem as described in this post. During application deployment phase of we may need to change all the data-source path to prod database.  Usually we dont have luxury of having ArcGIS Desktop/Catalog for updating the path or do some modifications on production environment. This is primarily because of additional license is required or production server will be entirely on other network or domain.  Due to security reasons also ESRI ArcGIS is not allowed on prod environment.  This becomes annoying when client wants to change the symbology or change the data source for some reasons.

One way to get rid of this issue is maintaining relative path on the mxd.  If you want all your new maps to be stored with relative paths, go to the File > Document Properties dialog box and click the Data Source Options button. Check the option to make relative paths the default for new map documents. This setting is stored in the registry. If this box is not checked, the default is absolute paths.  This will definitely save your effort.

You can still change the path if you have ESRI .NET assemblies installed and you need to write some scripts to achive the same.

If you are working with ArcEngine Java then you can use this tool .   Here is link for MXD Path editor for Java on linux / Solaris OS.

But issue here is whenever you change the connection properties of SDE i.e. if you want to change password alone. Then it hurts more. Reading .sde file to get connection properties using AO is a not possible. You can get connection properties straight a way.

A simple way to get the connection properties that it contains is to use it to open the SDE workspace. Once the workspace is opened, you’ll be able to access the connection properties. Note, the password will remain encrypted – you won’t be able to see it in plain text. ESRI is NOT providing option to decrypt the password since by design as it as for security reason.

Long back I have faced one issue when I saved some layers for which the datasource is SDE  feature classes. I ‘ve used  an SDE connection without save password option. But still I got SDE Connection prompt when I open a map using IMapDocument interface.  I could not supress this prompt programmetically, am not sure whether this issue is solved now.

You can click below link for read on usage of relative paths on MXD. Save a layers using relative path is optimal solution I would suggest for a developer for hassel free deployment.

How to use relative path


FAQ: What are the build numbers for all the recent releases of ArcGIS?

April 4, 2008


What are the build numbers for all the recent releases of ArcGIS?

Answer (from ESRI Support )

Build 535 = ArcGIS Desktop 9.0 final
Build 550 = ArcGIS Desktop 9.0 Service Pack 1
Build 560 = ArcGIS Desktop 9.0 Service Pack 2
Build 580 = ArcGIS Desktop 9.0 Service Pack 3
Build 589 = ArcGIS Desktop 9.0 Service Pack 3 + ArcGIS Desktop 9.0 Map Document Performance Patch

Build 722 = ArcGIS Desktop 9.1 final
Build 750 = ArcGIS Desktop 9.1 Service Pack 1
Build 780 = ArcGIS Desktop 9.1 Service Pack 2

 ArcGIS Desktop 9.1 Service Pack 2 displays as build 766 from ArcMap Help > About ArcMap.

Build 1324 = ArcGIS Desktop 9.2 final
Build 1332 = ArcGIS Desktop 9.2 Service Pack 1

 ArcGIS Desktop 9.2 Service Pack 1 displays as build 1324 from ArcMap and ArcCatalog Help > About ArcMap/ArcCatalog.

Build 1350 = ArcGIS 9.2 Service Pack 2

 ArcGIS Desktop 9.2 Service Pack 2 displays as build 1324 from ArcCatalog Help > About ArcCatalog.

Build 1380 = ArcGIS Desktop 9.2 Service Pack 3
Build 1420 = ArcGIS Desktop 9.2 Service Pack 4
Build 1450 = ArcGIS Desktop 9.2 Service Pack 5

 ArcGIS Desktop 9.2 Service Pack 5 still displays as build 1420 from ArcCatalog Help > About ArcCatalog.

ArcGIS 9.2 Service Pack 5 is available

March 27, 2008
ESRI released Service Pack 5 for the below products. Install and enjoy the fullest!
ArcGIS 9.2 Service Pack 5
ArcSDE 9.2 Service Pack 5
ArcIMS 9.2 Service Pack 5
ArcGIS Image Server Service Pack 5

Rotate Geometry without Editing-ITrasnform2D Interface

February 20, 2008

If you would like rotate/move set of features to certain degree/distance, you can easily make use of ITransform2D Interface(esriGeometry).  Methods in this interface, helps to rotate/move/transform the elements and geometries .

ITransform2D is a generic interface implemented by most elements and geometries (i.e., CircleElement, FrameElement, Point, Line, Polygon, etc.).  Use this interface when you want to update the position of the element or geometry through some type of Euclidan 2D transformation opertion (move, rotate, scale, or transform).

Once you did the necessary operations, you can store the geometry using IFeature:Store method. There is difference between using ‘Store’ method within edit session and outside. Calling Store within an edit session caches the edit until the edit session is ended. If a save is done, then the cached edits are written to the datasource. If no save is done, the cached edits are discarded. If you call Store outside of an edit session,  then the edit is committed immediately to the database. There is no way to rollback or discarded the changes. Hence it would be advised to use this with proper care. If you want to temporarily rotate/move ,then suits you well.

ITransform2D Interface Tutorial VBA Read the ‘Note’ carefully before using this sample.

Interface available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server

Finding :Workspace- Connected Database

February 14, 2008

Many of us wants to know the underlying database of workspace connected.  Use IDatabaseConnectionInfo2: when you want to know the type of DBMS the workspace is connected to. For example, when connected to a SQLServer database ConnectionDBMS will return the enumeration value corresponding to a SQLServer database. GeodatabaseServerClass Property of this interface lists Server class types. i.e  Personal /Workgroup/Enterprise ArcSDE server.

Here is an sample in C#.NET


ArcEngine – 10 points command

February 1, 2008
  1. An ArcEngine application requires the geodatabase extension in order to edit data within an  SDE geodatabase.
  2. You can’t hide any layers in the toc control that are present in the map control.
  3. A geodatabase is a workspace and a workspace is a dataset. IDataset::Delete will delete dataset. Personal geodatabase is just a file and a file geodatabase is just a folder, so normal file system delete methods will work on them. 
  4. IGroupLayer and ICompositeLayer are the interfaces used to create and control the contents of group layers.
  5. IMapDocument allows you to work with an ArcMap project file in code. It has no relationship to the map control.
  6. Page layout control has a print method (IPageLayoutControl::PrintPageLayout).
  7. The vertical coordinate system is set through ISpatialReference3::VerticalCoordinateSystem.
  8. In .NET use the properties ending in “_2” to set them, those with out are read only.
  9. If you installed the developer kit after visual studio 2005 it should be automatically set up for you. The 9.2 integration kit is for vs 2005, while the 9.1 version is for vs 2003.  Click here for details
  10. Bookmark Tool : ControlsMapManageBookmarksCommand . You can get the collection of bookmarks from the IMap object via IMapBookmarks. If you create new bookmarks and want to persist them make sure to save the map document, unless you load them at run time. Click here