在地图上排列照片
我正在尝试创建一个应用程序,其中照片放置在地图上,以便它们接近它们对应的纬度/经度,但不会相互重叠。
我所追求的一个例子: http://snapshot.trulia.com/NY/New_York/#most_expense
我相信这是基于物理的布局。关于如何完成这样的事情有任何指示吗?任何带有示例代码的指针都会有双重帮助:-)
I am trying to create an application where photos are laid out on a map such that they are close to the lat/lon they correspond to, and yet do not overlap with each other.
An example of what I am after:
http://snapshot.trulia.com/NY/New_York/#most_expensive
I believe this is a physics-based layout. Any pointers on how something like this might be accomplished? Any pointers with sample code would be doubly helpful :-)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将其视为优化问题。
对于每张给定的照片,变量是距照片所需纬度/经度“连接”点的角度和距离。
您的适应度函数可以是所有照片的距离之和。您的优化算法可以最大限度地减少这种情况。
You can frame this as an optimization problem.
For each given photo, the variables are angle and distance from the photo's desired lat/long "tie" point.
Your fitness function could be the sum of the distances for all the photos. Your optimization algorithm would work to minimize this.