地理层次识别资源
Geography hierarchy recognition resources
我目前正在从事一个涉及地理位置的项目,我们的程序需要说明位置 A 是否包含在位置 B 中。目前,我们使用 GeoNames 中的行政代码来执行此操作,例如纽约市包含在美国因为它与美国有相同的国家代码。但是,由于缺少数据,这种方法并不总是有效,我们正在研究其他方法。如果您能提供有关以下任何一项的信息,那将大有帮助:
大多数地理编码软件如何查找层次结构信息?他们使用行政代码还是查看多边形?
使用 PostGIS 或 lucene 检查多边形 A 是否包含在多边形 B 中或与多边形 B 相交有多快?我从未使用过多边形 - 你知道任何解释如何使用它们的教程吗?
是否有可用资源免费提供有关地理位置的多边形信息?我认为 OpenStreetMap 提供了它,但 planet.osm 的大小超过 900 GB,而我们目前的容量约为 30GB。我们不需要有关街道和地址的大量信息,但我们需要建立高达 city/village 级别的层次结构。我也查看了 DBPedia,但它包含的信息似乎比 GeoNames
少得多
非常感谢!
以下是对您的问题的一些看法:
How do most geocoding software look up hierarchy information? Do they use the administrative codes or look into polygons?
几乎不可能说出大多数软件是如何工作的,但我可以告诉你,如果它们只依赖于邮政编码等数据,而不是检查它们是否在给定的 space 和时间之内,那么无需为任何 GIS 而烦恼。当然,使用地理代码要快得多,但在涉及任何空间操作(例如覆盖、触摸、重叠、相交等)时都有其局限性
How fast is it to check whether polygon A is contained within or intersects with polygon B using PostGIS or lucene? I have never worked with polygons - do you know of any tutorials explaining how to use them?
使用 PostGIS 绝对轻松。
示例:考虑以下 BBOX POLYGON((14.45 35.87,14.56 35.87,14.56 35.80,14.45 35.80,14.45 35.87))
:
此示例使用函数 ST_Within
:
检查 POINT(14.48 35.85)
是否在给定的多边形内部
db=# SELECT ST_Within('POINT(14.48 35.85)'::GEOMETRY,'POLYGON((14.45 35.87,14.56 35.87,14.56 35.80,14.45 35.80,14.45 35.87))'::GEOMETRY);
st_within
-----------
t
(1 row)
现在使用 POINT(14.35 35.95)
进行相同的实验,它位于给定多边形之外:
db=# SELECT ST_Within('POINT(14.35 35.95)'::GEOMETRY,'POLYGON((14.45 35.87,14.56 35.87,14.56 35.80,14.45 35.80,14.45 35.87))'::GEOMETRY);
st_within
-----------
f
(1 row)
Are there resources available which makes polygon information about geographic locations available for free? I think OpenStreetMap provides it but planet.osm is over 900 GB in size and our capacity currently is ~30GB. We don't need extensive information about streets and addresses but we need to establish hierarchy up to city/village level. I also looked into DBPedia but it appears to contain a lot less info than GeoNames
这实际上取决于您的要求(粒度、准确性、覆盖范围等)。网络上有很多免费的 shapefile 资源,例如:
- Cartographic Boundary Shapefiles - State Legislative Districts
- World Borders Dataset
- Statsilk - Free country shapefile maps
如果您想知道如何将 shapefile 导入 PostGIS,请查看 this answer。
您可以在此处使用此网站来可视化您的 WKT
(众所周知的文本)文字:
我目前正在从事一个涉及地理位置的项目,我们的程序需要说明位置 A 是否包含在位置 B 中。目前,我们使用 GeoNames 中的行政代码来执行此操作,例如纽约市包含在美国因为它与美国有相同的国家代码。但是,由于缺少数据,这种方法并不总是有效,我们正在研究其他方法。如果您能提供有关以下任何一项的信息,那将大有帮助:
大多数地理编码软件如何查找层次结构信息?他们使用行政代码还是查看多边形?
使用 PostGIS 或 lucene 检查多边形 A 是否包含在多边形 B 中或与多边形 B 相交有多快?我从未使用过多边形 - 你知道任何解释如何使用它们的教程吗?
是否有可用资源免费提供有关地理位置的多边形信息?我认为 OpenStreetMap 提供了它,但 planet.osm 的大小超过 900 GB,而我们目前的容量约为 30GB。我们不需要有关街道和地址的大量信息,但我们需要建立高达 city/village 级别的层次结构。我也查看了 DBPedia,但它包含的信息似乎比 GeoNames
少得多
非常感谢!
以下是对您的问题的一些看法:
How do most geocoding software look up hierarchy information? Do they use the administrative codes or look into polygons?
几乎不可能说出大多数软件是如何工作的,但我可以告诉你,如果它们只依赖于邮政编码等数据,而不是检查它们是否在给定的 space 和时间之内,那么无需为任何 GIS 而烦恼。当然,使用地理代码要快得多,但在涉及任何空间操作(例如覆盖、触摸、重叠、相交等)时都有其局限性
How fast is it to check whether polygon A is contained within or intersects with polygon B using PostGIS or lucene? I have never worked with polygons - do you know of any tutorials explaining how to use them?
使用 PostGIS 绝对轻松。
示例:考虑以下 BBOX POLYGON((14.45 35.87,14.56 35.87,14.56 35.80,14.45 35.80,14.45 35.87))
:
此示例使用函数 ST_Within
:
POINT(14.48 35.85)
是否在给定的多边形内部
db=# SELECT ST_Within('POINT(14.48 35.85)'::GEOMETRY,'POLYGON((14.45 35.87,14.56 35.87,14.56 35.80,14.45 35.80,14.45 35.87))'::GEOMETRY);
st_within
-----------
t
(1 row)
现在使用 POINT(14.35 35.95)
进行相同的实验,它位于给定多边形之外:
db=# SELECT ST_Within('POINT(14.35 35.95)'::GEOMETRY,'POLYGON((14.45 35.87,14.56 35.87,14.56 35.80,14.45 35.80,14.45 35.87))'::GEOMETRY);
st_within
-----------
f
(1 row)
Are there resources available which makes polygon information about geographic locations available for free? I think OpenStreetMap provides it but planet.osm is over 900 GB in size and our capacity currently is ~30GB. We don't need extensive information about streets and addresses but we need to establish hierarchy up to city/village level. I also looked into DBPedia but it appears to contain a lot less info than GeoNames
这实际上取决于您的要求(粒度、准确性、覆盖范围等)。网络上有很多免费的 shapefile 资源,例如:
- Cartographic Boundary Shapefiles - State Legislative Districts
- World Borders Dataset
- Statsilk - Free country shapefile maps
如果您想知道如何将 shapefile 导入 PostGIS,请查看 this answer。
您可以在此处使用此网站来可视化您的 WKT
(众所周知的文本)文字: