本文整理汇总了Java中org.geotools.data.DataUtilities.createType方法的典型用法代码示例。如果您正苦于以下问题:Java DataUtilities.createType方法的具体用法?Java DataUtilities.createType怎么用?Java DataUtilities.createType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.data.DataUtilities
的用法示例。
在下文中一共展示了DataUtilities.createType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
public static int run(String[] args) throws Exception {
CommandLineParser parser = new BasicParser();
Options options = getCommonRequiredOptions();
CommandLine cmd = parser.parse( options, args);
Map<String, String> dsConf = getAccumuloDataStoreConf(cmd);
String featureName = cmd.getOptionValue(FEATURE_NAME);
SimpleFeatureType featureType = DataUtilities.createType(featureName, "geom:Point:srid=4326");
DataStore ds = DataStoreFinder.getDataStore(dsConf);
ds.createSchema(featureType);
TopologyBuilder topologyBuilder = new TopologyBuilder();
String topic = cmd.getOptionValue(TOPIC);
String groupId = topic;
dsConf.put(OSMIngest.FEATURE_NAME, featureName);
OSMKafkaSpout OSMKafkaSpout = new OSMKafkaSpout(dsConf, groupId, topic);
topologyBuilder.setSpout("Spout", OSMKafkaSpout, 10).setNumTasks(10);
OSMKafkaBolt OSMKafkaBolt = new OSMKafkaBolt(dsConf, groupId, topic);
topologyBuilder.setBolt("Bolt", OSMKafkaBolt, 20).shuffleGrouping("Spout");
Config stormConf = new Config();
stormConf.setNumWorkers(10);
stormConf.setDebug(true);
StormSubmitter.submitTopology(topic, stormConf, topologyBuilder.createTopology());
return 0;
}
示例2: buildGdeltFeatureType
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
/**
* Builds the feature type for the GDELT data set
*
* @param featureName
* @return
* @throws SchemaException
*/
public static SimpleFeatureType buildGdeltFeatureType(String featureName) throws SchemaException {
List<String> attributes = new ArrayList<String>();
for (Attributes attribute : Attributes.values()) {
if (attribute == Attributes.geom) {
// set geom to be the default geometry for geomesa by adding a *
attributes.add("*geom:Point:srid=4326");
} else {
attributes.add(attribute.name() + ":" + attribute.getType());
}
}
String spec = Joiner.on(",").join(attributes);
SimpleFeatureType featureType = DataUtilities.createType(featureName, spec);
//This tells GeoMesa to use this Attribute as the Start Time index
featureType.getUserData().put(SimpleFeatureTypes.DEFAULT_DATE_KEY, Attributes.SQLDATE.name());
return featureType;
}
示例3: getStatementFeatureType
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
private static SimpleFeatureType getStatementFeatureType(final DataStore dataStore) throws IOException, SchemaException {
SimpleFeatureType featureType;
final String[] datastoreFeatures = dataStore.getTypeNames();
if (Arrays.asList(datastoreFeatures).contains(FEATURE_NAME)) {
featureType = dataStore.getSchema(FEATURE_NAME);
} else {
featureType = DataUtilities.createType(FEATURE_NAME,
SUBJECT_ATTRIBUTE + ":String," +
PREDICATE_ATTRIBUTE + ":String," +
OBJECT_ATTRIBUTE + ":String," +
CONTEXT_ATTRIBUTE + ":String," +
GEOMETRY_ATTRIBUTE + ":Geometry:srid=4326," +
GEO_ID_ATTRIBUTE + ":String");
dataStore.createSchema(featureType);
}
return featureType;
}
示例4: OSMInfo
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
public OSMInfo(final URL url, final long modificationStamp) {
super(modificationStamp);
CoordinateReferenceSystem crs = null;
ReferencedEnvelope env2 = new ReferencedEnvelope();
int number = 0;
try {
final File f = new File(url.toURI());
final GamaOsmFile osmfile = new GamaOsmFile(null, f.getAbsolutePath());
attributes.putAll(osmfile.getOSMAttributes(GAMA.getRuntimeScope()));
final SimpleFeatureType TYPE = DataUtilities.createType("geometries", "geom:LineString");
final ArrayList<SimpleFeature> list = new ArrayList<SimpleFeature>();
for (final IShape shape : osmfile.iterable(null)) {
list.add(SimpleFeatureBuilder.build(TYPE, new Object[] { shape.getInnerGeometry() }, null));
}
final SimpleFeatureCollection collection = new ListFeatureCollection(TYPE, list);
final SimpleFeatureSource featureSource = DataUtilities.source(collection);
env2 = featureSource.getBounds();
number = osmfile.nbObjects;
crs = osmfile.getOwnCRS(null);
} catch (final Exception e) {
System.out.println("Error in reading metadata of " + url);
hasFailed = true;
} finally {
// approximation of the width and height in meters.
width = env2 != null ? env2.getWidth() * (FastMath.PI / 180) * 6378137 : 0;
height = env2 != null ? env2.getHeight() * (FastMath.PI / 180) * 6378137 : 0;
itemNumber = number;
this.crs = crs;
}
}
示例5: initType
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
private synchronized void initType() {
if (featureType == null
|| !featureType.getName().getLocalPart()
.equals(dataStoreTypeName)) {
try {
featureType = DataUtilities
.createType(
dataStoreTypeName,
"envelope:com.vividsolutions.jts.geom.Polygon,id:java.lang.Long,queryString:String,path:String,startTime:Date,"
+ "endTime:Date,totalTime:java.lang.Long,BodyAsString:String,BodyContentLength:java.lang.Long,"
+ "Host:String,ErrorMessage:String,HttpMethod:String,HttpReferer:String,InternalHost:String,"
+ "Operation:String,OwsVersion:String,QueryString:String,RemoteAddr:String,RemoteCity:String,"
+ "RemoteCountry:String,RemoteHost:String,RemoteLat:double,"
+ "RemoteLon:double,RemoteUser:String,RemoteUserAgent:String,Resources:String,"
+ "ResponseContentType:String,ResponseLength:java.lang.Long,ResponseStatus:int,"
+ "Service:String,SubOperation:String,Status:String,Category:String");
} catch (SchemaException e) {
LOGGER.log(Level.SEVERE, "Failed to initialized feature type",
e);
}
}
}
示例6: createCollection
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
/**
* Create a SimpleFeatureCollection with a Geometry
*
* @param all
* @return
* @throws SchemaException
*/
public static SimpleFeatureCollection createCollection(Geometry g) throws SchemaException {
SimpleFeatureCollection collection = FeatureCollections.newCollection();
SimpleFeatureType TYPE = DataUtilities.createType("MBB", "location:Polygon:srid=4326"); // 4326
// =
// srid
// of
// wgs84
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE);
featureBuilder.add(g);
SimpleFeature feature = featureBuilder.buildFeature(null);
collection.add(feature);
return collection;
}
示例7: createFeatureType
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
private SimpleFeatureType createFeatureType(GeometryType geometryType) throws Exception {
String schema = null;
switch(geometryType) {
case POINT:
schema = "the_geom:Point:srid=4326," + dataSchema;
break;
case MULTIPOLYGON:
schema = "the_geom:MultiPolygon:srid=4326," + dataSchema;
break;
}
try {
return DataUtilities.createType(geometryType.name().toLowerCase(), schema);
} catch (SchemaException e) {
throw new Exception("Failed to create feature types for shapefile export", e);
}
}
示例8: testJustStartTime
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
@Test
public void testJustStartTime()
throws SchemaException {
SimpleFeatureType schema = DataUtilities.createType(
"sp.geostuff",
"geometry:Geometry:srid=4326,pop:java.lang.Long,start:Date,pid:String");
final TimeDescriptorConfiguration timeConfig = new TimeDescriptorConfiguration();
timeConfig.configureFromType(schema);
TimeDescriptors td = new TimeDescriptors(
schema,
timeConfig);
assertEquals(
"start",
td.getTime().getLocalName());
assertNull(td.getStartRange());
assertNull(td.getEndRange());
assertTrue(td.hasTime());
}
示例9: setup
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
@Before
public void setup()
throws SchemaException,
CQLException,
IOException,
GeoWavePluginException {
dataStore = createDataStore();
type = DataUtilities.createType(
"geostuff",
"geometry:Geometry:srid=4326,pop:java.lang.Long,pid:String");
dataStore.createSchema(type);
query = new Query(
"geostuff",
CQL.toFilter("BBOX(geometry,27.30,41.20,27.20,41.30)"),
new String[] {
"geometry",
"pid"
});
}
示例10: testJustEndTime
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
@Test
public void testJustEndTime()
throws SchemaException {
SimpleFeatureType schema = DataUtilities.createType(
"sp.geostuff",
"geometry:Geometry:srid=4326,pop:java.lang.Long,end:Date,pid:String");
final TimeDescriptorConfiguration timeConfig = new TimeDescriptorConfiguration();
timeConfig.configureFromType(schema);
TimeDescriptors td = new TimeDescriptors(
schema,
timeConfig);
assertEquals(
"end",
td.getTime().getLocalName());
assertNull(td.getStartRange());
assertNull(td.getEndRange());
assertTrue(td.hasTime());
}
示例11: setup
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
@Before
public void setup()
throws SchemaException,
CQLException,
IOException,
GeoWavePluginException {
dataStore = createDataStore();
type = DataUtilities.createType(
"geostuff",
"geometry:Geometry:srid=4326,pop:java.lang.Long,when:Date,pid:String");
dataStore.createSchema(type);
query = new Query(
"geostuff",
CQL
.toFilter("BBOX(geometry,27.20,41.30,27.30,41.20) and when during 2005-05-19T20:32:56Z/2005-05-19T21:32:56Z"),
new String[] {
"geometry",
"pid"
});
}
示例12: setup
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
@Before
public void setup()
throws SchemaException,
CQLException {
type = DataUtilities.createType(
"geostuff",
"geom:Geometry:srid=4326,pop:java.lang.Long,pid:String");
final List<AttributeDescriptor> descriptors = type.getAttributeDescriptors();
defaults = new Object[descriptors.size()];
int p = 0;
for (final AttributeDescriptor descriptor : descriptors) {
defaults[p++] = descriptor.getDefaultValue();
}
}
示例13: testMixedTime
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
@Test
public void testMixedTime()
throws SchemaException {
SimpleFeatureType schema = DataUtilities.createType(
"sp.geostuff",
"geometry:Geometry:srid=4326,pop:java.lang.Long,when:Date,start:Date,end:Date,pid:String");
final TimeDescriptorConfiguration timeConfig = new TimeDescriptorConfiguration();
timeConfig.configureFromType(schema);
TimeDescriptors td = new TimeDescriptors(
schema,
timeConfig);
assertEquals(
"start",
td.getStartRange().getLocalName());
assertEquals(
"end",
td.getEndRange().getLocalName());
assertNull(td.getTime());
assertTrue(td.hasTime());
}
示例14: before
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
@Before
public void before() throws Exception {
server = new Server(0);
servlet = new WfsServlet();
ServletContextHandler servletContextHandler = new ServletContextHandler();
servletContextHandler.setContextPath("/");
servletContextHandler.addServlet(new ServletHolder(servlet),"/wfs/*");
server.setHandler(servletContextHandler);
server.start();
port = server.getConnectors()[0].getLocalPort();
servlet.setPort(port);
StringBuilder sb = new StringBuilder();
sb.append("myGeom:Point,");
sb.append("myInt:Integer,");
sb.append("myDouble:Double,");
sb.append("myDate:Date,");
sb.append("myBigDecimal:java.math.BigDecimal,");
sb.append("myString:String,");
sb.append("anotherString:String");
SimpleFeatureType schema = DataUtilities.createType("testdata", sb.toString());
f1 = DataUtilities.createFeature(schema, "fid1=POINT(1 1)|1|1.0|2014-01-01 02:24:56am|11111111.1111|a|cef");
f2 = DataUtilities.createFeature(schema, "fid2=POINT(2 2)|2|2.0|2014-02-02 02:24:56am|22222222.2222|aa|ceef");
f3 = DataUtilities.createFeature(schema, "fid3=POINT(3 3)|3|3.0|2014-03-03 02:24:56am|33333333.3333|ab|c");
featureSource = new CollectionFeatureSource(DataUtilities.collection(new SimpleFeature[] { f1, f2, f3 }));
}
示例15: createSampleFeature
import org.geotools.data.DataUtilities; //导入方法依赖的package包/类
private SimpleFeature createSampleFeature() {
SimpleFeatureType type;
try {
type = DataUtilities.createType("Sample", "the_geom:Geometry");
} catch (SchemaException e) {
throw new RuntimeException(e);
}
return SimpleFeatureBuilder.template((SimpleFeatureType) type, null);
}