当前位置: 首页>>代码示例>>Java>>正文


Java SimpleFeatureBuilder.build方法代码示例

本文整理汇总了Java中org.geotools.feature.simple.SimpleFeatureBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleFeatureBuilder.build方法的具体用法?Java SimpleFeatureBuilder.build怎么用?Java SimpleFeatureBuilder.build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.feature.simple.SimpleFeatureBuilder的用法示例。


在下文中一共展示了SimpleFeatureBuilder.build方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildFeature

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
public static SimpleFeature buildFeature(
		final SimpleFeatureType featureType,
		final Pair<String, Object>[] entries ) {

	final List<AttributeDescriptor> descriptors = featureType.getAttributeDescriptors();
	final Object[] defaults = new Object[descriptors.size()];
	int p = 0;
	for (final AttributeDescriptor descriptor : descriptors) {
		defaults[p++] = descriptor.getDefaultValue();
	}
	final SimpleFeature newFeature = SimpleFeatureBuilder.build(
			featureType,
			defaults,
			UUID.randomUUID().toString());
	for (final Pair<String, Object> entry : entries) {
		newFeature.setAttribute(
				entry.getKey(),
				entry.getValue());
	}
	return newFeature;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:22,代码来源:FeatureDataUtils.java

示例2: createFeature

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private SimpleFeature createFeature() {
	final SimpleFeature instance = SimpleFeatureBuilder.build(
			type,
			defaults,
			UUID.randomUUID().toString());
	instance.setAttribute(
			"pop",
			Long.valueOf(100));
	instance.setAttribute(
			"pid",
			"a89dhd-123-abc");
	instance.setAttribute(
			"geom",
			factory.createPoint(new Coordinate(
					27.25,
					41.25)));
	return instance;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:19,代码来源:CQLQueryFilterTest.java

示例3: createGeoFeature

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private SimpleFeature createGeoFeature(
		final Geometry geo ) {
	final SimpleFeature instance = SimpleFeatureBuilder.build(
			geoType,
			geoDefaults,
			UUID.randomUUID().toString());
	instance.setAttribute(
			"pop",
			Long.valueOf(100));
	instance.setAttribute(
			"pid",
			UUID.randomUUID().toString());
	instance.setAttribute(
			"geometry",
			geo);
	return instance;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:QueryIndexHelperTest.java

示例4: createGeoMercFeature

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private SimpleFeature createGeoMercFeature(
		final Geometry geo ) {
	final SimpleFeature instance = SimpleFeatureBuilder.build(
			geoMercType,
			geoDefaults,
			UUID.randomUUID().toString());
	instance.setAttribute(
			"pop",
			Long.valueOf(100));
	instance.setAttribute(
			"pid",
			UUID.randomUUID().toString());
	instance.setAttribute(
			"geometry",
			geo);
	return instance;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:QueryIndexHelperTest.java

示例5: createSingleTimeFeature

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private SimpleFeature createSingleTimeFeature(
		final Date time ) {
	final SimpleFeature instance = SimpleFeatureBuilder.build(
			singleType,
			singleDefaults,
			UUID.randomUUID().toString());
	instance.setAttribute(
			"pop",
			Long.valueOf(100));
	instance.setAttribute(
			"pid",
			UUID.randomUUID().toString());
	instance.setAttribute(
			"when",
			time);
	instance.setAttribute(
			"geometry",
			factory.createPoint(new Coordinate(
					27.25,
					41.25)));
	return instance;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:23,代码来源:QueryIndexHelperTest.java

示例6: createFeature

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private SimpleFeature createFeature(
		final Date sTime,
		final Date eTime ) {
	final SimpleFeature instance = SimpleFeatureBuilder.build(
			rangeType,
			rangeDefaults,
			UUID.randomUUID().toString());
	instance.setAttribute(
			"pop",
			Long.valueOf(100));
	instance.setAttribute(
			"pid",
			UUID.randomUUID().toString());
	instance.setAttribute(
			"start",
			sTime);
	instance.setAttribute(
			"end",
			eTime);
	instance.setAttribute(
			"geometry",
			factory.createPoint(new Coordinate(
					27.25,
					41.25)));
	return instance;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:27,代码来源:QueryIndexHelperTest.java

示例7: create

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private SimpleFeature create(
		final String pid ) {
	final List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
	final Object[] defaults = new Object[descriptors.size()];
	int p = 0;
	for (final AttributeDescriptor descriptor : descriptors) {
		defaults[p++] = descriptor.getDefaultValue();
	}

	final SimpleFeature newFeature = SimpleFeatureBuilder.build(
			schema,
			defaults,
			UUID.randomUUID().toString());

	newFeature.setAttribute(
			"pid",
			pid);

	return newFeature;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:21,代码来源:FeatureCountMinSketchStaticticsTest.java

示例8: create

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private SimpleFeature create(
		final String pid,
		final Set<String> set ) {
	final List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
	final Object[] defaults = new Object[descriptors.size()];
	int p = 0;
	for (final AttributeDescriptor descriptor : descriptors) {
		defaults[p++] = descriptor.getDefaultValue();
	}

	final SimpleFeature newFeature = SimpleFeatureBuilder.build(
			schema,
			defaults,
			UUID.randomUUID().toString());

	newFeature.setAttribute(
			"pid",
			pid);

	set.add(pid);

	return newFeature;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:24,代码来源:FeatureHyperLogLogStaticticsTest.java

示例9: createTabFeatures

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
/**
*
* @param ft
* @param glayer
* @param projection
* @param gt
* @return
* @throws Exception
*/

   public static FeatureCollection createTabFeatures(SimpleFeatureType ft, Object[] values) throws Exception {
   	 DefaultFeatureCollection collection = new DefaultFeatureCollection();
        Object[] data = new Object[ft.getDescriptors().size()];
        System.arraycopy(values, 1, data, 0, data.length);
        SimpleFeature simplefeature = SimpleFeatureBuilder.build(ft, data, null);
        collection.add(simplefeature);
        return collection;
   }
 
开发者ID:ec-europa,项目名称:sumo,代码行数:19,代码来源:PostgisIO.java

示例10: createFeatures

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
/**
 *
 * @param ft
 * @param glayer
 * @param projection
 * @param gt
 * @return
 * @throws Exception
 */
public static FeatureCollection<SimpleFeatureType,SimpleFeature>  createFeatures(SimpleFeatureType ft, GeometryImage glayer, String projection) throws Exception {
	 DefaultFeatureCollection collection = new DefaultFeatureCollection();
     int id=0;
     for (Geometry geom : glayer.getGeometries()) {
   	  Object[] data = new Object[ft.getDescriptors().size()];
         System.arraycopy(glayer.getAttributes(geom).getValues(), 0, data, 1, data.length-1);
         data[0] = geom;
   	  SimpleFeature simplefeature = SimpleFeatureBuilder.build(ft, data, ""+id);
   	  collection.add(simplefeature);
         /*if (geom instanceof Point) {
             Object[] data = new Object[ft.getDescriptors().size()];
             System.arraycopy(glayer.getAttributes(geom).getValues(), 0, data, 1, data.length-1);
             data[0] = geom;
             SimpleFeature simplefeature = SimpleFeatureBuilder.build(ft, data, ""+id);
             collection.add(simplefeature);
         } else if (geom instanceof Polygon) {
             Object[] data = new Object[glayer.getSchema().length];
             System.arraycopy(glayer.getAttributes(geom).getValues(), 0, data, 0, data.length );
             SimpleFeature simplefeature = SimpleFeatureBuilder.build(ft, data, ""+id);
             collection.add(simplefeature);
             data = null;
         } else if (geom instanceof LineString) {
             Object[] data = new Object[glayer.getSchema().length + 1];
             data[0] = geom;
             System.arraycopy(glayer.getAttributes(geom).getValues(), 0, data, 1, data.length - 1);
             SimpleFeature simplefeature = SimpleFeatureBuilder.build(ft, data, ""+id);
             collection.add(simplefeature);
         }*/
         id++;
     }
    return collection;
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:42,代码来源:SimpleShapefile.java

示例11: createFeature

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private static SimpleFeature createFeature(final SimpleFeatureType featureType, final Statement statement) throws ParseException {
    final String subject = StatementSerializer.writeSubject(statement);
    final String predicate = StatementSerializer.writePredicate(statement);
    final String object = StatementSerializer.writeObject(statement);
    final String context = StatementSerializer.writeContext(statement);

    // create the feature
    final Object[] noValues = {};

    // create the hash
    final String statementId = Md5Hash.md5Base64(StatementSerializer.writeStatement(statement));
    final SimpleFeature newFeature = SimpleFeatureBuilder.build(featureType, noValues, statementId);

    // write the statement data to the fields
    final Geometry geom = GeoParseUtils.getGeometry(statement, new GmlParser());
    if(geom == null || geom.isEmpty() || !geom.isValid()) {
        throw new ParseException("Could not create geometry for statement " + statement);
    }
    newFeature.setDefaultGeometry(geom);

    newFeature.setAttribute(SUBJECT_ATTRIBUTE, subject);
    newFeature.setAttribute(PREDICATE_ATTRIBUTE, predicate);
    newFeature.setAttribute(OBJECT_ATTRIBUTE, object);
    newFeature.setAttribute(CONTEXT_ATTRIBUTE, context);
    // GeoWave does not support querying based on a user generated feature ID
    // So, we create a separate ID attribute that it can query on.
    newFeature.setAttribute(GEO_ID_ATTRIBUTE, statementId);

    // preserve the ID that we created for this feature
    // (set the hint to FALSE to have GeoTools generate IDs)
    newFeature.getUserData().put(Hints.USE_PROVIDED_FID, java.lang.Boolean.TRUE);

    return newFeature;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:35,代码来源:GeoWaveGeoIndexer.java

示例12: createFeature

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private static SimpleFeature createFeature(final SimpleFeatureType featureType, final Statement statement) throws ParseException {
    final String subject = StatementSerializer.writeSubject(statement);
    final String predicate = StatementSerializer.writePredicate(statement);
    final String object = StatementSerializer.writeObject(statement);
    final String context = StatementSerializer.writeContext(statement);

    // create the feature
    final Object[] noValues = {};

    // create the hash
    final String statementId = Md5Hash.md5Base64(StatementSerializer.writeStatement(statement));
    final SimpleFeature newFeature = SimpleFeatureBuilder.build(featureType, noValues, statementId);

    // write the statement data to the fields
    final Geometry geom = GeoParseUtils.getGeometry(statement, new GmlParser());
    if(geom == null || geom.isEmpty() || !geom.isValid()) {
        throw new ParseException("Could not create geometry for statement " + statement);
    }
    newFeature.setDefaultGeometry(geom);

    newFeature.setAttribute(SUBJECT_ATTRIBUTE, subject);
    newFeature.setAttribute(PREDICATE_ATTRIBUTE, predicate);
    newFeature.setAttribute(OBJECT_ATTRIBUTE, object);
    newFeature.setAttribute(CONTEXT_ATTRIBUTE, context);

    // preserve the ID that we created for this feature
    // (set the hint to FALSE to have GeoTools generate IDs)
    newFeature.getUserData().put(Hints.USE_PROVIDED_FID, java.lang.Boolean.TRUE);

    return newFeature;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:32,代码来源:GeoMesaGeoIndexer.java

示例13: setup

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
@Before
public void setup()
		throws SchemaException,
		CQLException {
	type = DataUtilities.createType(
			"geostuff",
			"geometry:Geometry:srid=4326,vis:java.lang.String,pop:java.lang.Long,pid:String");
	descriptors = type.getAttributeDescriptors();
	defaults = new Object[descriptors.size()];
	int p = 0;
	for (final AttributeDescriptor descriptor : descriptors) {
		defaults[p++] = descriptor.getDefaultValue();
	}

	newFeature = SimpleFeatureBuilder.build(
			type,
			defaults,
			UUID.randomUUID().toString());
	newFeature.setAttribute(
			"pop",
			Long.valueOf(100));
	newFeature.setAttribute(
			"pid",
			UUID.randomUUID().toString());
	newFeature.setAttribute(
			"vis",
			"{\"pid\":\"TS\", \"geo.*\":\"S\"}");
	newFeature.setAttribute(
			"geometry",
			factory.createPoint(new Coordinate(
					43.454,
					128.232)));
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:34,代码来源:JsonDefinitionColumnVisibilityManagementTest.java

示例14: create

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
private SimpleFeature create(
		final Double val ) {
	final List<AttributeDescriptor> descriptors = schema.getAttributeDescriptors();
	final Object[] defaults = new Object[descriptors.size()];
	int p = 0;
	for (final AttributeDescriptor descriptor : descriptors) {
		defaults[p++] = descriptor.getDefaultValue();
	}

	final SimpleFeature newFeature = SimpleFeatureBuilder.build(
			schema,
			defaults,
			UUID.randomUUID().toString());

	newFeature.setAttribute(
			"pop",
			val);
	newFeature.setAttribute(
			"pid",
			UUID.randomUUID().toString());
	newFeature.setAttribute(
			"when",
			new Date());
	newFeature.setAttribute(
			"whennot",
			new Date());
	newFeature.setAttribute(
			"geometry",
			factory.createPoint(new Coordinate(
					27.25,
					41.25)));
	return newFeature;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:34,代码来源:FeatureFixedBinNumericStaticticsTest.java

示例15: toSimpleFeature

import org.geotools.feature.simple.SimpleFeatureBuilder; //导入方法依赖的package包/类
@Override
public SimpleFeature toSimpleFeature(
		final AnalyticItemWrapper<T> item ) {
	final SimpleFeature newFeature = SimpleFeatureBuilder.build(
			type,
			defaults,
			item.getID());
	int i = 0;
	for (final Object value : ((SimpleFeature) item.getWrappedItem()).getAttributes()) {
		if (value instanceof Geometry) {
			final Geometry newValue = convert(
					(Geometry) value,
					shapeClass);
			if (newValue == null) {
				return null;
			}
			newFeature.setAttribute(
					i++,
					newValue);
		}
		else {
			newFeature.setAttribute(
					i++,
					value);
		}
	}
	return newFeature;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:29,代码来源:CentroidManagerGeoWave.java


注:本文中的org.geotools.feature.simple.SimpleFeatureBuilder.build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。