POST
|
Hi Alex, Turns out the issue was not with the insert cursor, it was with the feature class creation itself. It was created with the "entire" script and the coordinate system was set after the creation of the feature class with DefineProjection. When the spatial reference was set (WGS84) at the time of feature class creation, the insert cursor created the points accurately. We believe that when the projection was set after the feature class was created, the feature class was not updated before the points were added and it most likely did something with the precision / scale. Thanks for your feedback.
... View more
07-24-2017
12:48 PM
|
2
|
0
|
1414
|
POST
|
Hi Alex. Thanks for the response. My issue is not really with calculating the X and Y coordinates, it's with the creation of the actual points themselves. So, when I use that script and create the point from the xy variable, it actually gets created at (-199.822388, 50.44989) instead of my xy input of (-119.822445, 50.449748). Any thoughts?
... View more
07-24-2017
11:02 AM
|
0
|
2
|
1414
|
POST
|
Thanks Dan for the response. I did come across the help page you referenced above. Search Cursors and Update Cursors do allow you to set a spatial reference, however, Insert Cursors only have 2 inputs: InsertCursor (in_table, field_names) I could not figure out a way to set the spatial reference for my Insert Cursor.
... View more
07-24-2017
10:53 AM
|
0
|
0
|
1414
|
POST
|
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? .
... View more
07-21-2017
11:42 AM
|
0
|
7
|
2298
|
Title | Kudos | Posted |
---|---|---|
2 | 07-24-2017 12:48 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|