TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Geometry-aware Hashing of GeoJSON objects

7 点作者 biosboiii12 个月前
Just a quick little feature I implemented over the weekend.<p>TODO: Assure that polygons can be palindromic as well

2 条评论

rav12 个月前
&gt; After thinking far too long about how I can sort coordinates reliability, I chose the easy way out:<p>In addition to the code, please also give a plain language description: &quot;We ensure that the first coordinate is the lexicographically smallest (i.e. most westward point). For line strings, reverse the coordinate list to make it so, and for polygons, rotate the coordinates to make it so.&quot;<p>&gt; val reordered = coordinates.subList(index, coordinates.size - 1) + coordinates.subList(0, index)<p>This should say + coordinates.subList(0, index + 1), and then you can get rid of the code that checks for first != last.
评论 #40489755 未加载
perrygeo12 个月前
Nice! Should point out that JTS geometries already have a built in normalize and equalsNorm method for computing equality regardless of coordinate starting point. I&#x27;m not sure how they compare to your implementation but the motivation is similar.<p>Either way, you can optimize the performance of this approach by first doing a cheaper comparison (like coordinate count) and only computing the normalized geometry when you need to.
评论 #40489655 未加载
评论 #40487932 未加载