[GIS] How to convert GML to features in ArcObjects

arcgis-10.0arcgis-enginearcgis-serverarcobjectsdevelopment

How to convert GML to features and features to GML i ArcObjects?
We are building an application where we want to communicate with a service with GML but natively in our stand-alone application we want to use features and shapefiles.

Update: I have an ArcGIS Server so I could use that a bridge so I could use thatas a bridge beween the service and the client.

Best Answer

  1. You have my complete admiration for attempting this. You may be insane, but I'm discounting that possibility.
  2. Since you say ArcObjects / ArcEngine, I'm assuming a .NET implementation
  3. I would definitely start here. Somehow, you need to get generated classes from the XSD, and while you could do it yourself for whatever subset you need, it's gonna hurt. If there's any way to use LINQ (and it appears there is), I'd try that route.

If you can give a few more details on what you're trying to accomplish (r/o? r/w?), I suspect that someone can probably give you more specifics. What you're attempting is a largish, but not insurmountable problem.

Oh, and one quick (obvious in retrospect) question - does the server you're talking to generate WSDL? If so, then you should be able to get VS2008 or 2010 to consume that directly, making life much more pleasant.

Edit: Add specifics from minor experimentation:

Starting from the link previously, I was able to generate C# classes using XSD. This generates classes that will fail at runtime due to the problem of XSD & .NET not generating strongly typed lists correctly. I also tried the suggestions / fixes from this post, just to see what's changed. I'm unconvinced that changing the underlying data types from double/int, etc. to string is the greatest idea ever, but it should work. In both cases the command to generate classes is:

xsd.exe gml.xsd ..\..\xlink/1.0.0\xlinks.xsd ..\..\iso\19139\20070417\gmd\gmd.xsd ..\..\iso\19139\20070417\gco\gco.xsd ..\..\iso\19139\20070417\gss\gss.xsd ..\..\iso\19139\20070417\gts\gts.xsd ..\..\iso\19139\20070417\gsr\gsr.xsd /classes

And yeah, it's ugly. It also assumes that you've downloaded the entire set of schemas from OpenGIS.net (available here), which you've got to have to resolve all the references.

A quick comparison of the two resulting sets of classes shows surprisingly few differences (the original data type in parenthesis after the name of the changed member:

 DirectPositionType.Text (double)
 DirectPositionListType.Text (double)
 GridType.axisLabels (NCName)
 ParameterValueType.integerValueList (integer)
 MeasureListType.Text (double)

So, worst case, if you really needed to, you might want to use the "fixed" version of 3.2.1, and then update those few members to use custom serialization to get a more strongly typed implementation instead of simply using strings.

Related Question