大家好,我是GeoMesa的新手。并尝试将我的MySQL表导入其中。正如他们在http://www.geomesa.org/documentation/user/commandline_tools.html网站上所述。
要摄取.csv文件,可以将名为renegades的SimpleFeatureType和名为renegades-csv的转换器放在application.conf文件中:
geomesa {
sfts {
renegades = {
attributes = [
{ name = "id", type = "Integer", index = false }
{ name = "name", type = "String", index = true }
{ name = "age", type = "Integer", index = false }
{ name = "lastseen", type = "Date", index = true }
{ name = "friends", type = "List[String]", index = true }
{ name = "geom", type = "Point", index = true, srid = 4326, default = true }
]
}
}
converters {
renegades-csv = {
type = "delimited-text"
format = "CSV"
options {
skip-lines = 1 //skip the header
}
id-field = "toString($id)"
fields = [
{ name = "id", transform = "$1::int" }
{ name = "name", transform = "$2::string" }
{ name = "age", transform = "$3::int" }
{ name = "lastseen", transform = "date('YYYY-MM-dd', $4)" }
{ name = "friends", transform = "parseList('string', $5)" }
{ name = "lon", transform = "$6::double" }
{ name = "lat", transform = "$7::double" }
{ name = "geom", transform = "point($lon, $lat)" }
]
}
}
}
但问题在于:
答案 0 :(得分:0)
对于#1,当您在GeoMesa的MySQL和SimpleFeatureTypes之间进行映射时,varchar变为' string',任何整数字段都应该来到'整数'或者' Long'日期是'日期'和几何字段可能是'点',' Linestring',' Polygon&# 39;或,或几何'。 (注意:有多个版本,但您可能不需要那些版本。)
对于#2,' index = true' (或错误)位是关于GeoMesa中的二级索引。默认情况下,GeoMesa为几何和时间字段创建索引。如果您计划按空间和时间进行查询,那么您的查询应该是最佳的。如果您只想通过某个属性查询,请说“朋友”。从上面的示例中,然后使用' index = true'为该字段创建索引。可能会有所帮助。