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'm trying to create a point shapefile from a grid index polygon shapefile I created using arcpy. 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 arcpy.FeaturetoPoint_management("GridIndex", "SamplesLoc", "Centroid") AttributeError: 'module' object has no attribute 'FeaturetoPoint_management'

Any ideas?

###Simple point shape file 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")
share|improve this question
    
look into point shapefile constructors and see what they take and what methods are involved that can change other files to fit a point shapefile from a grid index polygon shapefile. –  Carl Carlson Dec 4 '12 at 22:39
add comment

2 Answers 2

up vote 3 down vote accepted

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....

share|improve this answer
    
sorry, i havent seen @RyanDalton's answer when i was writing my answer. :) –  Aragon Dec 4 '12 at 23:52
    
I think you answered my question. I really need to understand the Geoprocessor object what is the diff between a put and get. Thx! –  DATAfiend Dec 5 '12 at 5:34
add comment

Are you trying to simply generate centroids of the polygons? If so, just use the Feature To Point (Data Management) tool. No need to write your own Python script/tool.

Of course, this assumes you have access to an ArcInfo license, as it is not available for ArcView or ArcEditor.

share|improve this answer
    
This tool does not put point in center of odd shaped features (e.g.) s shaped polygon even if you have the create inside check box checked. I believe there is a tool in ET Geowizard that does. –  artwork21 Dec 5 '12 at 0:02
2  
@artwork21, your statement is correct, but maybe a bit misleading. As long as you have the "inside" check box ticked on, it will create a point somewhere on the surface of the polygon. But you are correct that it will not put the point in the center of oddly shaped or multi-part polygons. –  RyanDalton Dec 5 '12 at 0:06
    
Ah, sorry must of forgot to check that check box. –  artwork21 Dec 5 '12 at 2:54
    
@RyanDalton, I just have ARCVIEW 10. I don't got the money for an ARCINFO license. –  DATAfiend Dec 5 '12 at 5:33
1  
You can select vertices, centroids, centroids inside, or labels with the tool. Newest version of ET GeoWizards is 10.2. I think it has a limit on how many features it will process though. Might have to chop it up. –  Baltok Dec 5 '12 at 19:26
show 3 more comments

Your Answer

 
discard

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.