# ArcPy PointGeometry not placing the point on the correct value

241
1
03-18-2022 03:32 PM
Labels (1) New Contributor III

Hello,

Writing a script and am taking data from a sqlite3 database and inserting it into a gdb. Figured it out with just adding the x and y as a tuple into the insert cursor but also wanted to add elevation as it was an available field. It is successfully inserting the point but the point is not placed at the coordinate points that it was given.

Here is my code:

`sr = arcpy.Describe(output_table).spatialReference`
`if db_count > gdb_count: print(f'{collar_id} has {db_count} rows in the sqlite db and {gdb_count} in the gdb.') rows_no_geo = rows[-(db_count - gdb_count):] for rows in rows_no_geo:  # Convert tuple to list to extract needed data  rows_as_list = list(rows)  # Assign variables to needed values  # Lat, Long, Height first to build point geometry  lat = rows_as_list  long = rows_as_list  height = rows_as_list  geo = arcpy.PointGeometry(arcpy.Point(long, lat, height), spatial_reference=sr, has_z=True)`

I've tried with and without the spatial reference and it places it in the same point. For example one point is at 44.56669, -117.7572 and it is being placed at 41.6444452°N , 125.3000668°W. I'm assuming this has to be something to spatial reference but I don't know how to resolve it. I generally work in NAD 1983 Oregon Statewide Lambert (Intl Feet).

1 Solution

Accepted Solutions by MVP Frequent Contributor

Seems like you're taking a tuple of lat/longs and creating new points specifying those lat longs as xy for NAD83 oregon.  Probably placing all your points near to the false origin of the planimetric coordinate system.

``````#create wgs84 geometry first
geo = arcpy.PointGeometry(arcpy.Point(long, lat, height), spatial_reference="4326", has_z=True)

#theres a transformation_name parameter also if you have one
#NB you may have more control over using an arcpy method instead
geo_projected = geo.projectAs(sr)`````` by MVP Frequent Contributor

Seems like you're taking a tuple of lat/longs and creating new points specifying those lat longs as xy for NAD83 oregon.  Probably placing all your points near to the false origin of the planimetric coordinate system.

``````#create wgs84 geometry first
geo = arcpy.PointGeometry(arcpy.Point(long, lat, height), spatial_reference="4326", has_z=True) 