获取道路上一点的坐标

发布于 2024-08-16 17:35:20 字数 467 浏览 14 评论 0原文

我有一个由交叉点和距交叉点几英尺定义的范围。 (例如,华盛顿街和第五街以北 100 英尺到华盛顿街和第六街以南 300 英尺)

我希望将其地理编码为纬度/经度对。但是,我看不到任何方法可以让 Google Maps API 或 Virtual Earth 等来执行此操作。他们很乐意对十字路口进行地理编码,但不会对距离进行地理编码。我不能只添加 100 英尺,因为道路不一定完全笔直或完全沿着基本方向。

我研究了如何获取描述道路的折线,但从 Google/VEarth 获取该折线的运气并不好。我查看了美国人口普查局的 TIGER/LINE,但他们的数据非常不准确。

任何人都可以就如何对其进行地理编码提出建议吗?这是针对公共地图的,因此来自 Google、Microsoft 等的任何免费 API 都应该没问题。

顺便说一句,最终我正在寻找实际的街道地址而不是坐标。例如,我想知道上面给出的示例中的范围是 508 到 563 Washington St。

I have a range defined by an intersection and a number of feet away from the intersection. (e.g. 100 ft north of Washington St. & 5th St. to 300 ft south of Washington St. & 6th St.)

I am looking to geocode this into a lat/long pair. However, I cannot see any way to get Google Maps API or Virtual Earth, etc. to do this. They will happily geocode the intersection, but not the distance away. I can't just add 100 ft because the road doesn't necessarily go exactly straight or exactly in a cardinal direction.

I investigated getting the polyline that describes the road, but am not having much luck with obtaining that either from Google/VEarth. I looked at TIGER/LINE from the US Census but their data is very inaccurate.

Can anyone make a suggestion for how to geocode this? This is for a public map, so any of the free APIs from Google, Microsoft, etc. should be fine.

Ultimately, by the way, I'm looking for an actual street address rather than coordinates. I want to know that the range in the example I gave above, for instance, would be 508 to 563 Washington St.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦回梦里 2024-08-23 17:35:20

深思熟虑 - 我不知道您的应用程序是什么,但请记住典型 GPS 设备的精度为 10 米(约 33 英尺)。您是否有可能试图使其变得比必要的更精确?

可能的解决方案

  1. 您可以添加 100 英尺并将该点垂直于道路投影吗?足够接近吗?

  2. 抓住十字路口。遍历第一段。如果其长度< 100 英尺,抓住第二个路段,依此类推,直到沿着道路测量,距离交叉路口 100 英尺。您需要添加适当的检查/进行一些数学计算,以确定实际 100' 标记沿着线段落在何处。

我在夏天使用了第二种方法,看看是否能找到一些示例代码。但没有承诺。

#3 - 抓住十字路口。获取第一段的方位角,并使用坐标几何来计算给定角度沿街道 100 英尺的点。这假设街道中没有任何偏转,否则使用#2。

Food for thought - I don't know what your application is but remember the accuracy of a typical GPS device is 10 meters (approx 33 feet). Is it possible you are trying to make this more precise than necessary?

Possible solutions

  1. Can you just add the 100 feet and project that point perpendicular to the road? Close enough?

  2. Grab the intersection. Traverse the first segment. If its length < 100 feet, grab the scond segment, and so on until you are 100 feet away from the intersection as measured along the road. You will need to add the appropriate checks / do some math to determine where along a segment the actual 100' mark falls.

I used the second method over the summer and will see if I can find some sample code. No promises though.

#3 - Grab the intersection. Get the bearing of the first segment and use coordinate geometry to calculate the point 100 feet along the street at a given angle. This assumes the street does not have any deflections in it, otherwise use #2.

荆棘i 2024-08-23 17:35:20

我最终采取了一种不同的方法——我没有对门牌号进行地理编码,而是使用街道上的百分比。因此,我可以计算街道的长度,然后确定地理编码坐标在街道上的距离。

I ended up taking a different approach -- rather than geocoding to house numbers, I use percentage up the street. I can therefore get away with calculating the length of the street and then determining how far up the street the geocoded coordinates are.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文