0

I have two objects to encode in GML:

  • A road (Name: E22, Type: Motorway, Geometry: Line)
  • A municipality (Name: Lund, Inhabitants: 100 000, Geometry: Polygon)

My code is writen as below. Can somebody me help me to check if there are something wrong? Thanks! (I uplodade gmlgeometry.dtd and gmlfeature.dtd to this XML Validation website: validationhttp://xmlvalidation.com/?L=0 and then validated my gml code. It tells me that there is no errors but I'm still no sure if my code is 100% correct or not.)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE FeatureCollection SYSTEM "gmlfeature.dtd" >

 <FeatureCollection typeName="countyModel">  
 <boundedBy>
   <Box srsName="EPSG:4326">
     <coordinates>55,13 57,16</coordinates>
   </Box>
 </boundedBy>  
  <featureMember typeName="modelMember">
   <Feature typeName="Road">
    <property typeName="roadName">
     E22
    </property>
  <property typeName="roadType">
     Motoway
  </property>
  <geometricProperty typeName="linearGeometry">
  <LineString srsName="EPSG:4326">
     <coordinates>55.7,13.2 56.0,14.2</coordinates>
  </LineString>
  </geometricProperty>
  </Feature>
  </featureMember>

  <featureMember typeName="modelMember">
   <Feature typeName="municipality">
    <property typeName="municipalityName">
     Lund
    </property>
  <property typeName="Inhabitants">
     100000
  </property>
  <geometricProperty typeName="extentOf">
  <Polygon srsName="EPSG:4326">
     <outerBoundaryIs>
     <LinearRing>
     <coordinates>
     55.732156, 13.163062 55.731638, 13.199109 55.729597, 13.213324 55.728147, 13.222062 55.728147, 13.222062
     55.718784, 13.228900 55.718970, 13.241569 55.705166, 13.253732 55.700243, 13.254245 55.697728, 13.247259
     55.690654, 13.246293 55.695686, 13.228813 55.687551, 13.216811 55.692306, 13.208559 55.682716, 13.190199
     55.690547, 13.164610 55.701009, 13.161529 55.701203, 13.157238 55.706036, 13.151556 55.706617, 13.151731
     55.709136, 13.160843 55.709717, 13.160843 55.712424, 13.156377 55.712616, 13.149490 55.718516, 13.150019
     55.718516, 13.150535 55.724319, 13.150014 55.726641, 13.154306 55.730409, 13.155685 55.732156, 13.163062     
     </coordinates>
     </LinearRing>
     </outerBoundaryIs>
  </Polygon>
  </geometricProperty>
  </Feature>
  </featureMember>
</FeatureCollection> 
  • You could try to validate your XML using for example w3schools.com/xml/xml_validator.asp – julien Nov 25 '14 at 17:31
  • @julien yes I did that, but I just wondering if e.g. I should write <Feature typeName="municipality"> or just <property>municipality</proerty>? Or use <name>E22</name> instead of <property typeName="roadName">E22</property? – ZhangYao Jiayin Nov 25 '14 at 17:56
  • I use xmllint to validate GML against a supplier supplied XSD. I know much less about DTD validation, but you could try validating against schemas.opengis.net/gml/3.2.1/gml.xsd – John Powell Nov 25 '14 at 17:59
  • @JohnBarça Hi John, I validated my code at xmlvalidation.com/?L=0, it tells me that there is no errors. I'm not sure if I should trust it or not. I'm worried if I have used wrong elements in the code. – ZhangYao Jiayin Nov 25 '14 at 19:31
  • GML shouldn't be used "alone". You need to specify which of the GML profiles you are using. One common example is simple features. Is that what you want (or what the consumer of this file needs)? – BradHards Nov 25 '14 at 21:00

Your Answer

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

Browse other questions tagged or ask your own question.