1

How do I reorder the rows of the shapefile in the file? I know how to order them in the attribute table view, but I need to actually switch up the order (by descending id) in the file itself.

It's a little weird but the reason being eventually it will be turned into a geojson and drawn up in a webmapping project but the way the webmapping API works, the draw order is naturally in the order that is in the file, and when icons get very clustered, I'd like items with the lower id to take priority (e.g. be on top / drawn last).

There's probably a way around that in the webmap API but I think it'd just be much simple to reorder the table.

5
  • If you are using ArcGIS for Desktop to try and do this then I think you should include that detail, and the version you are using, in your Question.
    – PolyGeo
    Commented May 16, 2014 at 22:19
  • I used to be able to do this by opening the .dbf file in MS Excel, doing a sort, and then saving as the ancient version of dbase that the shapefile use. I'm not sure if newer versions of Excel can still do this, but it is worth a try. Commented May 16, 2014 at 22:55
  • Please note that the FIDs of the rows in a shapefile are transient during editing in ArcMap, not like OIDs that are constant for the life of the feature (create to delete) each time a feature in a shape file is edited the FID is removed and the feature is pushed to the end then they are compressed during save back to unique ascending. This behavior can be of use sometimes and other times it can be a real trap! Commented May 16, 2014 at 23:33
  • 2
    @Regan - If you did this, you were corrupting your shapefiles: The geometries would remain the same and their attributes would change. You'd certainly want to make a backup before you tried this.
    – Vince
    Commented May 17, 2014 at 2:44
  • @Vince - I feel like an idiot. I'd like to delete my comment, but it serves as a reminder of what not to do. Thanks for setting me straight. Commented May 17, 2014 at 17:47

0

Browse other questions tagged or ask your own question.