Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to generate gml/wfs/wms classes from the OGC schemas. Using xsd2code I receive numerous errors, one of them being "Invalid particle derivation by restriction". I'm curious is anyone has successfully generated .NET classes from the OGC schemas and if so, how?

share|improve this question

I just tested it and seems to be working although i didn't know such a thing existed :-) Here is what i did.

  1. Downloaded the gml schema from here..gml schema
  2. Extracted the zip
  3. In Visual Studio 2008, Created a blank project in c#.
  4. dragged the extracted files to this project using windows explorer.
  5. Right clicked a xsd file and clicked Run Xsd2Code.. enter image description here
  6. Got the results after a 1 minute wait.. enter image description here
share|improve this answer
It's true that it does generate some classes this way but it does not, in general, work. For example I attempted this same thing on 3.2.1/gml.xsd and received "The global element ' has already been declared." It seems the xsd is incorrect or otherwise incompatible with .NET. It appears to be defined in 3.2.1\gmlBase.xsd as well as several xsd's under iso\19139. – ca0v Apr 23 '12 at 15:00
@user2023 - which is the visual Studio version you are using? – vinayan Apr 23 '12 at 15:40
2010 Professional 10.0.40219.1 SP1Rel...don't think it's VS that is the problem because I get the same error when running Xsd2Code from the command line. Are you able to generate the proxies starting with 3.2.1/gms.xsd? I got my xsd's from here. – ca0v Apr 23 '12 at 19:53
@user2023 - oops..i am getting the same error with that file.. – vinayan Apr 24 '12 at 1:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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