I'm looking to import data into my geodatabase from an .xml file using the import XML workspace document utility that comes from right clicking the geodatabase in ArcCatalog . Only problem is my source data is in .csv. What's the best intermediary way to get my data into an .xml file that matches my geodatabase?
-
Why does it need to be XML? The workspace document is very specific and I wouldn't like to have to write one out. Import it the CSV into a personal/file geodatabase and then export XML recordset document if you must.– Michael StimsonDec 18, 2014 at 21:38
-
I need to ensure that the data I give these guys matches their schema exactly. They sent me an .xml file to make sure that it matches. Their workflow is to do an export from a datacollector into .xml and populate their .gdb in one move. They want the data I provide to do the same.– gorddevDec 18, 2014 at 21:52
-
Is their schema an Esri workspace document? Match the database to their schema then export the whole database including records. If you want to do this in one step be prepared to create a model or python script.– Michael StimsonDec 18, 2014 at 21:54
-
So this is the intermediary step I need. I can't change the .csv output I get from my own datacollector. I need to turn my .csv into an .xml through a process of import as .csv while mapping it to their schema then exporting as .xml. I can't think of a utility to do this.– gorddevDec 18, 2014 at 21:58
-
This is why ArcGis has modelbuilder and arcpy. There are a few simple steps that you can string together into a single interface. Of course you could perform each step manually if you really don't want to code or learn about model builder...– Michael StimsonDec 18, 2014 at 22:04
1 Answer
Here's what I would do
Using the XML document they sent you, create a geodatabase and then a new feature class to the specifications of the XML by right-clicking in the GDB and choosing Import > XML Workspace Document. This creates a new feature class in the schema you have to match.
Then I would create a new feature class from your CSV data, building a point dataset that at this point DOES NOT match your XML schema.
Then, using the temporary schema you created earlier, right click the feature class you want to eventually re-create and choose the LOAD DATA option.
This dialogue will eventually give you a schema matching option, where you can map your CSV schema to your XML schema:
Example:
From there, you can export your CSV data as an XML recordset document, which is now your CSV data mapped to the exact specifications of your original XML document.
You should be good to go...