You are here: Popular Formats > Google KML Reader/Writer > Feature Representation > Documents and Folders > Element Order
Element Order
The KML writer uses the following criteria to determine the order of the contents of a KML Folder or Document:
- If the container has a "sort-by" attribute name specified via the kml_sort_by_attribute format attribute, the value of that attribute on each feature will be used to sort the contents of the container in ascending alphanumeric order. The "sort-by" attribute can also be specified using the KML21_SORT_BY_ATTRIBUTE defline parameter for features with user-defined schema
- Individual features can over-ride the value of any "sort-by" attribute with the kml_sort_value format attribute; the value of which will be used for determining the sort order.
- If neither of the above criteria is met, then the arrival order of each feature is used to determine the order of the feature in the container. This makes it possible to sort the features prior to being written to the KML writer.