Tag Archives: Developers
File Geodatabase API – Beta 3 now available
The beaksnake saw its shadow this morning and so the File GDB API beta 3 download is up on the Geodatabase Resource Center.

What’s new for beta 3? Continue reading
File Geodatabase API – Beta now available!

I’m pleased to announce that we released the beta version of the File geodatabase API yesterday!
You can find details about the API in mylast post and you can find the actual download on the Geodatabase resource center.
There is also aFile API forum to support the beta program.
I know it feels long overdue so enough reading, get out there and try it.
Enjoy!
Streamlining spatial references

At ArcGIS 10, creating spatial references programmatically has become much easier.
Just to recap, a spatial reference is comprised of several parts:
- Coordinate system
- XY, Z, M resolution values
- XY, Z, M tolerance values
- XY, Z, M spatial domains (extents)
The Z and M coordinates are optional and needed only if a feature contains Z values (usually for elevation) or M values (for measurements along a line).
So what we’ve done is rolled the methods for setting domains, resolution and tolerance values into a few key methods, making the whole process more streamlined.
The Old
Prior to ArcGIS 10, if you created a spatial reference coordinate system through ISpatialReference::CreateSpatialReference, ISpatialReferenceFactory::CreateProjectedCoordinateSystem, or ISpatialReferenceFactory::CreateGeographicCoordinateSystem, the resolution, tolerance, and spatial domain values were not initialized. To create a complete spatial reference, you needed to call ConstructFromHorizon, SetDefaultXYTolerance and SetDefaultXYResolution methods.
At 9.3.1 and earlier the suggested steps for creating a spatial reference were as follows:
public static ISpatialReference3 CreateSpatialReference(int srID)
{
// create spatial reference factory
Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
ISpatialReferenceFactory3 spatialReferenceFactory = (ISpatialReference3)Activator.CreateInstance(factoryType);
// create the spatial reference
ISpatialReference3 spatialReference = (ISpatialReference3)spatialReferenceFactory.CreateSpatialReference(srID);
// From the ISpatialReferenceResolution intereface set the
// default domain and the default, XY, Z, and M resolution
ISpatialReferenceResolution spatialReferenceResolution = (ISpatialReferenceResolution)spatialReference;
spatialReferenceResolution.ConstructFromHorizon();
spatialReferenceResolution.SetDefaultXYResolution();
spatialReferenceResolution.SetDefaultZResolution();
spatialReferenceResolution.SetDefaultMResolution();
// From the ISpatialReferenceTolerance interface set the
// default XY, Z, and M tolerance
ISpatialReferenceTolerance spatialReferenceTolerance = (ISpatialReferenceTolerance)spatialReference;
spatialReferenceTolerance.SetDefaultXYTolerance();
spatialReferenceTolerance.SetDefaultZTolerance();
spatialReferenceTolerance.SetDefaultMTolerance();
return spatialReference;
}
The New
At ArcGIS 10, those methods for setting the domain, resolution and tolerance are included in the following methods:
- CreateSpatialReference
- CreateProjectedCoordinateSystem
- CreateGeographicCoordinateSystem
So, at 10 it is merely a case of creating the spatial reference factory singleton and then using the CreateSpatialReference method like this:
public static ISpatialReference3 CreateSpatialReference(int srID)
{
// create spatial reference factory
Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
ISpatialReferenceFactory3 spatialReferenceFactory = (ISpatialReference3)Activator.CreateInstance(factoryType);
// create the spatial reference
ISpatialReference3 spatialReference = (ISpatialReference3)spatialReferenceFactory.CreateSpatialReference(srID);
return spatialReference;
}
And on a one-third-the-length-of-the-blog-post side note, you may notice that we are using the ProgID and the Activator class to get a reference to the spatial reference factory interface. This is because the spatial reference environment object is a singleton, and may or may not have already been created by another class or method. If a SpatialReferenceEnvironmentClass singleton instance already exists, then the traditional creation of the ISpatialReferenceFactory interface by creating a new SpatialReferenceEnvironmentClass
ISpatialReferenceFactory3 spatialReferenceFact = new SpatialReferenceEnvironmentClass();
To get around this we use the ProgID and the Activator class which will either create a new SpatialReferenceEnvironmentClass instance if the singleton has not yet been created or it will return you an instance of the already created singleton object without the risk of an invalid cast exception.
This post was contributed by geometry-guru David Raleigh from the geometry team.
The Simplified Geodatabase Schema Part 4: Special cases for XML fields
A couple of months ago we discussed accessing the GDB_Items.Definition column of a 10.0 Geodatabase to extract information about the Geodatabase’s schema without ArcObjects (See part 1, part 2, and part 3).
Those posts mentioned two approaches for doing this. The first was to retrieve the Definition column’s value and query it using an API with a Document Object Model implementation. The second was to use the DBMS’s native XML functionality to retrieve specific nodes of the XML value.
Although using DBMS XML functions is usually preferable, it isn’t always possible to do so. One example of this is when using a Personal Geodatabase; since Access doesn’t have an XML type, the Definition column uses the Memo type instead.
The following example shows how to display the code/value pairs of a coded value domain named “PipeType” from a Personal Geodatabase using C# and classes from the System.Xml.XPath namespace:

Another case where native XML functions aren’t available is when accessing an ArcSDE geodatabase in Oracle. Due to limitations with the XML type in Oracle 10g, XML columns in Oracle geodatabase system tables use the ArcSDE XML type rather than the native Oracle type.
To enable reading these values without ArcSDE or ArcObjects libraries, views have been created for the two system tables with XML columns, GDB_Items and GDB_ItemRelationships, named GDB_Items_Vw and Gdb_ItemRelationships_Vw respectively. These views replace the XML columns of the actual tables with CLOB columns that can be read as text.
The following example shows how to display the code/value pairs of a coded value domain from an Oracle Geodatabase using C# and classes from the System.Xml.Linq namespace:

To query and view the contents of the CLOB columns, the Oracle server must be configured in a similar manner to use sql with ST_Geometry.
Refer to the “Configuring the Oracle listener to use ST_Geometry and ST_Raster” topic for more info on that.
2010 ESRI Developer Summit – Geodatabase Related Demo Theaters
Aside from the tech workshops that we mentioned in the last blog post, the geodatabase team also hosts demo theaters at the Dev Summit which are a shorter more hands-on, demo style of presentation.
Geometric Networks for Developers – Learn how to take advantage of the Geometric Network through code with examples on how to create, update and edit network features with examples of how to perform Trace Tasks; including the placement and use of Flags and Barriers.
Introduction to the Mosaic Dataset – The Mosaic Dataset is the data model for managing ortho images as well as basic level products from various sensor platforms. This session will briefly demonstrate techniques used in processing sensor data and focus on the key developer concepts of raster types and raster functions in managing sensor data in ArcGIS.
Introduction to Query Layers – Learn about the new ArcGIS 10 functionality that allows geographic information in databases to be quickly and easily integrated into GIS projects. Query Layers will allow developers to incorporate spatial and non-spatial data directly from a database removing the need to import this information into a geodatabase before it can be used by ArcGIS. This session will introduce developers to the query layers API and discuss some of the uses for this new data source.
A list and schedule of all the demo theaters can be found here. If you aren’t going to be in Palm Springs for the Developer Summit this year you will still be able to access this content. After the Developer Summit we will follow up with a post that links to all the tech workshops and demo theaters.
2010 ESRI Developer Summit – Geodatabase Track
The 2010 ESRI Developer Summit is almost a month away and the Geodatabase Team is busy preparing sessions for this year’s conference. The Geodatabase track will include some new sessions this year which will introduce some of the functionality we have been working on for ArcGIS 10. We thought it might be good to give a quick rundown of the sessions that will be part of the Geodatabase track this year to help those attending organize their schedule.
A great starting place for those developers beginning to work with the Geodatabase API is the half day seminar called The developers guide to the Geodatabase. This session will provide a high level overview of the API but is also a great refresher for those that could benefit from a GDB programming tune up.
A significantly retooled session at the 2010 developer summit, The developers guide to ArcGIS 10 Geodatabase data types, will be broken into three distinct mini-sessions. The sessions will intorduce the new Raster Type and discuss spatial types for Oracle and SQL Server.
For more experienced Geodatabase developers, Effective Geodatabase Programming will take a deep dive into some of the core parts of the geodatabase API expanding on best practices wherever possible.
With the continued concentration on open Geodatabase access in ArcGIS 10, Accessing your Geodatabase outside of ArcObjects is a new technical workshop that will explore the ways a Geodatabase can be accessed without using ArcObjects.
Developers who work with geodatabase replication will certainly be interested in the Distributed Geodatabase Development session. This technical workshop will help developers build systems that manage and distribute data using the replication API.
Developers programming against ArcSDE geodatabases should definitely attend Implementing Enterprise Applications with the Geodatabase. This session will concentrate on some of the key programming patterns and best practices which should be employed when working with Enterprise Geodatabases.
Another new session this year is a deep dive into Geometry, Projections and Spatial Reference Systems. This workshop will have plenty of great content and is a must for any developers working directly with feature geometries.
Finally, ArcGIS Server developers concerned with providing editing solutions through web applications should consider attending Editing Geodatabases over the web using ArcGIS Server. This session will include an overview of existing approaches for editing Geodatabase data using ArcGIS Server, including a discussion of the Feature Service which is new functionality at ArcGIS 10.
Hope to see you in Palm Springs this year. Don’t forget you can meet members of the Geodatabase team at the official “Meet The Teams” function taking place 6:00 p.m.–7:30 p.m. on Tuesday, March 23rd.
New Code Sample – The Error Checker
James MacKay has submitted a NEW CODE SAMPLE to the ArcGIS Engine .NET Code Gallery called the Error Checker. This handy little snippet is a utility that takes an input decimal or hexadecimal error code and gives you a list of all potential enumeration values.
The download comes with documentation that goes into more detail of course, but this sweet workflow graphic should explain the utility’s ease of use:

If there was only a better way to annotate screen grabs …..
'Programming with the Geodatabase API' demo theatre posted
We’ve taken the slides, code, and data from the UC demo theatre “Programming with the Geodatabase API” and posted them up on the Engine Code Gallery.
This includes:
· The slides that were presented
· Code showing how to query, edit and create data in the geodatabase
· Code showing how to create custom components that work with the geodatabase API
You can check it out HERE
New Code Gallery Download: Geodatabase Domain Tools
A new sample has been added to the code gallery that shows how the Geodatabase API can be leveraged to provide greater control over domains than what is possible with ArcCatalog out-of-the-box. It contains a custom geodatabase property page, written in C#, which when installed will appear alongside the existing Domains property page. The page provides the following functionality:
- For ArcSDE geodatabases, displaying the owner of domains
- Sorting and reordering coded value domains
- Finding and optionally removing references to domains
- Exporting domains to XML workspace documents
Check out the sample HERE
ExecuteSQL Command for ArcMap added to ArcGIS Desktop .NET Code Gallery
During the Implementing Enterprise Applications with the Geodatabase presentation at the 2009 ESRI Developer Summit a couple weeks ago, we talked about a handy tool that can be added to ArcMap to send SQL to the connected database. This tool uses the IWorkspace.ExecuteSQL method and it can be very useful in starting and stopping a DBMS trace directly from ArcMap when profiling an operation.
The tool can be downloaded from the ESRI ArcGIS Resource Center for developers in the ArcGIS Desktop .NET Code Gallery. Click here to go directly to the tool.
