找到一个城市的中心点 [英] Finding the center point of a city

查看:106
本文介绍了找到一个城市的中心点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



<有没有更准确的方法?我想避免购买另一个数据库。我们还没有购买完整的数据库,因此我不能只尝试它并将结果与​​Google Maps进行比较。

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



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



您最好的办法是获得一个含有空间数据的countys表。



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



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


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.

解决方案

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.

这篇关于找到一个城市的中心点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆