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


Java SimpleFeatureTypeBuilder.setDefaultGeometry方法代码示例

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


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

示例1: createTrackFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
private static SimpleFeatureType createTrackFeatureType(GeoCoding geoCoding) {
    SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder();
    ftb.setName("org.esa.snap.TrackPoint");
    /*0*/
    ftb.add("pixelPos", Point.class, geoCoding.getImageCRS());
    /*1*/
    ftb.add("geoPos", Point.class, DefaultGeographicCRS.WGS84);
    /*2*/
    ftb.add("data", Double.class);
    ftb.setDefaultGeometry(geoCoding instanceof CrsGeoCoding ? "geoPos" : "pixelPos");
    // GeoTools Bug: this doesn't work
    // ftb.userData("trackPoints", "true");
    final SimpleFeatureType ft = ftb.buildFeatureType();
    ft.getUserData().put("trackPoints", "true");
    return ft;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:17,代码来源:ImportTrackAction.java

示例2: changeGeometryType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
static SimpleFeatureType changeGeometryType(SimpleFeatureType original, Class<?> geometryType) {
    SimpleFeatureTypeBuilder sftb = new SimpleFeatureTypeBuilder();
    sftb.setCRS(original.getCoordinateReferenceSystem());
    sftb.setDefaultGeometry(original.getGeometryDescriptor().getLocalName());
    boolean defaultGeometryAdded = false;
    for (AttributeDescriptor descriptor : original.getAttributeDescriptors()) {
        if (original.getGeometryDescriptor().getLocalName().equals(descriptor.getLocalName())) {
            sftb.add(descriptor.getLocalName(), geometryType);
            defaultGeometryAdded = true;
        }else {
            sftb.add(descriptor);
        }
    }
    if(!defaultGeometryAdded) {
        sftb.add(original.getGeometryDescriptor().getLocalName(), geometryType);
    }
    sftb.setName("FT_" + geometryType.getSimpleName());
    return sftb.buildFeatureType();
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:ExportGeometryAction.java

示例3: createSimpleFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
private SimpleFeatureType createSimpleFeatureType(String typeName, Class<?> geometryType, SimpleFeatureType defaults) {
    SimpleFeatureTypeBuilder sftb = new SimpleFeatureTypeBuilder();
    if (defaults != null) {
        //sftb.init(defaults);
    }
    DefaultGeographicCRS crs = DefaultGeographicCRS.WGS84;
    sftb.setCRS(crs);
    sftb.setName(typeName);
    sftb.add("geom", geometryType);
    sftb.add("style", String.class);
    sftb.setDefaultGeometry("geom");
    return sftb.buildFeatureType();
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:14,代码来源:FeatureFigureEditorApp.java

示例4: addInvalidFeatureTypes

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
private void addInvalidFeatureTypes() {
	
	IVgiFeatureType vgiFeatureTypePoint = new VgiFeatureTypeImpl();
	SimpleFeatureTypeBuilder featureTypePoint = new SimpleFeatureTypeBuilder();
	featureTypePoint.setName(invalidFeatureTypePoint);
	featureTypePoint.setCRS(DefaultGeographicCRS.WGS84);
	featureTypePoint.add("geom", Point.class);
	featureTypePoint.setDefaultGeometry("geom");
	featureTypePoint.add("osm_id", Long.class);
	featureTypePoint.add("deleted", Boolean.class);
	vgiFeatureTypePoint.setFeatureType(featureTypePoint.buildFeatureType());
	vgiFeatureTypePoint.getFeatureTypeTagsInclude().put("invalid", new ArrayList<String>());
	featureTypeList.put(featureTypePoint.getName(), vgiFeatureTypePoint);
	
	IVgiFeatureType vgiFeatureTypeLine = new VgiFeatureTypeImpl();
	SimpleFeatureTypeBuilder featureTypeLine = new SimpleFeatureTypeBuilder();
	featureTypeLine.setName(invalidFeatureTypeLine);
	featureTypeLine.setCRS(DefaultGeographicCRS.WGS84);
	featureTypeLine.add("geom", LineString.class);
	featureTypeLine.setDefaultGeometry("geom");
	featureTypeLine.add("osm_id", Long.class);
	featureTypeLine.add("length", Double.class);
	featureTypeLine.add("deleted", Boolean.class);
	vgiFeatureTypeLine.setFeatureType(featureTypeLine.buildFeatureType());
	vgiFeatureTypeLine.getFeatureTypeTagsInclude().put("invalid", new ArrayList<String>());
	featureTypeList.put(featureTypeLine.getName(), vgiFeatureTypeLine);
	
	IVgiFeatureType vgiFeatureTypePolygon = new VgiFeatureTypeImpl();
	SimpleFeatureTypeBuilder featureTypePolygon = new SimpleFeatureTypeBuilder();
	featureTypePolygon.setName(invalidFeatureTypePolygon);
	featureTypePolygon.setCRS(DefaultGeographicCRS.WGS84);
	featureTypePolygon.add("geom", Polygon.class);
	featureTypePolygon.setDefaultGeometry("geom");
	featureTypePolygon.add("osm_id", Long.class);
	featureTypePolygon.add("area", Double.class);
	featureTypePolygon.add("deleted", Boolean.class);
	vgiFeatureTypePolygon.setFeatureType(featureTypePolygon.buildFeatureType());
	vgiFeatureTypePolygon.getFeatureTypeTagsInclude().put("invalid", new ArrayList<String>());
	featureTypeList.put(featureTypePolygon.getName(), vgiFeatureTypePolygon);
}
 
开发者ID:SGroe,项目名称:vgi-analytics-framework,代码行数:41,代码来源:VgiPipelineSettings.java

示例5: SimpleFeaturePreBuilder

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
public SimpleFeaturePreBuilder(String name, Map<String, Class> attributes) {
	SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
	typeBuilder.setName(name);
	for(String propertyName : attributes.keySet()) {
		Class binding = attributes.get(propertyName);
		typeBuilder.add(propertyName, binding);
		if(Geometry.class.isAssignableFrom(binding)) {
			typeBuilder.setDefaultGeometry(propertyName);
		}
	}
	builder = new SimpleFeatureBuilder(typeBuilder.buildFeatureType());
}
 
开发者ID:geosolutions-it,项目名称:OpenSDI-Manager2,代码行数:13,代码来源:SimpleFeaturePreBuilder.java

示例6: createShipTrackFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
private static SimpleFeatureType createShipTrackFeatureType() {
    SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder();
    DefaultGeographicCRS crs = DefaultGeographicCRS.WGS84;
    ftb.setCRS(crs);
    ftb.setName("ShipTrack");
    ftb.add("index", Integer.class);
    ftb.add("point", Point.class, crs);
    ftb.add("data", Double.class);
    ftb.setDefaultGeometry("point");
    return ftb.buildFeatureType();
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:12,代码来源:SimpleFeaturePointFigureTest.java

示例7: createFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
private SimpleFeatureType createFeatureType(Class binding) {
    SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
    builder.setName("featureType");
    builder.add("chl", Float.class);
    builder.add("sst", Double.class);
    builder.add("time", ProductData.UTC.class);
    builder.add("point", binding);
    builder.setDefaultGeometry("point");
    return builder.buildFeatureType();
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:11,代码来源:CorrelativeFieldSelectorTest.java

示例8: createFeatureType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
/**
 * Creates a {@link SimpleFeatureType} that exposes a coverage as a collections of feature points, mapping the centre of each pixel as a point
 * plus all the bands as attributes.
 * 
 * <p>
 * The FID is the long that combines x+y*width.
 * 
 * @param gc2d the {@link GridCoverage2D} to wrap.
 * @param geometryClass the class for the geometry.
 * @return a {@link SimpleFeatureType} or <code>null</code> in case we are unable to wrap the coverage
 */
public static SimpleFeatureType createFeatureType(final GridCoverage2D gc2d,
        final Class<? extends Geometry> geometryClass) {

    // checks
    Utilities.ensureNonNull("gc2d", gc2d);

    // building a feature type for this coverage
    final SimpleFeatureTypeBuilder ftBuilder = new SimpleFeatureTypeBuilder();
    ftBuilder.setName(gc2d.getName().toString());
    ftBuilder.setNamespaceURI("http://www.geotools.org/");

    // CRS
    ftBuilder.setCRS(gc2d.getCoordinateReferenceSystem2D());
    // ftBuilder.setCRS(DefaultEngineeringCRS.GENERIC_2D);

    // TYPE is as follows the_geom | band
    ftBuilder.setDefaultGeometry("the_geom");
    ftBuilder.add("the_geom", geometryClass);
    if (!geometryClass.equals(Point.class)) {
        ftBuilder.add("value", Double.class);
    } else {

        // get sample type on bands
        final GridSampleDimension[] sampleDimensions = gc2d.getSampleDimensions();
        for (GridSampleDimension sd : sampleDimensions) {
            final SampleDimensionType sdType = sd.getSampleDimensionType();
            final int dataBuffType = TypeMap.getDataBufferType(sdType);

            // TODO I think this should be a public utility inside the FeatureUtilities class
            @SuppressWarnings("rawtypes")
            final Class bandClass;
            switch (dataBuffType) {
            case DataBuffer.TYPE_BYTE:
                bandClass = Byte.class;
                break;
            case DataBuffer.TYPE_DOUBLE:
                bandClass = Double.class;
                break;
            case DataBuffer.TYPE_FLOAT:
                bandClass = Float.class;
                break;
            case DataBuffer.TYPE_INT:
                bandClass = Integer.class;
                break;
            case DataBuffer.TYPE_SHORT:
            case DataBuffer.TYPE_USHORT:
                bandClass = Short.class;
                break;
            case DataBuffer.TYPE_UNDEFINED:
            default:
                return null;
            }
            ftBuilder.add(sd.getDescription().toString(), bandClass);

        }

    }
    return ftBuilder.buildFeatureType();
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:71,代码来源:CoverageUtilities.java

示例9: createPointDataType

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
public static SimpleFeatureType createPointDataType() {

		final SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
		simpleFeatureTypeBuilder.setName(TRACK_POINT);
		simpleFeatureTypeBuilder.setNamespaceURI(NAMESPACE);

		final AttributeTypeBuilder attributeTypeBuilder = new AttributeTypeBuilder();

		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Point.class).buildDescriptor(
				"geometry"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Point.class).buildDescriptor(
				"DetailGeometry"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				String.class).buildDescriptor(
				"Mission"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				String.class).buildDescriptor(
				"TrackNumber"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				String.class).buildDescriptor(
				"TrackUUID"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				String.class).buildDescriptor(
				"TrackItemUUID"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				String.class).buildDescriptor(
				"TrackPointSource"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Date.class).buildDescriptor(
				"TimeStamp"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Double.class).buildDescriptor(
				"Speed"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Double.class).buildDescriptor(
				"Course"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				String.class).buildDescriptor(
				"Classification"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Double.class).buildDescriptor(
				"Latitude"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Double.class).buildDescriptor(
				"Longitude"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Double.class).buildDescriptor(
				"Elevation"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Double.class).buildDescriptor(
				"DetailLatitude"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Double.class).buildDescriptor(
				"DetailLongitude"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Double.class).buildDescriptor(
				"DetailElevation"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Integer.class).buildDescriptor(
				"FrameNumber"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Integer.class).buildDescriptor(
				"PixelRow"));
		simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
				Integer.class).buildDescriptor(
				"PixelColumn"));

		simpleFeatureTypeBuilder.setDefaultGeometry("geometry");

		final TimeDescriptorConfiguration timeConfig = new TimeDescriptorConfiguration();
		timeConfig.setTimeName("TimeStamp");
		final SimpleFeatureType type = simpleFeatureTypeBuilder.buildFeatureType();
		timeConfig.updateType(type);
		return type;

	}
 
开发者ID:locationtech,项目名称:geowave,代码行数:79,代码来源:Stanag4676Utils.java

示例10: testGetDataStore

import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
/**
 * Test method for {@link com.sldeditor.datasource.impl.CreateSampleData#getDataStore()}.
 */
@Test
public void testGetDataStore() {

    SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();

    String typeName = "test type name";
    b.setName(typeName);

    String namespace = null;
    b.setNamespaceURI(namespace);

    // add a geometry property
    b.setCRS(DefaultGeographicCRS.WGS84); // set crs first

    b.add("the_geom", Polygon.class);

    b.setDefaultGeometry("the_geom");

    // Build the feature type
    SimpleFeatureType schema = b.buildFeatureType();

    CreateSampleData sampleData = new CreateSampleData();
    sampleData.create(null, null);
    sampleData.create(schema, null);

    DataStore dataStore = sampleData.getDataStore();

    assertTrue(dataStore != null);
    assertEquals(GeometryTypeEnum.POLYGON, sampleData.getGeometryType());
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:34,代码来源:CreateSampleDataTest.java


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