我试图通过JDBC转换器将Postresql数据加载到Geomesa(带有Cassandra数据存储)。
从形状加载可以很好地工作,因此Cassandra和GeoMesa设置是可以的
接下来我试图从PostgreSQL加载数据
命令:
echo“选择年份,geom,grondgebruik,作物代码,作物名称,fieldid,全局id,区域,周长,v_gewspercelen2018的geohash”| bin/geomesa cassandra inset-c catalog-P cassandraserver:9042-k agrodatacube-f parcel-c geomesa.converters.parcel-u-P
转换器定义文件geomesa.converters.parcel如下所示:
geomesa.converters.parcel = {
type = "jdbc"
connection = "dbc:postgresql://postgresserver:5432/agrodatacube"
id-field="toString($5)"
fields = [
{ name = "fieldid", transform = "$5" }
{ name = "global_id", transform = "$6" }
{ name = "year", transform = "$0" }
{ name = "area", transform = "$7" }
{ name = "perimeter", transform = "$8" }
{ name = "grondgebruik", transform = "$2" }
{ name = "crop_code", transform = "$3" }
{ name = "crop_name", transform = "$4" }
{ name = "geohash", transform = "$9" }
{ name = "geom", transform = "$1" }
]
}
geomesa的输出为:
INFO Schema 'parcel' exists
INFO Running ingestion in local mode
INFO Ingesting from stdin with 1 thread
[ ] 0% complete 0 i[ ] 0% complete 0 ingested 0 failed in 00:00:01
ERROR Fatal error running local ingest worker on <stdin>
[ ] 0% complete 0 i[ ] 0% complete 0 ingested 0 failed in 00:00:01
INFO Local ingestion complete in 00:00:01
INFO Ingested 0 features with no failures for file: <stdin>
WARN Some files caused errors, ingest counts may not be accurate
有人知道这里出了什么事吗?
最佳答案
您可以在logs
文件夹中查看更详细的错误。然而,乍一看,JDBC转换器遵循standard result set numbering,这意味着第一个字段是$1
(而不是$0
)。此外,您可能需要使用变换函数(即geometry($2)
)变换几何体。
关于postgresql - 如何将PostgreSQL数据加载到GeoMesa中(使用Cassandra数据存储区)?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55849341/