Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

error at creating point shapefile from coordinates

$
0
0
Hello!

What I am trying to do here is to create a new point shapefile based on coordinates that are read from the atribute table of other shapefile. This is part of a larger script, I hope somebody can help me to overcome this problem.

the code:

Code:

outFolder = r"path to the destination folder"
arcpy.env.workpace = outFolder
outFC = "Reference.shp"
XCoord = X
YCoord = Y # X and Y are previously read from other table, if I set a print statement in the middle of the script they are:
                #X = 43.1016996631 and Y = 40.5788999672

sr = arcpy.CreateSpatialReference_management(r"path to WGS 1984.prj file")
arcpy.CreateFeatureclass_management(outFolder, outFC, "POINT", "","","", sr)

cur = arcpy.InsertCursor(outFC)
row = cur.newRow()
pnt = arcpy.CreateObject("Point")
pnt.x = XCoord
pnt.y = YCoord
row.shape = pnt
cur.insertRow(row)

del cur, row

Well, after this, a point shapefile is indeed created but the point does not fall at the indicated coordinates (43.1016996631 and 40.5788999672) but way far away, and when I read the coordinates of the point they are something like -0.000078, -0.000078.

Do you know what may be the problem?

Thank you very much!

Viewing all articles
Browse latest Browse all 2485

Trending Articles