跳转到主要内容

用于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 (5.8 kB 查看哈希值)

上传时间

由以下机构支持