Nowadays, i'm making a java source based on Geotools to handle Geowave. but i have encountered some problems. So i'd like to get your advice about this troubles.
- When i ingest shapefile through java-api based on geotools, the both meta data is recorded for one shape file in Accumulo.
This is the shot i was taken :

This issue was also in previous jar file version. I try to fix it up on my java client side but i didn't.
This is my java source for ingesting to geowave :
//-----------------------------------------------------
public static void main(String[] args) throws Exception {
DataStore dataStore = dataStore(); //connection data for geowave and accumulo
String typeName = "shp file name";
String filepath = "file path";
writestr(filepath, dataStore);
}
private static void writedata(String filepath, DataStore dataStore,
String usrFNm) throws IOException {
Map<Object, Serializable> shapeParams = new HashMap<Object, Serializable>();
shapeParams.put("url", new File(filepath).toURI().toURL()); // shp file path
shapeParams.put("charset", "utf-8");
DataStore shapeDataStore = DataStoreFinder.getDataStore(shapeParams); /
// feature type
String typeName = shapeDataStore.getTypeNames()[0]; // taking a file name
FeatureSource<SimpleFeatureType, SimpleFeature> featSource = shapeDataStore
.getFeatureSource(typeName);
FeatureCollection<SimpleFeatureType, SimpleFeature> featSrcCollection = featSource
.getFeatures(); // gether the feature data
System.out.println(shapeDataStore);
SimpleFeatureType ft = shapeDataStore.getSchema(typeName);
// feature type copy to set the new name
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName(typeName);
builder.setAttributes(ft.getAttributeDescriptors());
builder.setCRS(ft.getCoordinateReferenceSystem());
SimpleFeatureType newSchema = builder.buildFeatureType();
Transaction transaction = new DefaultTransaction("create");
dataStore.createSchema(newSchema);
FeatureStore<SimpleFeatureType, SimpleFeature> featStore = (FeatureStore<SimpleFeatureType, SimpleFeature>) dataStore .getFeatureSource(typeName);
featStore.setTransaction(transaction);
try {
featStore.addFeatures(featSrcCollection);
transaction.commit();
System.out.println("Incent done");
} catch (Exception problem) {
problem.printStackTrace();
transaction.rollback();
} finally {
transaction.close();
}
}
public static DataStore dataStore() throws Exception {
DataStore dataStore = null;
try {
dataStore = getGeoWaveDataStore();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (dataStore == null) {
return null;
}
System.out.println("connection success");
return dataStore;
}
private static DataStore getGeoWaveDataStore() throws IOException {
return createGeoWaveDataStore();
}
public static Map<String, Serializable> getParams() {
final Map<String, Serializable> params = new HashMap<>();
params.put("zookeeper", zookeepers);
params.put("instance", instanceId);
params.put("user", user);
params.put("password", password);
params.put("namespace", tableName);
params.put("gwNamespace", gwNamespace);
params.put("Lock Management", "memory");
params.put("Authorization Management Provider", "empty");
params.put("Authorization Data URL", null);
params.put("Transaction Buffer Size", 10000);
params.put("Query Index Strategy", "Heuristic Match");
return params;
}
private static DataStore createGeoWaveDataStore() throws IOException
{
final Map<String, Serializable> params = getParams();
final boolean useMock = false;
DataStore dataStore = null;
try {
final StoreFactoryFamilySpi storeFactoryFamily;
if (useMock) {
storeFactoryFamily = new MemoryStoreFactoryFamily();
} else {
storeFactoryFamily = new AccumuloStoreFactoryFamily();
}
final GeoWaveGTDataStoreFactory geoWaveGTDataStoreFactory = new GeoWaveGTDataStoreFactory(
storeFactoryFamily); // geotools 호출
dataStore = geoWaveGTDataStoreFactory.createDataStore(params); // createNewDataStore(params);
} catch (IOException e2) {
;
}
return dataStore;
}
//-----------------------------------------------------
FYI 'DataStore' is imported form 'org.geotools.data.DataStore'.
-
How to get layer's 'InternalAdapterId' saved inside Accumulo using Geo-tools or the other way?
-
Did you know how to control the Geowave CLI in Java Eclipse? It looks like not to access Accumulo at Geowave-ingest. Don't u have some manual for control this at Eclipse?
This is the source for deal. but not perfect :
//-------------
public static void main(String[] args) throws Exception {
final String[] args1 = StringUtils.split(
"ingest localToGW -datastore sejong -f geotools-vector -b "+Ingesting+" -gwNamespace geowave.geowave -instance accumulo -user geowave -password geowave -zookeeper zookeeper:2181",
' ');
for(String str:args1){ System.out.printf(str);}
System.out.println(" ");
GeoWaveMain gwm=new GeoWaveMain();
//GeoWaveMain.run(args1);
gwm.main(args1);
System.out.println("!!!!!!");
}
//--------------------
Please answer my questions ASAP
Thank you for ur reading !! :)
Nowadays, i'm making a java source based on Geotools to handle Geowave. but i have encountered some problems. So i'd like to get your advice about this troubles.
This is the shot i was taken :
This issue was also in previous jar file version. I try to fix it up on my java client side but i didn't.
This is my java source for ingesting to geowave :
//-----------------------------------------------------
public static void main(String[] args) throws Exception {
//-----------------------------------------------------
FYI 'DataStore' is imported form 'org.geotools.data.DataStore'.
How to get layer's 'InternalAdapterId' saved inside Accumulo using Geo-tools or the other way?
Did you know how to control the Geowave CLI in Java Eclipse? It looks like not to access Accumulo at Geowave-ingest. Don't u have some manual for control this at Eclipse?
This is the source for deal. but not perfect :
//-------------
public static void main(String[] args) throws Exception {
final String[] args1 = StringUtils.split(
"ingest localToGW -datastore sejong -f geotools-vector -b "+Ingesting+" -gwNamespace geowave.geowave -instance accumulo -user geowave -password geowave -zookeeper zookeeper:2181",
' ');
//--------------------
Please answer my questions ASAP
Thank you for ur reading !! :)