Extent missing in xml definition, but present in ArcMap

3064
5
06-13-2011 08:33 AM
eykim
by
New Contributor
Hi there,

I have this dataset, whose feature class (centroids) has a UTM projection, but the projection is not included in the xml definition itself. In this case, how do I go about extracting projection from the feature class? Is there such thing as default?

Attached is the dataset I've been looking at.. Thanks.
0 Kudos
5 Replies
LanceShipman
Esri Regular Contributor
The included Montgomery.gdb does not include a feature class named centroids. Are you using Final or Beta 3?

The following code exports the XML from the Blocks feature class. It does include the spatial reference.

#include <string>
#include <iostream>
#include <fstream>

#include <FileGDBAPI.h>

using namespace std;
using namespace FileGDBAPI;

int main()
{
  // Open the geodatabase.
  fgdbError hr;
  wstring errorText;
  Geodatabase geodatabase;
  if ((hr = OpenGeodatabase(L"C:/FileGDB_API_Issues/Montgomery.gdb", geodatabase)) != S_OK)
  {
    wcout << "An error occurred while opening the geodatabase." << endl;
    ErrorInfo::GetErrorDescription(hr, errorText);
    wcout << errorText << "(" << hr << ")." << endl;
    return -1;
  }

  Table table;
  if ((hr = geodatabase.OpenTable(L"\\Landbase\\Blocks", table)) != S_OK)
  {
    wcout << "An error occurred while opening the table." << endl;
    ErrorInfo::GetErrorDescription(hr, errorText);
    wcout << errorText << "(" << hr << ")." << endl;
    return -1;
  }

  string tableDef;
  if ((hr = table.GetDefinition(tableDef)) != S_OK)
  {
    wcout << "An error occurred while opening the table." << endl;
    ErrorInfo::GetErrorDescription(hr, errorText);
    wcout << errorText << "(" << hr << ")." << endl;
    return -1;
  }

  ofstream myfile;
  myfile.open("../Blocks.xml", ios::out);
  myfile << tableDef;
  tableDef.clear();
  myfile.close();


  // Close the table
  if ((hr = geodatabase.CloseTable(table)) != S_OK)
  {
    wcout << "An error occurred while closing Cities." << endl;
    ErrorInfo::GetErrorDescription(hr, errorText);
    wcout << errorText << "(" << hr << ")." << endl;
    return -1;
  }

  // Close the geodatabase
  if ((hr = CloseGeodatabase(geodatabase)) != S_OK)
  {
    wcout << "An error occurred while closing the geodatabase." << endl;
    ErrorInfo::GetErrorDescription(hr, errorText);
    wcout << errorText << "(" << hr << ")." << endl;
    return -1;
  }

  return 0;
}
0 Kudos
eykim
by
New Contributor
Sorry. I attached a wrong file.

With this attachment, I saw:
1. Landbase feature dataset
2. Water feature dataset
3. Centroids feature class.

In ArcMap, you will see dataset # 1 and # 2 have the same projections and #3 has something else (WGS 84). I can't seem to find the spatial reference from the xml definition of #3.

And yes, I've updated file gdb library to final release 1. I'm looking forward to seeing more features in the next releases.

Thank you for help...
0 Kudos
LanceShipman
Esri Regular Contributor
How was the Centroids feature class created? The spatial reference is missing from its description. ArcGIS is getting the information from an alternate location. It should be in both locations.
0 Kudos
eykim
by
New Contributor
On EDN portal I downloaded something called ArcGIS_Desktop10_Tutorial_121093.iso and in there was a folder called BuildingAGeodatabase.  I assume you have access to the portal.

I have another question for you. One of the feature class in that dataset is of Annotation feature class. Will the geometry type of annotation feature class always be polygons? Can they be multipoints?


Layer name: Distribution mains diameters

Data Type: File Geodatabase Feature Class
Location: C:\output\bugzilla\847\Montgomery_ref.gdb
Feature Dataset: Water
Feature Class: DistDiam
Feature Type: Annotation
Geometry Type: Polygon
0 Kudos
LanceShipman
Esri Regular Contributor
The Montgomery.gdb included in the Tutorial does not include a feature class named centroids. In any case the spatial reference information is stored in two locations. The data in both locations should be the same, but centroids case, it's not. This should never happen, so I'm trying to get an idea of what workflow created it. We are modifying the API to look in both locations when we output a feature class or feature dataset description.

The annotation feature class geometry type is always polygon.

Please note that annotation is not supported by the API. You can read the table, but insert or update is blocked.
0 Kudos