Trying to create a point shapefile from a text file

1100
4
07-06-2011 02:16 AM
MikeSquires
New Contributor
I am attempting to create a point shapefile from a text file.  The text file is space delimited with three columns; latitude, longitude, and snowfall.  I have done this before in ArcGIS 9.x.  However in Arc 10 I am having problems.  The script below produces a shapefile with the proper attributes and number of rows, but the geometry is messed up.  All points are located at 0, 0 lat/lon.  I have tried multiple variations but keep coming up with the same problem.  I have SP2 installed.  Any suggestions are appreciated.
Tags (2)
0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus
as of version 10, properties are case sensitive, hence your line
point.x
should be
point.X
and
point.Y    and   point.ID
0 Kudos
MikeSquires
New Contributor
Thanks Dan!  Can you suggest any references for ArcPy, especially for converting existing code.

Mike
0 Kudos
DanPatterson_Retired
MVP Emeritus
Start here   http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000001000000.htm  and keep reading.

other tips from within Pythonwin or other command line IDE

>>> import arcpy
>>> dir(arcpy)
['ASCII3DToFeatureClass_3d', 'ASCIIToRaster_conversion', 'AddCADFields_conversion', 'AddCodedValueToDomain_management', 'AddColormap_management', 'AddError', 'AddFeatureClassToTerrain_3d', 'AddFeatureClassToTopology_management', 'AddFieldDelimiters', 'AddFieldToAnalysisLayer_na', 'AddField_management', 'AddGlobalIDs_management', 'AddIDMessage', 'AddIndex_management', 'AddItem_arc', 'AddJoin_management', 'AddLocations_na', 'AddMessage', 'AddRastersToMosaicDataset_management', 'AddRepresentation_cartography', 'AddReturnMessage', 'AddRuleToTopology_management', 'AddSpatialIndex_management',.....etc etc

Or for a particular class...
>>> dir(arcpy.Point)
['ID', 'M', 'X', 'Y', 'Z', '__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_arc_object', '_go', 'clone', 'contains', 'crosses', 'disjoint', 'equals', 'overlaps', 'touches', 'within']
>>>

Or for help...
>>> help(arcpy.Point)
Help on class Point in module arcpy.arcobjects.arcobjects:

class Point(arcpy.arcobjects.mixins.PointMixin, arcpy.arcobjects._base._BaseArcObject)
|  The point object is used frequently with cursors. Point features return a
|  single point object instead of an array of point objects. All other feature
|  typesâ�?��?�polygon, polyline, and multipointâ�?��?�return an array of point
|  objects or an array containing multiple arrays of point objects if the
|  feature has multiple parts.

|  Method resolution order:
etc
etc etc

Have fun
0 Kudos
MikeSquires
New Contributor
Thanks!  This is helpful.

Mike
0 Kudos