中pdalargs的语法是什么可编程过滤器在Python的PDAL中?

2024-05-23 14:45:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我将pdal与python结合使用,并尝试使用可编程过滤器。根据documenation,我应该能够通过编写来解析python函数的其他输入参数(第141页)

{
    "pipeline":[
        "input.las",
        {
            "type":"filters.programmable",
            "module":"anything",
            "function":"filter",
            "source":"arguments.py",
            "pdalargs":"{\"factor\":0.3048,\"an_argument\":42, \"another\": \"a string\"}"
        },
        "output.las"
    ]
}

我尝试了复制粘贴(实际上,我只更改了输入las文件的名称),但一直出现以下错误:

RuntimeError: JSON pipeline: Unable to parse pipeline:
* Line 13, Column 15
  Missing ',' or '}' in object declaration

我尝试在pdalargs参数中随机删除并插入“and\,但语法似乎不正确。(无需pdalargs即可正常工作)

是否有更新或文档中没有的内容??语法应该如何使用pdalargs??你知道吗


Tags: 函数过滤器input参数pipelinetype语法filters
1条回答
网友
1楼 · 发布于 2024-05-23 14:45:54

我发现了如何改变语法。这个问题可能是因为我正在python脚本中以字符串的形式编写json代码。你知道吗

不管怎样,这种语法似乎是有效的:

jsonStr = """{
    "pipeline":[
        "input.las",
        {
            "type":"filters.programmable",
            "module":"anything",
            "function":"filter",
            "source":"arguments.py",
            "pdalargs": {"factor":0.3048,"an_argument":42, "another": "a string"}
        },
        "output.las"
    ]
}"""

如果其他人也有同样的问题,希望这能有所帮助。你知道吗

相关问题 更多 >