Saturday 21 April 2018

qgis - How to change the order of features in a shapefile?


I have a shapefile and I want to change the order of the features. Is that possible?


I want to sort the features in the shapefile because I'm embedding this shapefile in a mobile app. The app will display a list of features, and although I could do the sorting at load time, I'd prefer to have them sorted.



Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...