A Simple GML Example: A Bridge
Explain Code<Bridge>
<span>100</span>
<height>200</height>
<gml:centerLineOf>
<gml:LineString>
<gml:pos>100 200</gml:pos>
<gml:pos>200 200</gml:pos>
</gml:LineString>
</gml:centerLineOf>
</Bridge>
The first element is <Bridge>. This is the root element, and I am assuming it is defined in the application schema defined by the international bridge building brotherhood. It is a feature; in other words, it is the thing we actually care about when it comes to drawing our map or doing our analysis. The next pair of elements <span>100</span> and <height>200</height> are again bridge specific things that are defined in the application schema. Now we come to the actual GML in this example: <gml:centerLineOf>. This is a GML element which is defined in one of the GML Schemas and describes what the geometry actually represents (in this case, the centerline of the bridge). This is a convenience property that is defined in GML - we'll look at the others later. Inside the centerlineof element is the <gml:LineString> element. This is another GML element. As we discussed above, a LineString is a series of points connected by straight lines. The individual points are displayed as <gml:pos>100 200</gml:pos> elements. A LineString contains as many of these pos elements as needed to represent the line. To save some space and processing time, you can also use a <gml:coordinates> element which can contain a list of points.