+ Reply to Thread
Results 1 to 2 of 2

Thread: getPart() adding significant digits

  1. #1
    Brooke Wikgren
    Join Date
    Sep 2010
    Posts
    15
    Points
    0
    Answers Provided
    0


    0

    Default getPart() adding significant digits

    I have a script that basically has an input point table, runs through a search cursor testing rows using an if statement. If the statement is true, I want to use those points to create a polyline. That part of the script is... [this is just a small section of it, but the script isn't the problem]. Basically this is just to show that I'm using the row.shape and the .getPart() to retrieve info from the table.

    featureList = []
    geom = row.shape
    array1 = geom.getPart()
    array.add(array1)
    polyline = arcpy.Polyline(array)
    array.removeAll()
    featureList.append(polyline)

    My script runs fine, but I noticed if I zoom way in, my lines weren't exactly meeting my points. They were off anywhere from < 1 meter to about 10 meters. I then went back and looked at what the .getPart was retrieving and I noticed that it was adding significant digits onto the lat/long locations of the points. So where in my original table the longitude was -68.95, the .getPart would result in -68.9499999999999. Same with my latitude, the original value was 43.900002 and the .getPart would result in 43.900001526. I tried looking at the original point input table to see if perhaps there were more significant digits there that weren't being displayed in the table and also looked at the .dbf table that was used to create the original point table for the same thing, but it's not the case. I can't figure out why it is adding these significant digits and slightly changing the location. Has anyone else had this issue or know what could be causing this problem?

    Thank you in advance for any help! This is driving me crazy!

  2. #2
    Brooke Wikgren
    Join Date
    Sep 2010
    Posts
    15
    Points
    0
    Answers Provided
    0


    0

    Default Re: getPart() adding significant digits

    If anyone else is having this issue, I managed to get if fixed. I had been working in WGS84 with my points all in decimal degrees. I tried putting everything into a projection and updated the geometry (updated the lat/long) and re-ran the script and the lines are now falling right on the points. I don't know why it wasn't working in WGS84 (I don't understand why it matters), but this is working so I'm happy:.)

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts