本文整理汇总了Java中org.geotools.feature.simple.SimpleFeatureTypeBuilder.setNamespaceURI方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleFeatureTypeBuilder.setNamespaceURI方法的具体用法?Java SimpleFeatureTypeBuilder.setNamespaceURI怎么用?Java SimpleFeatureTypeBuilder.setNamespaceURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.geotools.feature.simple.SimpleFeatureTypeBuilder
的用法示例。
在下文中一共展示了SimpleFeatureTypeBuilder.setNamespaceURI方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: createMissionFrameDataType
import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
public static SimpleFeatureType createMissionFrameDataType() {
final SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
simpleFeatureTypeBuilder.setName(MISSION_FRAME);
simpleFeatureTypeBuilder.setNamespaceURI(NAMESPACE);
final AttributeTypeBuilder attributeTypeBuilder = new AttributeTypeBuilder();
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Polygon.class).buildDescriptor(
"geometry"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
String.class).buildDescriptor(
"Mission"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Date.class).buildDescriptor(
"TimeStamp"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Integer.class).buildDescriptor(
"FrameNumber"));
final TimeDescriptorConfiguration timeConfig = new TimeDescriptorConfiguration();
timeConfig.setTimeName("TimeStamp");
final SimpleFeatureType type = simpleFeatureTypeBuilder.buildFeatureType();
timeConfig.updateType(type);
return type;
}
示例3: setNamespace
import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
/**
* Sets the namespace of the reprojected feature type associated with this
* data adapter
*
* @param namespaceURI
* - new namespace URI
*/
public void setNamespace(
final String namespaceURI ) {
final SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.init(reprojectedFeatureType);
builder.setNamespaceURI(namespaceURI);
reprojectedFeatureType = builder.buildFeatureType();
}
示例4: createFeatureType
import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
private static SimpleFeatureType createFeatureType(
final SimpleFeatureType featureType,
final Class<? extends Geometry> shapeClass ) {
try {
final SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName(featureType.getName().getLocalPart());
builder.setNamespaceURI(featureType.getName().getNamespaceURI());
builder.setCRS(featureType.getCoordinateReferenceSystem());
for (final AttributeDescriptor attr : featureType.getAttributeDescriptors()) {
if (attr.getType() instanceof GeometryType) {
builder.add(
attr.getLocalName(),
shapeClass);
}
else {
builder.add(
attr.getLocalName(),
attr.getType().getBinding());
}
}
return builder.buildFeatureType();
}
catch (final Exception e) {
LOGGER.warn(
"Schema Creation Error. Hint: Check the SRID.",
e);
}
return null;
}
示例5: schemaToFeatureType
import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
public static SimpleFeatureType schemaToFeatureType(
StructType schema,
String typeName ) {
final SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
typeBuilder.setName(typeName);
typeBuilder.setNamespaceURI(BasicFeatureTypes.DEFAULT_NAMESPACE);
try {
typeBuilder.setCRS(CRS.decode(
"EPSG:4326",
true));
}
catch (final FactoryException e) {
LOGGER.error(
e.getMessage(),
e);
}
final AttributeTypeBuilder attrBuilder = new AttributeTypeBuilder();
for (StructField field : schema.fields()) {
AttributeDescriptor attrDesc = attrDescFromStructField(
attrBuilder,
field);
typeBuilder.add(attrDesc);
}
return typeBuilder.buildFeatureType();
}
示例6: 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();
}
示例7: 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;
}
示例8: createMotionDataType
import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
public static SimpleFeatureType createMotionDataType() {
final SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
simpleFeatureTypeBuilder.setName(MOTION_POINT);
simpleFeatureTypeBuilder.setNamespaceURI(NAMESPACE);
final AttributeTypeBuilder attributeTypeBuilder = new AttributeTypeBuilder();
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Point.class).buildDescriptor(
"geometry"));
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(
"MotionEvent"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Date.class).buildDescriptor(
"StartTime"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Date.class).buildDescriptor(
"EndTime"));
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(
Integer.class).buildDescriptor(
"FrameNumber"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Integer.class).buildDescriptor(
"PixelRow"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Integer.class).buildDescriptor(
"PixelColumn"));
final TimeDescriptorConfiguration timeConfig = new TimeDescriptorConfiguration();
timeConfig.setStartRangeName("StartTime");
timeConfig.setEndRangeName("EndTime");
final SimpleFeatureType type = simpleFeatureTypeBuilder.buildFeatureType();
timeConfig.updateType(type);
return type;
}
示例9: createMissionSummaryDataType
import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
public static SimpleFeatureType createMissionSummaryDataType() {
final SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
simpleFeatureTypeBuilder.setName(MISSION_SUMMARY);
simpleFeatureTypeBuilder.setNamespaceURI(NAMESPACE);
final AttributeTypeBuilder attributeTypeBuilder = new AttributeTypeBuilder();
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Polygon.class).buildDescriptor(
"geometry"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
String.class).buildDescriptor(
"Mission"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Date.class).buildDescriptor(
"StartTime"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Date.class).buildDescriptor(
"EndTime"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
Integer.class).buildDescriptor(
"NumberOfFrames"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
String.class).buildDescriptor(
"Name"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
String.class).buildDescriptor(
"Security"));
simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
String.class).buildDescriptor(
"ActiveObjectClass"));
final TimeDescriptorConfiguration timeConfig = new TimeDescriptorConfiguration();
timeConfig.setStartRangeName("StartTime");
timeConfig.setEndRangeName("EndTime");
final SimpleFeatureType type = simpleFeatureTypeBuilder.buildFeatureType();
timeConfig.updateType(type);
return type;
}
示例10: createFeatureAdapter
import org.geotools.feature.simple.SimpleFeatureTypeBuilder; //导入方法依赖的package包/类
public static FeatureDataAdapter createFeatureAdapter(
final String centroidDataTypeId,
final String[] extraNumericDimensions,
final String namespaceURI,
final String SRID,
final ClusterFeatureAttribute[] attributes,
final Class<? extends Geometry> geometryClass ) {
try {
final SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName(centroidDataTypeId);
builder.setNamespaceURI(namespaceURI == null ? BasicFeatureTypes.DEFAULT_NAMESPACE : namespaceURI);
builder.setSRS(SRID);
builder.setCRS(CRS.decode(
SRID,
true));
for (final ClusterFeatureAttribute attrVal : attributes) {
builder.add(
attrVal.name,
attrVal.equals(ClusterFeatureAttribute.GEOMETRY) ? geometryClass : attrVal.type);
}
for (final String extraDim : extraNumericDimensions) {
builder.add(
extraDim,
Double.class);
}
FeatureDataAdapter adapter = new FeatureDataAdapter(
builder.buildFeatureType());
// TODO any consumers of this method will not be able to utilize
// custom CRS
adapter.init(new SpatialDimensionalityTypeProvider().createPrimaryIndex(new SpatialOptions()));
return adapter;
}
catch (final Exception e) {
LOGGER.warn(
"Schema Creation Error. Hint: Check the SRID.",
e);
}
return null;
}
示例11: 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());
}