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.

  • did you ever decide on what your doing? Feb 24 '11 at 20:58
  • We ended up round-tripping to our database (SQL Server 2008 R2) where we converted and stored it as a geometry in the database. So we did not solve it on the client side, but @Petr-k answer is correct you can use the Data Interoperability Extension to convert GML. Feb 25 '11 at 6:46
  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.

  • 1. I would not be so sure :) 2. Yes, .Net 3. That's one way I could go, but not without making sure that there aren't any build-in ways in arcobjects to do this. Sep 12 '10 at 8:24
  • 1
    I don't know of anything in ArcObjects that deals with GML. As far as I know, you're on your own to build the mapping between the two technologies, which is a daunting enough task. I should have mentioned that looking into the .NET Topology Suite might be of some benefit; if they're not supporting GML, it might be worthy of an extension into that project. Also meant to ask - do you have control over the server side as well, or just your own stand-alone client?
    – Herb
    Sep 13 '10 at 1:46
  • Yes and no, I have access to our arcgis server but not to the service servicing the GML. Sep 14 '10 at 5:36

The only supported way that I know of, though indirect (via intermediate feature class storage), is to use the Data Interoperability extension. The API documentation does include, among other things, a short sample on GML conversion.

Alternatively, I might look into GDAL/OGR libray for which you'll be able to find .NET bindings. In any case, dealing with the conversion on your own is likely to be a major task.

  • I will take a look at the Data Interoperability extension. Sep 14 '10 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.