Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a set of polygons which we would like to sort and number according to their latitude. This will make it easier for local authorities to relate to the numbers of the objects.

I have looked around and not found any "out-of-the-box" solutions.

Any suggestions for how to solve this using Esri tools or open source tools are interesting.

share|improve this question
What is the key X,Y location on your polygons? The centroid or the northernmost vertex? – PolyGeo Jan 22 '13 at 9:42
Is Your polys living in a database? Why don't you use PostGIS functions to make this? – Magno C Jan 22 '13 at 9:57
Using the centroid would be ok. This time I need this to have the object names in a proper order. – ragnvald Jan 22 '13 at 10:17
Polygons residing in shapefiles only. I am aware of a solution available using PostGIS:… – ragnvald Jan 22 '13 at 10:27
up vote 7 down vote accepted

For an automated ArcGIS solution, try the following in model builder:

  1. Add a new field "Latitude".
  2. Calculate the "Latitude" field using Calculate Field: !SHAPE.FirstPoint.Y! (see attached field calculator screenshot). This calculation is based on the centroid of each polygon.
  3. Create a new shapefile using Sort. Note that the new shapefile will have a new OBJECTID based on the sorted Latitude values.

Or, to loop through a workspace and perform the tasks on multiple shapefiles, here is an automated python approach:

# Import arcpy module
import arcpy
from arcpy import env

env.overwriteOutput = 1

env.workspace = r"C:\temp"
Dir = env.workspace

# List shapefiles
fclist = arcpy.ListFeatureClasses()

for fc in fclist:

    # Process: Add Field
    arcpy.AddField_management(fc, "Latitude", "DOUBLE", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")

    # Process: Calculate Field
    arcpy.CalculateField_management(fc, "Latitude", "!SHAPE.FirstPoint.Y!", "PYTHON_9.3", "")

    # Process: Sort
    arcpy.Sort_management(fc, Dir + "\\" + fc + "_sort.shp", "Latitude ASCENDING", "UR")

enter image description here

enter image description here

enter image description here

share|improve this answer
  1. Assuming your data has a projected coordinate system: Set data frame to a geographic coordinate system (WGS84). Add your data. (Set datum transformation if nessesary.)
  2. Add a new field (ycoordinate). Right click field ycoordinate and calculate y-coordinate of centroid (use coordinate system of data frame for calculation.)
  3. Export data to Excel
  4. In Excel: sort field y-coordinate. In a new field (orderxls) calculate sequential numbers
  5. Join excel table to your data in ArcMap.
  6. Add a new field (order) in ArcMap. Use field calculator to copy values from orderxls to order.
share|improve this answer

One way to do this is to measure each polygons individual distance to a known point in the north. The North pole could be relevant here. This could be done making a script which iterates through all the polygons, makes a calculation of the distance to the North-Pole, and writes it to the file in a designated field.

A script solving this problem should be straight forward using arcpy.

share|improve this answer
Won't the distance (at least in Decimal Degrees) to the North Pole, if your polygons are all in the Northern Hemisphere, just be (90 - latitude)? – PolyGeo Jan 22 '13 at 9:44
An alternate approach to this would be to create a linestring to the north of your points, then use an order by distance() to create the output order you need. – BradHards Jan 22 '13 at 9:59
The latitude, also in decimal degrees, will wary according to the objects latitude. I believe the sketch solution above is valid. But if other options are there (for ArcGIS or QGIS I am all ears. – ragnvald Jan 22 '13 at 10:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.