You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to compare two GeoJSON Features to find out if they are very similar. I use truncate and then compare the geometry. The problem is, that truncate not just cuts the values at the specified decimal but also rounds.
As an example the values 48.022774 and 48.022775 when truncated to 5 decimals lead to 48.02277 and 48.02278.
Is there a way to disable rouding when using truncate?
The text was updated successfully, but these errors were encountered:
I now also looked at the code. I think it would be good to use Math.trunc() instead of Math.round(). I think the name of the function implicates that the number gets just "cut off", not rounded.
The description in the API says "Takes a GeoJSON Feature or FeatureCollection and truncates the precision of the geometry.". So there is no rounding mentioned. In the provided example in the docs though, 58.11088890802906 becomes 58.111.
I would like to compare two GeoJSON Features to find out if they are very similar. I use truncate and then compare the geometry. The problem is, that truncate not just cuts the values at the specified decimal but also rounds.
As an example the values 48.022774 and 48.022775 when truncated to 5 decimals lead to 48.02277 and 48.02278.
Is there a way to disable rouding when using truncate?
The text was updated successfully, but these errors were encountered: