如何将OSM(GeoJSON)数据加载到ArangoDB?

问题描述 投票:0回答:1

如何将OSM数据加载到ArangoDB?

我从OSM加载了名为luxembourg-latest.osm.pbf的数据,而不是用OSMTOGEOJSON将其转换为JSON,之后我尝试使用下一个命令将结果geojson加载到ArangoDB:arangoimp --file out.json --collection lux1 --server.database geodb并获得了hude错误列表:

...
2017-03-17T12:44:28Z [7712] WARNING at position 719386: invalid JSON type (expecting object, probably parse error), offending context: ],
2017-03-17T12:44:28Z [7712] WARNING at position 719387: invalid JSON type (expecting object, probably parse error), offending context: [
2017-03-17T12:44:28Z [7712] WARNING at position 719388: invalid JSON type (expecting object, probably parse error), offending context: 5.867441,
...

我做错了什么?

upd:似乎转换器osm2json转换器应该使用选项osmtogeojson --ndjson运行,该选项生成的项目不是单个Json,而是逐行模式。

json openstreetmap geojson arangodb
1个回答
0
投票

正如@ dmitry-bubnenkov已经发现的那样,--ndjson需要为ArangoImp产生正确的输入。

人们必须知道,ArangoImp期望一个JSON-Subset(因为它不会自己解析json)被称为JSONL。因此,JSON-File的每一行都应该在导入后成为集合中的一个json文档。为了最大限度地提高性能并简化实现,在将json发送到服务器之前,json尚未完全解析。

它尝试使用服务器允许的最大请求大小将JSON切割成块。它倾向于JSONL行结尾以隔离可能的块。

但是,服务器肯定需要有效的JSON。使用可能不完整的JSON文档将切碎的部分发送到服务器将导致服务器上的解析错误,这是您在输出中看到的错误消息。

© www.soinside.com 2019 - 2024. All rights reserved.