Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to read input of lat and long to draw the shape based on condition.The input is standard array of lat and long with 15 decimal accuracy. I am realizing - I am loosing some decimal accuracy (the point was somewhat offsite and complex polygons were never drawn). The samples are here:

point: [[[-81.00392112682097,46.50255058560673]]]

the plotted point is: -81.003906 46.502686 and I am generating PDF maps at 1:3000 scale so it is a big deal.

polygon: [[[-79.37485174735863,43.6430783790403],[-79.37361793121188,43.64341222822559],[-79.37323169311376,43.64261253986735],[-79.374186559523,43.64234079868168],[-79.37412218650664,43.64220880966229],[-79.37454061111293,43.64210787668709],[-79.37471227248987,43.64248831547784],[-79.37463717063745,43.64251160757044],[-79.37481956085045,43.64285322389105],[-79.37470154365381,43.642884279823875],[-79.37485174735863,43.6430783790403]]]

I used eval to read input as list, but probably that was not a good idea. Not sure how and where should I cast the input as decimal?

OrderCoord =  eval(arcpy.GetParameterAsText(0))
point = arcpy.Point()
array = arcpy.Array()
 # A list that will hold each of the Polygon objects 
featureList = []
for feature in OrderCoord:
    # For each coordinate pair, set the x,y properties and add to the 
    #  Array object.
    #
    for coordPair in feature:
        point.X = coordPair[0]
        point.Y = coordPair[1]
        array.add(point)

    if OrderType.lower()== 'point':
    feaERIS = arcpy.Multipoint(array)
    elif OrderType.lower() =='polyline':
    feaERIS  = arcpy.Polyline(array)    
    else :
    feaERIS = arcpy.Polygon(array)
    # Clear the array for future use
    array.removeAll()

    # Append to the list of Polygon objects
    featureList.append(feaERIS)

I added the screenshot of these points at 2000 scales. We have a Flex application where customer can draw and order a geometry. All the data sits in ORACLE and I am working on a GP Tool to print final PDF. I added the screenshot of these points at 2000 scales. We have a Flex application where customer can draw and order a geometry. All the data sits in ORACLE and I am working on a GP Tool to print final PDF.

share|improve this question
    
No sure why you need 15 d.p. for lat/lng 6 is usually suffice. see resources.arcgis.com/en/help/main/10.1/index.html#//… –  Mapperz Oct 26 '12 at 16:03
    
for the point: [[[-81.00392112682097,46.50255058560673]]] the plotted point is: -81.003906 46.502686 (apparently it is not accurate even for 4th decimal) and I am generating PDF maps at 1:3000 scale so it is a big deal. –  Deep Oct 26 '12 at 16:11
    
You should work from a Scale that is larger than 3000 - say 1:2000 then reduce the plot to 1:3000 maintaining accuracy. –  Mapperz Oct 26 '12 at 16:14
    
Try setting the spatial reference on the featureclass if it's not set. You may even need to customize its xy resolution, but for a geographic coordinate system, the default xy resolution is around 10e-9 which is less than a mm. –  mkennedy Oct 26 '12 at 16:45
1  
The sixth decimal place represents no more than 0.11m: see gis.stackexchange.com/a/8674. The error is at most half that. At 1:3000 scale that's a precision of (1/2)/33000 m, or about 1/66 mm--it's less than one-tenth the diameter of a typical human hair. It's the width of one half of one pixel in hardcopy printed at 800 dpi. That's more than enough precision for any map. –  whuber Oct 26 '12 at 21:20

1 Answer 1

up vote 3 down vote accepted

Turns out its a known bug in ArcGIS (which is not a priority to be fixed sadly). We had the same issue ourselves when trying to input features using arcpy.AsShape. From the ESRI tech support response we got it turns out that if you don't specify a spatial reference ArcGIS automatically truncates data to 3 decimal places. This remains the case even if you try and specify the tolerance using arcpy.env.XYTolerance.

The only solution is to create the geometry object with a spatial reference. For example the arcpy.Polygon object takes a Spatial Reference object as it's second argument.

Note that arcpy.Point is used to construct geometries, but is not a point geometry itself. arcpy.Point does store the full resolution of the point until it's used to create a geometry and doesn't take a spatial reference argument itself.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.