How to change the order of features in a shapefile?
I don't know about Arc*, but for QGIS there is a Sort plugin: http://michaelminn.com/linux/mmqgis/
Here is a solution to rewrite a new and sorted shapefile using the GDAL/OGR command-line tool ogr2ogr
.
For example, a shapefile orig.shp
has a numeric field volume
to sort on. This particular SQL statement does a reverse sort (with DESC
) so that features with large volume
values are drawn before (underneath) features with small values:
ogr2ogr -sql "SELECT * FROM orig ORDER BY volume DESC" sorted.shp orig.shp
You can always open the attribute table in ArcMap and right click the columns header and select Sort Ascending.../Descending... for single fields.
For multiple fields you would instead click Advanced Sorting to select multiple fields.
NOTE: Adding, for instance, a sequential ID field based on the current sorting (which is temporary, stored only in this map/mxd) when using the above method will be ordered by the original OID/ObjectID of the feature class.
There is an ArcScripts available that will sort records permanently and output a new shapefile: http://arcscripts.esri.com/details.asp?dbid=16771
I do hope that when you state 'order of features' that this is the order found in the attribute table and not drawing order for the table of contents/symbology levels.