-1

I am attempting to write the code for a toll in Python that will effectively:

  • access the city data and load it, if it isn't already in the list of layers
  • get a country name from the user and access just the cities inside that country
  • calculate the median POP_RANK of all cities in that country and report the median to the user

I am fairly new to Python, as this is all have so far.

import arcpy as ARCPY
def medianCalculation():
 mxd = ARCPY.mapping.MapDocument("CURRENT")
 df = ARCPY.mapping.ListDataFrames (mxd) [0]
 country = ARCPY.GetParameter(0)
 countryCursor = ARCPY.da.SearchCursor("cities", ["CNTRY_NAME", "POP_RANK"])
 POPDict = {}
 for country in countryCursor:
PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked May 4, 2015 at 16:35
1
  • You might have missed a piece of code. Commented May 4, 2015 at 16:38

1 Answer 1

2

You would need to look into some Help pages.

answered May 14, 2015 at 16:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.