Rounding Coordinates

650
1
11-19-2013 06:33 PM
NickJacob
New Contributor II
Hello,

I have a data set containing a few thousand points and I'm attempting to round the coordinates while controlling the maximum distance they can move.  The math is dizzying and I was curious to know if anyone knew of a good resource to learn more about this sort of thing.  The goal would be to generalize the coordinates enough so that the points would "stack up" on one another while controlling the distance they could potentially move during the process (say, a maximum of 100 Meters or so).  Any thoughts?
Tags (2)
0 Kudos
1 Reply
NeilAyres
MVP Alum
You could use your own "rounding" function or utilize the round function.
See below...
>>> x = 345678.912
>>> CDim = 100
>>> int(x / CDim) * CDim + CDim / 2
345650
>>> round(x)
345679.0
>>> round(x, -2)
345700.0
>>> 

The first bit creates an x coord in the middle of a cell of width 100, min is 345600, max is 345700.
Good luck,
Neil
0 Kudos