用于GeoJSON特性与OSM数据融合的包
项目描述
OSM Conflator
OSM Conflator是一个Python包,允许您将GeoJSON特性与OpenStreetMap(OSM)数据进行融合。它帮助您识别和修改与OSM数据相交的GeoJSON数据集中的特性,提供了一种方便的方式来根据融合结果更新属性或执行其他操作。
安装
您可以使用pip安装OSM Conflator
pip install osmconflator
使用方法
以下是如何在Python代码中使用OSM Conflator的示例
from osmconflator import conflate_geojson
geojson_str = '{"type": "FeatureCollection", "features": ... }'
conflated_geojson = conflate_geojson(geojson_str)
print(conflated_geojson)
此输出将包含具有融合属性(重复和相交布尔值)的输入特性。
在上面的示例中,conflate_geojson是OSM Conflator提供的主要函数。它接受一个GeoJSON字符串作为输入,与OSM数据进行融合,并返回一个包含重复和重叠问题的GeoJSON字符串。
选项
- 将
remove_conflated=True
参数传递给conflate_geojson函数,以获取无重复或重叠问题的干净GeoJSON。
my_cleaned_geojson = conflate_geojson(geojson_str,remove_conflated=True)
支持的功能
目前支持以下OSM功能的融合
- 建筑物
示例
from osmconflator import conflate_geojson
my_geojson = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[83.98097353206458, 28.203326601546905],
[83.98097353206458, 28.203239142020323],
[83.98110284724493, 28.203239142020323],
[83.98110284724493, 28.203326601546905],
[83.98097353206458, 28.203326601546905],
]
],
"type": "Polygon",
},
},
{
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[83.97980503615179, 28.20407835951059],
[83.97980503615179, 28.204017832398932],
[83.97987683972957, 28.204017832398932],
[83.97987683972957, 28.20407835951059],
[83.97980503615179, 28.20407835951059],
]
],
"type": "Polygon",
},
},
],
}
conflated_geojson = conflate_geojson(my_geojson)
print(conflated_geojson)
输出
{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {"duplicate": false, "intersect": false}, "geometry": {"coordinates": [[[83.98097353206458, 28.203326601546905], [83.98097353206458, 28.203239142020323], [83.98110284724493, 28.203239142020323], [83.98110284724493, 28.203326601546905], [83.98097353206458, 28.203326601546905]]], "type": "Polygon"}}, {"type": "Feature", "properties": {"duplicate": false, "intersect": true}, "geometry": {"coordinates": [[[83.97980503615179, 28.20407835951059], [83.97980503615179, 28.204017832398932], [83.97987683972957, 28.204017832398932], [83.97987683972957, 28.20407835951059], [83.97980503615179, 28.20407835951059]]], "type": "Polygon"}}]}
贡献
欢迎贡献!如果您发现任何问题或有改进建议,请随时提交问题或拉取请求。在为此项目贡献时,请遵循贡献指南。
许可协议
本项目采用MIT许可协议。有关更多信息,请参阅LICENSE文件。
正在进行中 :::: 开发正在进行
项目详情
关闭
osmconflator-0.0.11.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 1c867e677e24910dde156ee25e96bb32a7a8378e651373b2434f7e645be8f48e |
|
MD5 | c7ceb72963f6f548685e47fc696d8831 |
|
BLAKE2b-256 | 4787dcab7dfe89d36a57fbe2b302e70e0842aa6d00d4ba804f549282b6ad7951 |