0

Hi guys I am new to GeoMesa. And trying to import my MySQL table to it. As given on their http://www.geomesa.org/documentation/user/commandline_tools.html website.

To ingest a .csv file, a SimpleFeatureType named renegades and a converter named renegades-csv can be placed in the application.conf file:

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)"       }
      ]
    }
  }
}

But the problem is that:

  1. I can't find any tutorial or help on how to make this file some of the datatype has been given in above example. But some of my sql DB values are varchar, tinyint, float and datetime. Now, what datatype in GeoMesa is similar to these datatype both for renegade and converters.
  2. And also when to make index= true or false for renegades.
Arjun Chaudhary
  • 2,373
  • 2
  • 19
  • 36

1 Answers1

0

For #1, as you map between MySQL and SimpleFeatureTypes for GeoMesa, varchar becomes 'string', any whole number field should be come 'Integer' or 'Long', dates are 'Date', and geometry fields are likely 'Point', 'Linestring', 'Polygon', or 'Geometry'. (NB: there are multi-versions, but you likely don't need those.)

For #2, the 'index=true' (or false) bits are about secondary indexing in GeoMesa. By default, GeoMesa creates indexes for the geometry and temporal fields. If you plan to query by space and time, then your queries should be pretty optimal. If you wish to query solely by an attribute, say 'friends' from the above example, then creating an index for that field with 'index=true' is likely going to be helpful.

GeoJim
  • 1,320
  • 7
  • 12