本文整理汇总了Java中org.geotools.jdbc.JDBCDataStore类的典型用法代码示例。如果您正苦于以下问题:Java JDBCDataStore类的具体用法?Java JDBCDataStore怎么用?Java JDBCDataStore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JDBCDataStore类属于org.geotools.jdbc包,在下文中一共展示了JDBCDataStore类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: calculateGeometries
import org.geotools.jdbc.JDBCDataStore; //导入依赖的package包/类
/**
* Calculates the UrbanGrid area/perimeters for each Administrative area inside a separate thread.
*
* @param year Input ShapeFile year
* @param imperviousnessReference Input ShapeFile layer
* @param rois List of all the input Geometries
* @param numThreads Number of threads to lauch
* @param area Boolean indicating if area must be calculated. (Otherwise perimeter is calculated)
* @return
* @throws MalformedURLException
* @throws IOException
* @throws InterruptedException
*/
private List<ListContainer> calculateGeometries(String year, FeatureTypeInfo imperviousnessReference, List<Geometry> rois,
int numThreads, boolean area) throws MalformedURLException, IOException,
InterruptedException {
// Initialization of the CountDown latch for handling multiple threads together
latch = new CountDownLatch(numThreads);
// Datastore creation
final JDBCDataStore ds = (JDBCDataStore) imperviousnessReference.getStore().getDataStore(null);
// ThreadPoolExecutor object used for launching multiple threads simultaneously
ThreadPoolExecutor executor = new ThreadPoolExecutor(numThreads, numThreads, 60,
TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1000000));
// Final list containing the result calculated by each thread
List<ListContainer> allLists = new ArrayList<ListContainer>(numThreads);
// Cycle on the input geometries
for (Geometry geo : rois) {
// Creation of a new ListContainer object
ListContainer container = new ListContainer();
allLists.add(container);
// Creation of a new Runnable for the UrbanGrids computation
MyRunnable run = new MyRunnable(year, geo, imperviousnessReference, ds, container, area);
executor.execute(run);
}
// Waiting until all the threads have finished
latch.await();
// Executor closure
executor.shutdown();
executor.awaitTermination(30, TimeUnit.SECONDS);
// Datastore disposal
// ds.dispose();
return allLists;
}
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:47,代码来源:UrbanGridProcess.java
示例2: SoilSealingAdministrativeUnit
import org.geotools.jdbc.JDBCDataStore; //导入依赖的package包/类
/**
* Default constructor
*
* @param au
* @param geoCodingReference
* @param populationReference
* @throws IOException
*/
public SoilSealingAdministrativeUnit(String au, FeatureTypeInfo geoCodingReference,
FeatureTypeInfo populationReference) throws IOException {
if (!au.contains("_")) {
throw new IOException("Invalid Administrative Unit name");
}
this.geoCodingReference = geoCodingReference;
this.populationReference = populationReference;
this.name = au.split("_")[0];
this.parent = au.split("_")[1];
FeatureReader<SimpleFeatureType, SimpleFeature> ftReader = null;
Transaction transaction = new DefaultTransaction();
try {
final JDBCDataStore ds = (JDBCDataStore) geoCodingReference.getStore().getDataStore(null);
Filter nameFilter = ff.equals(ff.property("name"), ff.literal(this.name));
Filter parentFilter = ff.equals(ff.property("parent"), ff.literal(this.parent));
Filter queryFilter = ff.and(Arrays.asList(nameFilter, parentFilter));
Query query = new Query(geoCodingReference.getFeatureType().getName().getLocalPart(), queryFilter);
ftReader = ds.getFeatureReader(query, transaction);
while (ftReader.hasNext()) {
Feature feature = ftReader.next();
this.type = AuType.getType((Integer) feature.getProperty("type").getValue());
this.the_geom = (Geometry) feature.getDefaultGeometryProperty().getValue();
break;
}
} finally {
if (ftReader != null) {
ftReader.close();
}
transaction.commit();
transaction.close();
}
if (this.type == null || this.the_geom == null) {
throw new IOException("Invalid Administrative Unit name: no record found!");
}
switch (this.type) {
case MUNICIPALITY:
loadPopulationStatistics(this);
break;
case DISTRICT:
case REGION:
loadSubs(this);
break;
default:
break;
}
}
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:61,代码来源:SoilSealingAdministrativeUnit.java
示例3: loadPopulationStatistics
import org.geotools.jdbc.JDBCDataStore; //导入依赖的package包/类
/**
*
* @param soilSealingAdministrativeUnit
* @throws IOException
*/
private void loadPopulationStatistics(SoilSealingAdministrativeUnit soilSealingAdministrativeUnit) throws IOException {
FeatureReader<SimpleFeatureType, SimpleFeature> ftReader = null;
Transaction transaction = new DefaultTransaction();
try {
final JDBCDataStore ds = (JDBCDataStore) populationReference.getStore().getDataStore(null);
Filter auNameFilter = ff.equals(ff.property("au_name"), ff.literal(this.name));
Filter queryFilter = ff.and(Arrays.asList(auNameFilter));
Query query = new Query(populationReference.getFeatureType().getName().getLocalPart(), queryFilter);
ftReader = ds.getFeatureReader(query, transaction);
while (ftReader.hasNext()) {
Feature feature = ftReader.next();
Collection<Property> properties = feature.getProperties();
for (Property prop : properties) {
if (prop.getName().getLocalPart().startsWith("a_")) {
Object yearPopulationValue = prop.getValue();
if (yearPopulationValue != null) {
population.put(prop.getName().getLocalPart().split("a_")[1], ((BigDecimal) yearPopulationValue).intValue());
}
}
}
}
} finally {
if (ftReader != null) {
ftReader.close();
}
transaction.commit();
transaction.close();
}
}
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:38,代码来源:SoilSealingAdministrativeUnit.java
示例4: createDataStoreInternal
import org.geotools.jdbc.JDBCDataStore; //导入依赖的package包/类
@Override
protected JDBCDataStore createDataStoreInternal(JDBCDataStore dataStore, Map params)
throws IOException {
// disable fetch size
// not fully supported by MonetDB
dataStore.setFetchSize(0);
return dataStore;
}
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:10,代码来源:MonetDBDataStoreFactory.java
示例5: MonetDBDialect
import org.geotools.jdbc.JDBCDataStore; //导入依赖的package包/类
public MonetDBDialect(JDBCDataStore dataStore) {
super(dataStore);
}
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:4,代码来源:MonetDBDialect.java
示例6: createSQLDialect
import org.geotools.jdbc.JDBCDataStore; //导入依赖的package包/类
protected SQLDialect createSQLDialect(JDBCDataStore dataStore) {
return new MonetDBDialect(dataStore);
}
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:4,代码来源:MonetDBDataStoreFactory.java
示例7: testCreateDataStore
import org.geotools.jdbc.JDBCDataStore; //导入依赖的package包/类
public void testCreateDataStore() throws Exception {
JDBCDataStore ds = factory.createDataStore( params );
assertNotNull( ds );
assertTrue(ds.getDataSource() instanceof ManageableDataSource);
ds.dispose();
}
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:7,代码来源:MonetDBDataStoreFactoryTest.java
注:本文中的org.geotools.jdbc.JDBCDataStore类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论