Prevent rounding of Coordinates

1403
3
Jump to solution
10-08-2014 07:23 AM
BenLeslie1
Occasional Contributor III

Working in lat long.  I'm doing a bit of code to get the bottom-left coord of a raster and then put a point in a shapefile at that location, however it appears that the lat/long coords are rounded to 3 decimal places when the shapefile is created - in the instance that I'm testing this means the point in the shapefile is offset by approx 2m which isn't good enough.  How can I prevent this rounding (it looks like I really want 13dp).

Here's my little bit of code:

#get coords

RasterLeft = arcpy.GetRasterProperties_management(myraster, "LEFT").getOutput(0)

RasterBottom = arcpy.GetRasterProperties_management(myraster, "BOTTOM").getOutput(0)

#create geometry

point = arcpy.Point()

point.X = RasterLeft

point.Y = RasterBottom

pointGeometry = arcpy.PointGeometry(point)

#copy geometry into shapefile

arcpy.CopyFeatures_management(pointGeometry, "test.shp")

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

Appending existing data won't fix the issue if it exists, it occurs at the time of creation

View solution in original post

0 Kudos
3 Replies
DanPatterson_Retired
MVP Emeritus

Could you try to give it a spatial reference as well, there have been issues with single precision values being used for geometry if a SR isn't specified  This may not be the case...but

0 Kudos
BenLeslie1
Occasional Contributor III

Waaait a minute - this (probably) isn't a rounding issue at all - (I tried Append to put my point into an existing shapefile that has an SR and I get the same geometry)

my input numbers after the decimal point are:

RasterLeft:  .36184......

RasterBottom:  .694507.....

whereas the geometry is created at:

x:  .36181........

y:  .694519......

any ideas?

0 Kudos
DanPatterson_Retired
MVP Emeritus

Appending existing data won't fix the issue if it exists, it occurs at the time of creation

0 Kudos