[GIS] ArcPy and centroids/points shapefile

arcgis-10.0arcpyshapefilevector-grid

I'm trying to create a point shapefile from a grid index polygon shapefile I created using ArcPy at ArcGIS 10.0 . I know this is simple, but could anyone give a few pointers out there. Here is what I've done now:
but my error is:

Traceback (most recent call last):
File "C:\Users\RLong\Documents\NewPoint.py", line 19, in <module>
arcpy.FeaturetoPoint_management("GridIndex", "SamplesLoc", "Centroid")
AttributeError: 'module' object has no attribute 'FeaturetoPoint_management'

Any ideas?

###Simple point shapefile object for testing
###
###Import standard modules
import os, sys, math, arcpy, traceback, string, fileinput
###Setup your workspace or file you're going to use
from arcpy import env
arcpy.env.workspace = "C:/Users/RLong/GIS_Data/Conversions/GridIndex.shp"
###setup local variables
in_Features = "GridIndex.shp"
point_location = "Centroid"
out_feature_class = "SamplesLoc"

###execute point
arcpy.FeaturetoPoint_management("GridIndex", "SamplesLoc", "Centroid")

Best Answer

if I remember correctly, you can use Feature To Point (Data Management) for getting centroids of your polygons.

import arcpy 
arcpy.FeatureToPoint_management(inFeat, outFeat, "CENTROID")

i hope it helps you....

Related Question