POST
|
Thanks for the additional insight. The testing with model builder was a good call. The code generated from that (that worked fine) below. It is still somewhat unclear to me why my original code doesn't honor the split though. I don't believe the shapefile is the issue since I am creating a feature layer using MakeFeatureLayer_management. And, when I check the the field_info properties using getsplitrule after creation I see, for my numeric field in question, that "RATIO" is listed. I do appreciate the explicit connection between the created layer and the split policy that is evidenced in the model builder code version though. As to Wayne's point about apportioning population: I'm with you about the population density issues. However in this case this is census block data and the spatial resolution is fine enough where we're not worrying about minor spurious re-apportionment. It is actually useful to have sliver polygons that are output from the intersection have populations of 0 or 1 so we can catch the error easier. import arcpy
# Local variables:
blocks_01_alb_shp = "...\\blocks_01_alb.shp"
USA_int_131111 = "USA_int_131111"
State_01_int_7_shp = "...\\State_01_int_7.shp"
blocks_01_alb_Layer1 = "blocks_01_alb_Layer1"
# Process: Make Feature Layer
arcpy.MakeFeatureLayer_management(blocks_01_alb_shp, blocks_01_alb_Layer1, "", "", "FID FID VISIBLE NONE;Shape Shape VISIBLE NONE;STATEFP10 STATEFP10 VISIBLE NONE;POP10 POP10 VISIBLE RATIO")
# Process: Intersect
arcpy.Intersect_analysis("blocks_01_alb_Layer1 #;USA_int_131111 #", State_01_int_7_shp, "ALL", "", "INPUT")
... View more
11-22-2013
09:05 AM
|
0
|
0
|
1725
|
POST
|
Hi Wayne -- Sorry to keep this going but I've had trouble making this work in a stand-alone setting. I used the code above, which seemed to work fine. However, when I proceeded the intersect the ratio split policy wasn't honored. I'm wondering if I'm missing a step to connect the policy more explicitly back to the layer that is input to the intersect. Code below. Thanks for any thoughts, Mike inFeaturesAlb = "blocks_01_alb.shp"
layer = "temp_layer"
arcpy.MakeFeatureLayer_management(inFeaturesAlb, layer)
# Create a describe object
desc = arcpy.Describe(layer)
# Create a fieldinfo object
field_info = desc.fieldInfo
# Get index of desired field for which to set ratio policy
# Let's say your desired field is called 'area'
fldIndex = field_info.findFieldByName("POP10")
# Set the policy
field_info.setSplitRule(fldIndex, "RATIO")
######################################################################
#Do the intersection
#####################################################################
intOut = "State_01_int_3.shp"
inFeatures_int = [USA_layer, layer]
arcpy.Intersect_analysis(inFeatures_int, intOut)
... View more
11-22-2013
05:24 AM
|
0
|
0
|
1725
|
POST
|
Thanks, Wayne. This all worked out well based on your instructions. Mike
... View more
11-12-2013
07:27 AM
|
0
|
0
|
1725
|
POST
|
Hello, This thread also mostly addresses a question I had about the split policy with MakeFeatureLayer. I know that it is the right tool for me (as I distribute population data across intersected polygons) but I'm having trouble with the python syntax and the help item just refers the user to: " See the usages for more information." (and I don't understand where this is telling me to go.) So, could I get someone to copy in the syntax that you used to specify the "field_info" field and then specify that you wanted ratio splitting? Also, if I'm missing some "usages" section of the help text, please let me know. Thanks much! Mike ........ Mike Alonzo UCSB Geography
... View more
11-11-2013
07:42 PM
|
1
|
0
|
1725
|
POST
|
Hi -- I have been unable to create an operational layer in my mobile project that allows for editing. In AGS Manager-->Mobile Projects-->Select Mobile Services-->Edit there is the "Make Layer Editable checkbox. For me it is always grayed out. I understand there to be three criteria a layer must meet in order to be editable here: 1. Stored in an ArcSDE Geodatabase 2. Have GlobalID field 3. Not M or Z enabled. The layers I have tried to insert have met these criteria but I still cannot edit. Has anyone else run into this? Perhaps there is a more general setting that I have wrong here? I am on version 9.3 at the moment. thanks, Mike Alonzo
... View more
04-05-2010
01:01 PM
|
0
|
2
|
1981
|
Title | Kudos | Posted |
---|---|---|
1 | 11-11-2013 07:42 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|