寻找城市的中心点

发布于 2024-08-03 00:50:10 字数 184 浏览 3 评论 0原文

我们正在购买邮政编码及其相应纬度/经度的数据库。我想将城市存储在一个单独的表中,并用代表城市中心的纬度/经度点。我可以根据属于该城市的所有邮政编码,获取每个方向的最小/最大点,并取所得矩形的中心点来计算吗?

有没有更准确的方法呢?我想避免购买另一个数据库。我们还没有购买完整的数据库,所以我不能只是尝试一下并将结果与​​谷歌地图进行比较。

We are purchasing a database of zip codes and their corresponding Lat/Long. I want to store cities in a separate table with a lat/long point representing the center of the city. Can I calculate that based on taking all of the zips that belong to that city, getting the min/max points for each direction, and taking the center point of the resulting rectangle?

Is there a more accurate method? I want to avoid purchasing another DB. We haven't purchased the full DB yet so I can't just try it and compare the results to Google Maps.

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

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

发布评论

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

评论(5

滥情哥ㄟ 2024-08-10 00:50:10

事实上,邮政编码并不总是包含城市。邮政编码是用于定义邮政地址的任意区域。

编辑:您并不总是假设所有邮政编码的总和将对应于城市边界或将检索到正确的质心。

最好的选择是获取包含空间数据的县表。

在 PostGIS 中,一个简单的 ST_Centroid(GeometryField) 就足以获得多边形的质心。这适用于任何类型的多边形。

如果您在美国,互联网上可能存在可用的公共县/城市/州数据集。考虑使用 GIS 工具来完成这项工作。

Well actually ZIP codes do not always encompass cities. Zip codes are arbitrary regions used to defined postal addresses.

Edit: Not always your assumption that the sum of all ZIP Codes will correspond to the city boundary or will retrieve you the correct centroid.

Your best bet is to get a countys table with spatial data in it.

In PostGIS a simple ST_Centroid(GeometryField) would suffice to get you the centroid of a polygon. That works out for any type of polygons.

If you are in the US, probably exists a public county/cities/states dataset availuable on the internet. Consider GIS tools for doing this work.

南街九尾狐 2024-08-10 00:50:10

这会有很大帮助吗?这可能会给你一些近似地理中心的信息,但通常当你谈论城市中心时,你谈论的是城镇广场、商业中心或历史中心。

例如,转到谷歌地图。如果你搜索纽约,它会直接带你到时代广场。如果您搜索该城市的中心,这难道不是您所期望的吗?

Would that be very helpful? That might give you something that approximates the geographic center, but normally when you talk about the center of the city, you are talking about the town square, or the commercial center, or the historical center.

Go to google maps for example. If you search for New York, it will take you directly to Times Square. Isn't that really what you expect if you search for the center of that City.

请恋爱 2024-08-10 00:50:10

好吧,一个城市的中心是不可能精确计算的,因为对中心的看法可能和有多少人一样多......

而不是只使用邮政编码区域的最小/最大点,你可以得到所有头寸的平均值,这会给你一个更权重的头寸。

如果您有每个邮政编码的大概人数,您可以将其用作点的权重,这将为您提供人口的“重心”。

Well, the center of a city is impossible to calculate exactly, as there are probably as many views on what the center is as there are people...

Instead of using just the min/max points of the zip code areas, you could get the average of all positions, that would give you a more weighted position.

If you have an approximate number of people for each zip code you could use that as weight for the points, that would give you a "gravital center" of the population.

比忠 2024-08-10 00:50:10

市政厅始终用于定义市中心,由国家交通和公路部门、所有地球仪和地图使用。

City Hall is always used to define the city center, used by the National Transportation and Highways division, all globes and maps.

薆情海 2024-08-10 00:50:10

我会使用城镇四个边界的四个坐标的平均值作为地理中心,使用谷歌地图。

I would use the average value of the four coordinates of the four borders of the town as the geographical center, using the Google map.

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