Monday, 16 March 2015

arcgis desktop - Reordering polygon shapefile permanently?



I've written a script which produces a polygon shapefile of the extents of all the thousands of rasters in our library. I want to organise the FID so that the files with the largest extents are on the bottom so that an area of interest can be easily selected.


By organise FID - i mean that the layers should be drawn (in the shapefile) from the smallest extent to the largest extent as otherwise (like in layer ordering) the record of the dataset that has the highest FID will get selected over anything below it. This is not a simple (temporary within map/layer) sort but it has to be to permanently change the order in which the rows are written into the shapefile.



Answer



You can reorder the shapefile by area, or any field, using OGR. Use the "order by" clause. This will create a new shapefile.


ArcGIS for Desktop (since 10.0), with an Advanced (formerly called ArcInfo) license, has a Sort command.


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...