File Geoatabase API

ESRI has released File Geodatabase API to access ESRI schema without having to have ArcObjects license. This is a simple way out to analyze the data  and create custom report of features outside of ESRI ecosystem.  For non -ESRI developers this is a boon and for .Net developers it is ease to  utilize Microsoft .Net or C++ libraries to access the File Geodabase Objects.  ESRI is doing incremental update on this and soon they will release Java API to access as well.

 

Google Maps -Retail Marker

Recently  we developed Google Maps Application for one of clients displaying markers for Retail Layers and Georgia DOT points.

Here is the live url

http://www.socketweb.us/gmapstest/goodgroup.html

Tagged with:
 

Single- User Geodatabase

If you wanted to create a small geodatabase with few feature classes or object classes you have two options.

  • ESRI File Geodatabase
  • Personal Geodatabase (Microsoft Access Database)We recommend to use ESRI File Geodabase, because it is simple and all data is stored in a folder with the .gdb extension. It is robust and it has 1 Terabyte per table size limit  compared to Microsoft’s 2 GB total database limit.  However both of them they don’t support ESRI versioning support. Here are top reasons to select file geodatabase option.  (1)  Improved versatility and usability. (2) Optimized performance for ArcMap editing (3) Easy Data Migration between geodatabases (4) Few size limitations for import/export operations (5) Custom Storage Configuration to support /store large raster images.
 

Convert ESRI shape to Latlong

Recently we developed a web mapping application to lay GA DOT data over Google Maps.  The GA DOT data was in ESRI Geodatabase format.. We had to extract Lat/Long from ESRI Shape field.  If you run into problem like this you can use this script to get Lat/Long from ESRI shape.

#region Get LatLong
private IPoint Convert2LatLongPoint(IGeometry inputGeometry)
{
try
{
//Create Spatial Reference Factory
ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass();
IGeographicCoordinateSystem gcs = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
ISpatialReference sr2;
sr2 = gcs;
//Point to project
IPoint inputPoint = new PointClass() as IPoint;
inputPoint = (IPoint)inputGeometry;
//Geometry Interface to do actual project
IGeometry geometry;
geometry = inputPoint;
geometry.SpatialReference = inputGeometry.SpatialReference;
geometry.Project(sr2);
IPoint outputPoint = new PointClass();
outputPoint = geometry as IPoint;
System.Diagnostics.Debug.WriteLine(outputPoint.X);
System.Diagnostics.Debug.WriteLine(outputPoint.Y);
return outputPoint;
}
catch (Exception ex)
{
return null;
}
}
#endregion
Then update the feature using IFeature.Store() method.
IPoint newPoint = Convert2LatLongPoint(feature.ShapeCopy);
if (newPoint != null)
{
Double dbX; Double dbY;
dbX = newPoint.X;
dbY = newPoint.Y;
feature.set_Value(feature.Fields.FindField(“X”), dbX);
feature.set_Value(feature.Fields.FindField(“Y”), dbY);
feature.Store();
}
 

Traditionally we upgrade geodatabase by running ArcSDE post process. In ArcGIS 10.0 you will use ArcCatalog tool to upgrade the geodatabase.

 

ArcGIS 10.0 Addins

Upgrading VBA to Addins is the new technique to recycle VBA projects and code. With ArcGIS 10.0 the following add-in types are supported in the current release:

  • Buttons and tools
  • Combo boxes
  • Menus and context menus
  • Toolbars
  • Tool palettes
  • Dockable windows
  • Application extensions
  • Editor extensions
 

Upgrading VBA in ArcGIS 10.0

VBA environment in ESRI ArcGIS Desktop is gone in the new version. If you have VBA customization for ArcGIS Desktop you have following options:

  • Python Geo-processing scripts
  • ArcGIS Addin – using Microsoft .Net Framework and Java

    ESRI has created an extensible model to create and manage addins. Click here to learn more.

 

Multiversion View !!

ESRI has introduced the concept of Multiversion view to update the featureclasses directly via SQL statements. We have been using this to extract data from featureclasses for reporting purpose. The multiversion view is created at ArcSDE level and do not participate in geodatabase behavior.

Steps for reading purposes only:

  1. Create a multiversion view
  2. Assign privileges or roles to the multiversion views
  3. Use them just like table.

Advantages:

  1. Quick, fast to access featureclass data.
  2. Can use ADO.Net to access and report on featureclass.
  3. Great performance while joining featureclasses.

Steps for editing multiversion view:

  1. Create a multiversion view
  2. Create a version to do you edits
  3. Start a edit session by calling edit_version or a custom function
  4. Do edits –> Save
  5. Stop edit version by calling a edit version or custom function
  6. Reconcile and Post edits via ArcGIS

At Socket Technologies we use multiversion view extensively for Enterprise Geodatabse reporting purposes.

 

ESRI Auto Labeling

As a ESRI ArcObjects developer you can automate the labeling by combining the data from fields.

While combining field values into one string and updating the target field is simple, there may be a situation where in you want to sort the values in ascending or descending order.Here is sample code where we are trying to combine three ESRI fields and sorting the data and then updating the field.

private void button1_Click(object sender, EventArgs e)

{
//create in memory ado.net datatable
DataTable dt = new DataTable(“KVASort”);
dt.Columns.Add(“KVA”,Type.GetType(“System.Int32″));
dt.Columns.Add(“PHASEDESIGNATION”, Type.GetType(“System.String”));
dt.Columns.Add(“FACILITYID”, Type.GetType(“System.Int32″));
DataRow dr = dt.NewRow();
dr[0] = “37.5″; //get this from field value
dr[1] = “C”; //get this from ESRI field value
dr[2] = “1000″; //get this from ESRI field value
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = “1000″;
dr[1] = “B”;
dr[2] = “1100″;
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = “7.5″;
dr[1] = “A”;
dr[2] = “0″;
dt.Rows.Add(dr);
//create a dataview from datatable’s dedault view.
//this is key for sorting to use default view
DataView dv = dt.DefaultView;
//sort –> see KEYWORDS DESC and ASC
dv.Sort = “KVA DESC, PHASEDESIGNATION ASC, FACILITYID ASC”;
string labeltext = string.Empty;
foreach (DataRowView drv in dv)
{
labeltext += drv[2] + “-” + drv[0] + “-” + drv[1] + “\n” ;
}
//alert ESRI Label Text before upating the actual field
MessageBox.Show(labeltext);
}
 

ESRI lets ArcGIS Server run 64 bit operating system.  There are known issues running ArcObjects code built on  Micorosft .Net platform on 64 bit operating system.

In Visual Studio the developers normally set the build–>Platform target to “Any CPU”, this needs to be changed and set to x86 platform, because ESRI ArcObjects run as 32 bit applications on a 64 bit Operating System. Please see the  screenshot from Visual Studio –>Properties–>Build–>General–>Platform target

Visual Studio Options

Visual Studio Options

Socket Tech Support Team