AnsweredAssumed Answered

Points added with da.InsertCursor have different coordinates than those used to create the point

Question asked by annehagerman on Jul 21, 2017
Latest reply on Jul 24, 2017 by annehagerman

I have over 2000 kmz files each with one kml for one point - tree locations.  From each file, I am extracting the x & y coordinates and using an insert cursor to add the point with the WGS 84 x & y.  Many of the trees are only meters apart and what seems to be happening many tree points are being placed on top of each other at a "rounded" long / lat location.  Although it keeps the 6 decimal places, they all default to the same incorrect long / lat.  I've taken a subset of my code with just the insert cursor code to show here and it gives the same incorrect results.

 

 

import arcpy


fc = r"D:\ProjectData\FPI_ARCTIC\02_Working\Interiror\Kamloops\StemMaps_1.gdb\Trees"

fields = ["SHAPE@XY", "TREE_NUM"]
# GCS = WGS 84
sr = arcpy.Describe(fc).spatialReference
arcpy.env.outputCoordinateSystem = sr

iCursor = arcpy.da.InsertCursor(fc, fields)


xCoord = -119.822445
yCoord = 50.449748
##point = arcpy.Point(xCoord, yCoord)
xy = (xCoord, yCoord)

iCursor.insertRow((xy, 90))

del iCursor

 

 

I have 6 points that are close to these (only the last 3 decimal places change) that are all defaulting to this long / lat:

 

As you can see, although the xCoord and yCoord are the degrees passed in, the point is created at -199.822388 and 50.44989.  I've also tried using SHAPE@ and a point geometry (commented out) and passing in the point instead of the xy with the same results.  I can't find any documentation talking about the insert cursor's precision with x / y in degrees.  Does anyone know why this might be happening?  .

Outcomes