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


Java SimpleFeatureTypeBuilder类代码示例

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


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

示例1: createFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
public SimpleFeatureType createFeatureType(Geometry newGeometry, String uuid, CoordinateReferenceSystem coordinateReferenceSystem) {
    String namespace = "http://www.52north.org/" + uuid;

    SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
    if (coordinateReferenceSystem == null) {
        coordinateReferenceSystem = getDefaultCRS();
    }
    typeBuilder.setCRS(coordinateReferenceSystem);
    typeBuilder.setNamespaceURI(namespace);
    Name nameType = new NameImpl(namespace, "Feature-" + uuid);
    typeBuilder.setName(nameType);

    typeBuilder.add("GEOMETRY", newGeometry.getClass());

    SimpleFeatureType featureType;

    featureType = typeBuilder.buildFeatureType();
    return featureType;
}
 
开发者ID:52North,项目名称:javaps-geotools-backend,代码行数:20,代码来源:GTHelper.java

示例2: createFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
/**
 * Here is how you can use a SimpleFeatureType builder to create the schema for your shapefile dynamically.
 * <p>
 * This method is an improvement on the code used in the main method above (where we used DataUtilities.createFeatureType) because we
 * can set a Coordinate Reference System for the FeatureType and a a maximum field length for the 'name' field dddd
 */
private static SimpleFeatureType createFeatureType() {
	
	SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
	builder.setName("Location");
	builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system
	
	// add attributes in order
	builder.add("the_geom", Point.class);
	builder.length(15).add("Name", String.class); // <- 15 chars width for name field
	
	// build the type
	final SimpleFeatureType LOCATION = builder.buildFeatureType();
	
	return LOCATION;
}
 
开发者ID:petebrew,项目名称:fhaes,代码行数:22,代码来源:Csv2Shape2.java

示例3: createFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
/**
 * Here is how you can use a SimpleFeatureType builder to create the schema for your shapefile dynamically.
 * <p>
 * This method is an improvement on the code used in the main method above (where we used DataUtilities.createFeatureType) because we
 * can set a Coordinate Reference System for the FeatureType and a a maximum field length for the 'name' field dddd
 */
@SuppressWarnings("unused")
private static SimpleFeatureType createFeatureType() {
	
	SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
	builder.setName("Location");
	builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system
	
	// add attributes in order
	builder.add("Location", Point.class);
	builder.length(15).add("Name", String.class); // <- 15 chars width for name field
	
	// build the type
	final SimpleFeatureType LOCATION = builder.buildFeatureType();
	
	return LOCATION;
}
 
开发者ID:petebrew,项目名称:fhaes,代码行数:23,代码来源:Csv2Shape.java

示例4: createFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
private static SimpleFeatureType createFeatureType(List<Integer> years) {

	SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
	builder.setName("FHAES");
	builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system
	
	// add attributes in order
	builder.add("the_geom", Point.class);
	builder.add("name", String.class);
	for (Integer i : years)
	{
		builder.add(i + "", Integer.class);
	}
	
	// build the type
	final SimpleFeatureType FHAES = builder.buildFeatureType();
	
	return FHAES;
}
 
开发者ID:petebrew,项目名称:fhaes,代码行数:20,代码来源:ShapeFileDialog.java

示例5: createStyle2FeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
private static SimpleFeatureType createStyle2FeatureType() {

	SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
	builder.setName("FHAES");
	builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system
	
	// add attributes in order
	builder.add("the_geom", Point.class);
	builder.add("name", String.class);
	builder.add("year", Integer.class);
	builder.add("value", Integer.class);
	
	// build the type
	final SimpleFeatureType FHAES = builder.buildFeatureType();
	
	return FHAES;
}
 
开发者ID:petebrew,项目名称:fhaes,代码行数:18,代码来源:ShapeFileDialog.java

示例6: getFeatureSchema

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
/**
 * The purpose of this method is to generate the schema definition for the GeoJSON.
 * @return SimpleFeatureType defining the the feature properties.
 */
public SimpleFeatureType getFeatureSchema() {
    final SimpleFeatureTypeBuilder simpleFeatureType = new SimpleFeatureTypeBuilder();
    simpleFeatureType.add("geom", LineString.class, DefaultGeographicCRS.WGS84);
    simpleFeatureType.add("name", String.class);
    simpleFeatureType.add("activityId", Long.class);
    simpleFeatureType.setName("activity");
    simpleFeatureType.add("name", String.class);
    simpleFeatureType.add("sport", String.class);
    simpleFeatureType.add("startTime", String.class);
    simpleFeatureType.add("totalMeters", Double.class);
    simpleFeatureType.add("totalSeconds", Double.class);
    simpleFeatureType.add("minLat", Double.class);
    simpleFeatureType.add("minLon", Double.class);
    simpleFeatureType.add("maxLat", Double.class);
    simpleFeatureType.add("maxLon", Double.class);
    return simpleFeatureType.buildFeatureType();
}
 
开发者ID:smitchell,项目名称:garmin-fit-geojson,代码行数:22,代码来源:GarminFitService.java

示例7: createFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
private SimpleFeatureType createFeatureType() {

		SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
		builder.setName("GPX");
		builder.setCRS(DefaultGeographicCRS.WGS84);

		// add attributes in order
		builder.add("the_geom", Point.class);
		builder.add("gpx_id", Integer.class);
		builder.add("trk_id", Integer.class);
		builder.add("seg_id", Integer.class);
		builder.add("trkpt_id", Integer.class);
		builder.add("timestamp", String.class);
		builder.add("ele", Double.class);

		return builder.buildFeatureType();
	}
 
开发者ID:GIScience,项目名称:osmgpxfilter,代码行数:18,代码来源:ShapeFileWriter.java

示例8: createAggregationFeatures

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
public static SimpleFeatureCollection createAggregationFeatures(List<Map<String,Object>> data) {
    final SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
    builder.setName( "testType" );
    builder.add("_aggregation", HashMap.class );
    builder.add("aString", String.class );
    final SimpleFeatureType featureType = builder.buildFeatureType();
    final DefaultFeatureCollection collection = new DefaultFeatureCollection();
    final SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType);
    data.stream().forEach(item -> {
        item.keySet().stream().forEach(key -> {
            featureBuilder.set(key, item.get(key));
        });
        collection.add(featureBuilder.buildFeature(null));
    });
    return collection;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:17,代码来源:TestUtil.java

示例9: createFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
/**
 * Here is how you can use a SimpleFeatureType builder to create the schema for your shapefile
 * dynamically.
 * <p>
 * This method is an improvement on the code used in the main method above (where we used
 * DataUtilities.createFeatureType) because we can set a Coordinate Reference System for the
 * FeatureType and a a maximum field length for the 'name' field
 */
private static SimpleFeatureType createFeatureType(String name) {

    SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
    builder.setName(name);
    builder.setCRS(DefaultGeographicCRS.WGS84); // <- Coordinate reference system

    // add attributes in order
    builder.add("the_geom", MultiPolygon.class);
    builder.length(50).add("au_name", String.class); // <- 15 chars width for name field
    builder.add("value", Double.class);
    builder.add("legend", Double.class);
    
    // build the type
    final SimpleFeatureType SOIL_INDEX_TYPE = builder.buildFeatureType();

    return SOIL_INDEX_TYPE;
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:26,代码来源:SoilSealingCLCProcess.java

示例10: createExtraFeatures

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
private static Layer createExtraFeatures() {
    SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
    b.setName("Location");
    b.setCRS(DefaultGeographicCRS.WGS84);
    // picture location
    b.add("geom", Point.class);
    final SimpleFeatureType TYPE = b.buildFeatureType();

    GeometryFactory gf = JTSFactoryFinder.getGeometryFactory();
    Point point = gf.createPoint(new Coordinate(CANBERRA_LONG, CANBERRA_LAT));

    SimpleFeatureBuilder builder = new SimpleFeatureBuilder(TYPE);
    builder.add(point);
    SimpleFeature feature = builder.buildFeature("Canberra");
    DefaultFeatureCollection features = new DefaultFeatureCollection(null, null);
    features.add(feature);

    Style style = SLD.createPointStyle("Star", Color.BLUE, Color.BLUE, 0.3f, 10);

    return new FeatureLayer(features, style);
}
 
开发者ID:amsa-code,项目名称:risky,代码行数:22,代码来源:Map.java

示例11: createPolygons

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
private void createPolygons( CoordinateReferenceSystem crs, GeometryFactory gf, List<Geometry> polygons ) {
    outMap = new DefaultFeatureCollection();
    SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
    b.setName(POLYGON);
    b.setCRS(crs);
    b.add("the_geom", Polygon.class);
    b.add("id", Long.class);
    SimpleFeatureType type = b.buildFeatureType();
    SimpleFeatureBuilder fbuilder = new SimpleFeatureBuilder(type);

    long index = 0;
    int numGeometries = polygons.size();
    for( int i = 0; i < numGeometries; i++ ) {
        Geometry geometry = polygons.get(i);
        Object[] values = new Object[]{geometry, index++};
        fbuilder.addAll(values);
        SimpleFeature feature = fbuilder.buildFeature(null);
        ((DefaultFeatureCollection) outMap).add(feature);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:21,代码来源:OmsGridsGenerator.java

示例12: createPoints

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
private void createPoints( CoordinateReferenceSystem crs, GeometryFactory gf, List<LineString> verticals,
        List<LineString> horizontals ) {
    outMap = new DefaultFeatureCollection();
    SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
    b.setName(POINT);
    b.setCRS(crs);
    b.add("the_geom", Point.class);
    b.add("id", Long.class);
    SimpleFeatureType type = b.buildFeatureType();
    SimpleFeatureBuilder fbuilder = new SimpleFeatureBuilder(type);

    Geometry gVer = gf.createMultiLineString(verticals.toArray(new LineString[0]));
    Geometry gHor = gf.createMultiLineString(horizontals.toArray(new LineString[0]));

    Geometry intersection = gHor.intersection(gVer);

    long index = 0;
    int numGeometries = intersection.getNumGeometries();
    for( int i = 0; i < numGeometries; i++ ) {
        Geometry geometry = intersection.getGeometryN(i);
        Object[] values = new Object[]{geometry, index++};
        fbuilder.addAll(values);
        SimpleFeature feature = fbuilder.buildFeature(null);
        ((DefaultFeatureCollection) outMap).add(feature);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:27,代码来源:OmsGridsGenerator.java

示例13: createBboxGeometry

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
private void createBboxGeometry( CoordinateReferenceSystem crs, File lasFile, SimpleFeatureCollection outGeodata )
        throws IOException {
    final ReferencedEnvelope3D envelope = lasReader.getHeader().getDataEnvelope();
    ReferencedEnvelope env2d = new ReferencedEnvelope(envelope);
    final Polygon polygon = FeatureUtilities.envelopeToPolygon(new Envelope2D(env2d));

    final SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
    b.setName("lasdataenvelope");
    b.setCRS(crs);
    b.add("the_geom", Polygon.class);
    b.add("id", String.class);
    final SimpleFeatureType type = b.buildFeatureType();

    final SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type);
    final Object[] values = new Object[]{polygon, lasFile.getName()};
    builder.addAll(values);
    final SimpleFeature feature = builder.buildFeature(null);
    ((DefaultFeatureCollection) outGeodata).add(feature);
    OmsVectorWriter.writeVector(outFile, outGeodata);
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:21,代码来源:OmsLasConverter.java

示例14: FeatureGeometrySubstitutor

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
/**
 * @param oldFeatureType the {@link FeatureType} of the existing features.
 * @throws FactoryRegistryException 
 * @throws SchemaException
 */
public FeatureGeometrySubstitutor( SimpleFeatureType oldFeatureType, Class< ? > newGeometryType ) throws Exception {

    List<AttributeDescriptor> oldAttributeDescriptors = oldFeatureType.getAttributeDescriptors();

    // create the feature type
    SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
    b.setName(oldFeatureType.getName());
    b.setCRS(oldFeatureType.getCoordinateReferenceSystem());

    if (newGeometryType == null) {
        b.addAll(oldAttributeDescriptors);
    } else {
        for( AttributeDescriptor attributeDescriptor : oldAttributeDescriptors ) {
            if (attributeDescriptor instanceof GeometryDescriptor) {
                b.add("the_geom", newGeometryType);
            } else {
                b.add(attributeDescriptor);
            }
        }
    }
    newFeatureType = b.buildFeatureType();
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:28,代码来源:FeatureGeometrySubstitutor.java

示例15: getNmeaFeatureBuilder

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入依赖的package包/类
public static SimpleFeatureBuilder getNmeaFeatureBuilder() {
    SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
    b.setName("nmea");
    b.setCRS(DefaultGeographicCRS.WGS84);
    b.add("the_geom", Point.class);
    b.add(NmeaGpsPoint.strSpeed, Double.class);
    b.add(NmeaGpsPoint.strAltitude, Double.class);
    b.add(NmeaGpsPoint.strQuality, Double.class);
    b.add(NmeaGpsPoint.strSat, Integer.class);
    b.add(NmeaGpsPoint.strHdop, Double.class);
    b.add(NmeaGpsPoint.strMsl, Double.class);
    b.add(NmeaGpsPoint.strUtctime, String.class);
    b.add(NmeaGpsPoint.strMag_var, Double.class);
    b.add(NmeaGpsPoint.strAngle, Double.class);
    final SimpleFeatureType featureType = b.buildFeatureType();
    SimpleFeatureBuilder nmeaSimpleFeatureBuilder = new SimpleFeatureBuilder(featureType);
    return nmeaSimpleFeatureBuilder;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:19,代码来源:OmsNmeaFeatureReader.java


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