Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Cloudera Employee

Goal: Ingest Geospatial data (ais data in CSV format) by using GeoMesa HBase after GeoMesa HBase is installed and configured.

Follow install-and-configure-geomesa-hbase-and-geoserver if GeoMesa HBase is not installed

151001000015660,1001001,-1,55.476868,-25.874775,0.4,50,-999.9,511,2015-10-01 06:14:33,1
151001000015661,1001001,-1,55.476868,-25.874775,0.4,50,-999.9,511,2015-10-01 06:14:34,1
151002008706375,1001001,-1,55.82175,-26.442037,0.7,40,-999.9,511,2015-10-02 05:12:46,1
151002008706376,1001001,-1,55.82175,-26.442037,0.7,40,-999.9,511,2015-10-02 05:12:47,1

Create GeoMesa SimpleFeatureType (sft) configuration file as below in ais_data_conf.sft

geomesa.sfts.ais-data = {
    attributes = [
        { name = "arkposid",    type = "Long",    index = true    }
        { name = "mmsi",    type = "Integer",    index = false    }
        { name = "navigationalstatus",    type = "Integer",    index = false    }
        { name = "coords",    type = "Point",    index = true,    srid = 4326, default = true    }
        { name = "sog",    type = "Double",    index = false    }
        { name = "cog",    type = "Double",    index = false    }
        { name = "rot",    type = "Double",    index = false    }
        { name = "heading",    type = "Integer",    index = false    }
        { name = "acquisitiontime",    type = "String",    index = false    }
        { name = "iptype",    type = "Integer",    index = false    }
    ]
}

Create GeoMesa converter configuration file as below in ais_data_feature_conf.convert

geomesa.converters.ais-data = {
    type = "delimited-text",
    format = "CSV",
    id-field = "toString($arkposid)",
    fields = [
        { name = "arkposid",    transform = "$1::long"    }
        { name = "mmsi",    transform = "$2::int"    }
        { name = "navigationalstatus",    transform = "$3::int"    }
        { name = "lon",    transform = "$4::double"    }
        { name = "lat",    transform = "$5::double"    }
        { name = "coords",    transform = "point($lon, $lat)"    }
        { name = "sog",    transform = "$6::double"    }
        { name = "cog",    transform = "$7::double"    }
    	{ name = "rot",    transform = "$8::double"    }
        { name = "heading",    transform = "$9::int"    }
    	{ name = "acquisitiontime",    transform = "toString($10)"    }
    	{ name = "iptype",    transform = "$11::int"    }
    ]
}

Run the geomesa-hbase command to insert the CSV data into HBase

geomesa-hbase ingest \
-c ais \
-s /tmp/ais_data_conf.sft \
-C /tmp/ais_data_feature_conf.convert \
/tmp/sample.csv

Should received successful message as below

<code>INFO  Creating schema 'ais-data'
INFO  Running ingestion in local mode
INFO  Ingesting 1 file with 1 thread
[============================================================] 100% complete 4 ingested 0 failed in 00:00:01
INFO  Local ingestion complete in 00:00:01
INFO  Ingested 4 features and failed to ingest 0 feature.

Refer install-and-configure-geomesa-hbase-and-geoserver to view the ingested data from GeoServer

842 Views
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
1 of 1
Last update:
‎03-29-2018 02:41 PM
Updated by:
 
Contributors
Top Kudoed Authors