Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need to create a buffer around each point of a points feature class. I would then want to use the point buffers to clip the streets feature class to calculate the length of the clipped streets using ArcPy.

I need some guidance in summarizing the length of the streets regarding their types.

The "summarizing" in the following script does not work, I receive the following message:

ERROR 000732: Input Table: Dataset roads_0 does not exist or is not supported
ERROR 000800: The value is not a member of SUM | MEAN | MIN | MAX | RANGE | STD |   COUNT | FIRST | LAST.
Failed to execute (Statistics).

My ArcPy script so far:

import arcpy

arcpy.env.workspace = "D:/Data/ToYahya"

# Perform the buffer which will create one circular buffer per site
arcpy.Buffer_analysis("test_point.shp", "Buffer_test.shp", "50 Meters", "FULL",   "ROUND", "NONE", "")

# Open a search cursor and use the geometry of each buffer polygon in turn to Clip roads
# Use the id of each buffer polygon as suffix on the out road shapefile
features = arcpy.SearchCursor("Buffer_test.shp")
for feature in features:
      bufferPoly = feature.SHAPE
      arcpy.Clip_analysis("road.shp", bufferPoly, "road_" + str(feature.FID))

      arcpy.Statistics_analysis("road_" + str(feature.FID), "outStatsTable", "Shape_Leng", "type")
del feature,features
share|improve this question

closed as unclear what you're asking by PolyGeo, Devdatta Tengshe, iant Aug 6 '13 at 8:47

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Where are you stuck? Are you getting any error messages? –  Devdatta Tengshe Aug 6 '13 at 4:10
    
Your indentation after the for line looks wrong - can you check that and then run the script again and just report the first error you see. The two errors posted look like they come from separate runs. –  PolyGeo Aug 6 '13 at 21:42
    
i checked the code, everything is correct but i got the same error mentioned above...... i do not know where is the error –  Yahya Aug 7 '13 at 8:09
    
thank you everybody for help actually i found the solution where i changed the clip and statistic code like following: arcpy.Clip_analysis("road.shp", bufferPoly, "road_" + str(feature.FID)+".shp") arcpy.Statistics_analysis("road_" + str(feature.FID)+".shp","outStatsTable_"+ str(feature.FID), [["Shape_Leng", "SUM"]], "type") –  Yahya Aug 7 '13 at 12:48

1 Answer 1

up vote 2 down vote accepted

The following should work - just run each tool interactively to work out the parameter values, then Copy As Python Snippet each result from the Geoprocessing | Results window into a Python script and your done:

  1. Buffer
  2. Clip
  3. Summary Statistics

I've modified your code quite a lot below. It is untested but should work as long as your sites.shp has a field called "id" with unique values. I will leave you to incorporate the Summary Statistics part because I do not know where/if you are already storing lengths in the roads.shp.

import arcpy

arcpy.env.workspace = "D:/Data/ToYahya"

# Perform the buffer which will create one circular buffer per site
arcpy.Buffer_analysis("Sites.shp", "Buffer.shp", "400 Meters", "FULL", "ROUND", "NONE", "")

# Open a search cursor and use the geometry of each buffer polygon in turn to Clip roads
# Use the id of each buffer polygon as suffix on the out road shapefile
features = arcpy.SearchCursor("Buffer.shp")
for feature in features:
    bufferPoly = feature.SHAPE
    arcpy.Clip_analysis("road.shp", bufferPoly, "road_" + str(feature.id))
del feature,features
share|improve this answer
    
thank you for your answer, i have applied the processing you mentioned but the results does not fit my requirements where i got one bufer layer and one clip layer, but i need to generate one buffer layer around each point and one clip layer for each buffer. so please can you help me..... –  Yahya Jul 22 '13 at 11:07
    
You can use arcpy.SearchCursor to get the geometry of each buffer and then use that to Clip the lines and perform Summary Statistics multiple times. –  PolyGeo Jul 22 '13 at 11:24
    
that's what i am searching for (SearchCursor) but i could not write the correct code, so please can you send me how to wirte the code. thanks in advance –  Yahya Jul 23 '13 at 8:10
    
Can you post your code so far into your question, please? I always prefer to see how far someone has progressed before helping with where they are stuck. –  PolyGeo Jul 23 '13 at 9:13
    
I added the code to my question..... –  Yahya Jul 23 '13 at 10:44

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