int main() { fgdbError hr; wstring errorText; // create geodatabase Geodatabase geodatabase; if ((hr = CreateGeodatabase(L"c:\\testing.gdb", geodatabase)) != S_OK) { wcout << "Geodatabase create error" << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } // load XML table def string tableDef; string defLine; ifstream defFile("C:\\create-chris1.xml"); while (getline(defFile,defLine)) tableDef.append(defLine+"\n"); defFile.close(); // create table from XML def Table table; if ((hr = geodatabase.CreateTable(tableDef,L"",table)) != S_OK) { wcout << "CreateTable error" << endl; ErrorInfo::GetErrorDescription(hr, errorText); wcout << errorText << "(" << hr << ")." << endl; return -1; } if ((hr = geodatabase.CloseTable(table)) != S_OK) { wcout << "CloseTable error" << 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; }
It isn't particularly wise to leave the coordinate system undefined. Using an impossibly large spatial reference does more harm than good, and origin and scale parameters cannot beadjusted later with the coordsys.
Unfortunately, when you set out to use the FileGDB API to create new tables, you are choosing to take over ArcGIS' role in feature class creation. Using generic parameters for table creation may be possible, but it's unlikely to generate high quality datasets -- if you don't know, at a minimum, the spatial units being used and the range of possible values (and alter the spatial reference to correspond to them) then I'd argue that it's not really worth the effort of loading the data.
We have duplicated your issue and are debugging it. I will be on vacation next week, so I will not get back to you until the week of July the 25th.
<Field xsi:type="esri:Field"> <Name>Shape_Length</Name> <Type>esriFieldTypeDouble</Type> <IsNullable>true</IsNullable> <Length>8</Length> <Precision>0</Precision> <Scale>0</Scale> <Required>true</Required> <Editable>false</Editable> <AliasName>Shape_Length</AliasName> <ModelName>Shape_Length</ModelName> </Field>
<HasSpatialIndex>true</HasSpatialIndex> <AreaFieldName/> <LengthFieldName>Shape_Length</LengthFieldName> <Extent xsi:nil="true"/>
<CLSID>{86E3C61F-7D4E-48DF-8B2E-AF71CD0BCB61}</CLSID>
<CLSID>{52353152-891A-11D0-BEC6-00805F7C4268}</CLSID>
Finally I changed the CLSID from<CLSID>{86E3C61F-7D4E-48DF-8B2E-AF71CD0BCB61}</CLSID>to<CLSID>{52353152-891A-11D0-BEC6-00805F7C4268}</CLSID>
Features - {52353152-891A-11D0-BEC6-00805F7C4268}
Rows - {7A566981-C114-11D2-8A28-006097AFF44E}
Features - {52353152-891A-11D0-BEC6-00805F7C4268}Rows - {7A566981-C114-11D2-8A28-006097AFF44E}
Membros conectados podem postar, seguir atualizações e mais. Novo aqui? Registre uma conta gratuita.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.