本文整理汇总了Java中org.opengis.feature.type.GeometryType类的典型用法代码示例。如果您正苦于以下问题:Java GeometryType类的具体用法?Java GeometryType怎么用?Java GeometryType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeometryType类属于org.opengis.feature.type包,在下文中一共展示了GeometryType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: GamaGisGeometry
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
public GamaGisGeometry(final Geometry g, final Feature feature) {
super(g);
if (feature != null) {
// We filter out the geometries (already loaded before)
for (final Property p : feature.getProperties()) {
if (!(p.getType() instanceof GeometryType)) {
final String type = p.getDescriptor().getType().getBinding().getSimpleName();
if ("String".equals(type)) {
String val = (String) p.getValue();
if (val != null && ((val.startsWith("'") && val.endsWith("'")) || (val.startsWith("\"") && val.endsWith("\""))))
val = val.substring(1, val.length() - 1);
setAttribute(p.getName().getLocalPart(), val);
} else
setAttribute(p.getName().getLocalPart(), p.getValue());
}
}
}
}
开发者ID:gama-platform,项目名称:gama,代码行数:20,代码来源:GamaGisGeometry.java
示例2: getAttributes
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
@Override
public IList<String> getAttributes(final IScope scope) {
final Map<String, String> attributes = new LinkedHashMap<>();
final SimpleFeatureCollection store = getFeatureCollection(scope);
final java.util.List<AttributeDescriptor> att_list = store.getSchema().getAttributeDescriptors();
for (final AttributeDescriptor desc : att_list) {
String type;
if (desc.getType() instanceof GeometryType) {
type = "geometry";
} else {
type = Types.get(desc.getType().getBinding()).toString();
}
attributes.put(desc.getName().getLocalPart(), type);
}
return GamaListFactory.createWithoutCasting(Types.STRING, attributes.keySet());
}
开发者ID:gama-platform,项目名称:gama,代码行数:18,代码来源:GamaGeoJsonFile.java
示例3: findDescription
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
public static ShapeFileDesc findDescription(File file) throws IOException {
FileDataStore store = FileDataStoreFinder.getDataStore(file);
SimpleFeatureType schema = store.getSchema();
GeometryDescriptor geometryDescriptor = schema.getGeometryDescriptor();
GeometryType type = geometryDescriptor.getType();
CoordinateReferenceSystem coordinateReferenceSystem = geometryDescriptor.getCoordinateReferenceSystem();
List<AttributeDescriptor> attributeDescriptors = schema.getAttributeDescriptors();
List<String> labels = new ArrayList();
for (AttributeDescriptor a : attributeDescriptors) {
labels.add(a.getLocalName());
//labels
System.out.println(a.getLocalName());
}
//projection system
// System.out.println(coordinateReferenceSystem.getCoordinateSystem().getName().toString());
//type
System.out.println(parseGeometry(type));
double w = store.getFeatureSource().getBounds().getWidth();
double h = store.getFeatureSource().getBounds().getHeight();
return new ShapeFileDesc(coordinateReferenceSystem == null ? null : coordinateReferenceSystem.getCoordinateSystem().getName().toString(),
parseGeometry(type), labels, Math.sqrt(w * w + h * h));
}
开发者ID:skp703,项目名称:RainInterpolator,代码行数:24,代码来源:ParseShapefiles.java
示例4: parseGeometry
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
private static GeometryTypeString parseGeometry(GeometryType type) {
GeometryTypeString geometryType;
//Geometry type
Class<?> clazz = type.getBinding();
if (Polygon.class.isAssignableFrom(clazz)
|| MultiPolygon.class.isAssignableFrom(clazz)) {
geometryType = GeometryTypeString.POLYGON;
} else if (LineString.class.isAssignableFrom(clazz)
|| MultiLineString.class.isAssignableFrom(clazz)) {
geometryType = GeometryTypeString.LINE;
} else {
geometryType = GeometryTypeString.POINT;
}
return geometryType;
}
开发者ID:skp703,项目名称:RainInterpolator,代码行数:19,代码来源:ParseShapefiles.java
示例5: createFeatureWithGeometry
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
private SimpleFeature createFeatureWithGeometry(
final Geometry geometry ) {
final Object[] values = new Object[builder.getFeatureType().getAttributeCount()];
for (int i = 0; i < values.length; i++) {
final AttributeDescriptor desc = builder.getFeatureType().getDescriptor(
i);
if (desc.getType() instanceof GeometryType) {
values[i] = geometry;
}
else {
final Class<?> binding = desc.getType().getBinding();
if (String.class.isAssignableFrom(binding)) {
values[i] = UUID.randomUUID().toString();
}
}
}
return builder.buildFeature(
UUID.randomUUID().toString(),
values);
}
开发者ID:locationtech,项目名称:geowave,代码行数:22,代码来源:GeometryDataSetGenerator.java
示例6: equals
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
@Override
public boolean equals(Object other) {
if (!(other instanceof GeometryType)) {
return false;
}
if (!super.equals(other)) {
return false;
}
GeometryType o = (GeometryType) other;
if (CRS == null) {
return o.getCoordinateReferenceSystem() == null;
}
if (o.getCoordinateReferenceSystem() == null) {
return false;
}
return true;
}
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:18,代码来源:GeometryTypeImpl.java
示例7: getDefaultGeometryDescriptor
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/** Build a GeometryDescriptor from a JTS {@link Geometry} with the name of 'the_geom'.<p>
* This method will attempt to get a valid SRID from the Geometry. If it can't
* get one then WGS84 (EPSG:4326) will be set on the GeometryDescriptor, therefore it is
* always best to set it first using {@linkplain Geometry#setSRID(int)}
*
* @param geometry
* @return A new {@link GeometryDescriptor}
*/
public static GeometryDescriptor getDefaultGeometryDescriptor(Geometry geometry) {
Name gName = new NameImpl(geometry.getGeometryType());
GeometryType gType = null;
// Does the geometry contain an SRID we can use?
int srid = geometry.getSRID();
if (srid>0) {
CoordinateReferenceSystem crs = new CoordinateReferenceSystemImpl("EPSG:"+srid);
gType = new GeometryTypeImpl(gName, Geometry.class, crs);
} else {
// Create assuming EPSG:4326
gType = new GeometryTypeImpl(gName, Geometry.class);
}
return new GeometryDescriptorImpl(gType, new NameImpl("the_geom"));
}
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:27,代码来源:SimpleFeatureTypeImpl.java
示例8: equals
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
@Override
public boolean equals(Object other) {
if (!(other instanceof GeometryType)) {
return false;
}
if (!super.equals(other)) {
return false;
}
GeometryType o = (GeometryType) other;
if (CRS == null) {
return o.getCoordinateReferenceSystem() == null;
}
if (o.getCoordinateReferenceSystem() == null) {
return false;
}
return CRS.equals(o.getCoordinateReferenceSystem());
}
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:18,代码来源:GeometryTypeImpl.java
示例9: cloneWithDimensionality
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/**
* Clones the given schema, changing the geometry attribute to match the given dimensionality.
*
* @param schema schema to clone
* @param dimensionality dimensionality for the geometry 1= points, 2= lines, 3= polygons
*
*/
private FeatureType cloneWithDimensionality(FeatureType schema, int dimensionality) {
SimpleFeatureType simpleFt = (SimpleFeatureType) schema;
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName(schema.getName());
builder.setCRS(schema.getCoordinateReferenceSystem());
for (AttributeDescriptor desc : simpleFt.getAttributeDescriptors()) {
if (isMixedGeometry(desc)) {
GeometryDescriptor geomDescriptor = (GeometryDescriptor) desc;
GeometryType geomType = geomDescriptor.getType();
Class<?> geometryClass = getGeometryForDimensionality(dimensionality);
GeometryType gt = new GeometryTypeImpl(geomType.getName(), geometryClass,
geomType.getCoordinateReferenceSystem(), geomType.isIdentified(),
geomType.isAbstract(), geomType.getRestrictions(), geomType.getSuper(),
geomType.getDescription());
builder.add(new GeometryDescriptorImpl(gt, geomDescriptor.getName(),
geomDescriptor.getMinOccurs(), geomDescriptor.getMaxOccurs(),
geomDescriptor.isNillable(), geomDescriptor.getDefaultValue()));
} else {
builder.add(desc);
}
}
schema = builder.buildFeatureType();
return schema;
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:35,代码来源:SLDEditorBufferedImageLegendGraphicBuilder.java
示例10: getPropertyDescriptorList
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/**
* Gets the property descriptor list.
*
* @return the property descriptor list
*/
public Collection<PropertyDescriptor> getPropertyDescriptorList() {
if (schema != null) {
return schema.getDescriptors();
} else {
if (geometryType == GeometryTypeEnum.RASTER) {
if (rasterPropertyDescriptorList == null) {
rasterPropertyDescriptorList = new ArrayList<PropertyDescriptor>();
CoordinateReferenceSystem crs = null;
boolean isIdentifiable = false;
boolean isAbstract = false;
List<Filter> restrictions = null;
AttributeType superType = null;
InternationalString description = null;
GeometryType type = featureTypeFactory.createGeometryType(
new NameImpl(rasterGeometryField), GridCoverage2D.class, crs,
isIdentifiable, isAbstract, restrictions, superType, description);
GeometryDescriptor descriptor = featureTypeFactory.createGeometryDescriptor(
type, new NameImpl(rasterGeometryField), 0, 1, false, null);
rasterPropertyDescriptorList.add(descriptor);
}
return rasterPropertyDescriptorList;
}
}
return null;
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:34,代码来源:DataSourceInfo.java
示例11: addFeatures
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/**
* Adds features to the store.
* @param featureStore the store.
* @param features the features to write
* @throws IOException if there is an issue writing the features
* @see com.foursquare.geo.shapes.ShapefileUtils#featureStore
*/
public static void addFeatures(AbstractDataStore featureStore, Iterable<? extends WritableFeature> features) throws IOException {
Transaction transaction = Transaction.AUTO_COMMIT;
SimpleFeatureType schema = featureStore.getSchema(featureStore.getNames().get(0));
FeatureWriter<SimpleFeatureType, SimpleFeature> writer = featureStore.getFeatureWriterAppend(
schema.getTypeName(),
transaction
);
List<Name> attributeNames = new ArrayList<Name>();
for (AttributeDescriptor desc : schema.getAttributeDescriptors()) {
if (!(desc.getType() instanceof GeometryType)) {
attributeNames.add(desc.getName());
}
}
for (WritableFeature feature : features) {
SimpleFeature newFeature = writer.next();
newFeature.setDefaultGeometry(feature.getDefaultGeometry());
for (Name name : attributeNames) {
newFeature.setAttribute(name, feature.getAttribute(name));
}
writer.write();
}
writer.close();
transaction.commit();
transaction.close();
}
开发者ID:foursquare,项目名称:shapefile-geo,代码行数:34,代码来源:ShapefileUtils.java
示例12: createFeatureType
import org.opengis.feature.type.GeometryType; //导入依赖的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;
}
开发者ID:locationtech,项目名称:geowave,代码行数:31,代码来源:CentroidManagerGeoWave.java
示例13: getSchema
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/** Get a constructed SimpleFeatureType based on all the available
* details for this table.
*
* @return
*/
public SimpleFeatureType getSchema() {
// Build the geometry descriptor for this 'image' SimpleFeatureType.
CoordinateReferenceSystem thisCRS = getBounds().getCoordinateReferenceSystem();
GeometryType gType = new GeometryTypeImpl(
new NameImpl("Envelope"),
Geometry.class,
new CoordinateReferenceSystemImpl( thisCRS.getName().getCode() ) );
// We only have two attributes - The raster data and a bounding box for the tile
ArrayList<AttributeType> attrs = new ArrayList<AttributeType>();
attrs.add(new AttributeTypeImpl(new NameImpl("the_image"), Byte[].class ) );
attrs.add(new AttributeTypeImpl(new NameImpl("the_geom"), Geometry.class) );
attrs.add(new AttributeTypeImpl(new NameImpl("tile_column"), Integer.class) );
attrs.add(new AttributeTypeImpl(new NameImpl("tile_row"), Integer.class) );
attrs.add(new AttributeTypeImpl(new NameImpl("zoom_level"), Integer.class) );
attrs.trimToSize();
// Construct the feature type
SimpleFeatureType featureType = new SimpleFeatureTypeImpl(
new NameImpl( tableName ),
attrs,
new GeometryDescriptorImpl(gType, new NameImpl("the_geom"))
);
return featureType;
}
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:33,代码来源:TilesTable.java
示例14: determineGeometryType
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/**
* Determine geometry type.
*
* @param type the type
*/
private void determineGeometryType(GeometryType type) {
Class<?> bindingType = type.getBinding();
dsInfo.setGeometryType(GeometryTypeMapping.getGeometryType(bindingType));
}
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:11,代码来源:CreateExternalDataSource.java
示例15: createFeatureType
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/**
* You cannot call this once the dialog is closed, see the okPressed method.
* @param originalFeatureType
* @param expressions
* @param names
* @return a SimpleFeatureType created based on the contents of Text
*/
private SimpleFeatureType createFeatureType( String expressionString, SimpleFeatureType originalFeatureType,
List<String> names, List<Expression> expressions ) throws SchemaException {
SimpleFeatureTypeBuilder build = new SimpleFeatureTypeBuilder();
for( int i = 0; i < names.size(); i++ ) {
String name = names.get(i);
Expression expression = expressions.get(i);
Object value = expression.evaluate(sample);
// hack because sometimes expression returns null. I think the real bug is with
// AttributeExpression
Class< ? > binding = null;
if (value == null) {
if (expression instanceof PropertyName) {
String path = ((PropertyName) expression).getPropertyName();
AttributeType attributeType = sample.getFeatureType().getType(path);
if (attributeType == null) {
throw new ModelsIllegalargumentException("Attribute type is null", this.getClass().getSimpleName(), pm);
}
binding = attributeType.getClass();
}
} else {
binding = value.getClass();
}
if (binding == null) {
throw new ModelsIllegalargumentException("Binding is null", this.getClass().getSimpleName(), pm);
}
if (Geometry.class.isAssignableFrom(binding)) {
CoordinateReferenceSystem crs;
AttributeType originalAttributeType = originalFeatureType.getType(name);
if (originalAttributeType instanceof GeometryType) {
crs = ((GeometryType) originalAttributeType).getCoordinateReferenceSystem();
} else {
crs = originalFeatureType.getCoordinateReferenceSystem();
}
build.crs(crs);
build.add(name, binding);
} else {
build.add(name, binding);
}
}
build.setName(getNewTypeName(originalFeatureType.getTypeName()));
return build.buildFeatureType();
}
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:59,代码来源:OmsVectorReshaper.java
示例16: read
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/**
* Read attribute in position marked by <code>index</code>.
*
* @param index Attribute position to read
* @return Value for the attribtue in position <code>index</code>
* @throws IOException
* @throws ArrayIndexOutOfBoundsException
*/
public Object read(int index) throws IOException,
ArrayIndexOutOfBoundsException {
if (line == null) {
throw new IOException(
"No content available - did you remeber to call next?");
}
AttributeDescriptor attType = type.getDescriptor(index);
String stringValue = null;
try {
// read the value
stringValue = text[index];
// trim off any whitespace
if (stringValue != null) {
stringValue = stringValue.trim();
}
if ("".equals(stringValue)) {
stringValue = null;
}
} catch (RuntimeException e1) {
e1.printStackTrace();
stringValue = null;
}
// check for special <null> flag
if ("<null>".equals(stringValue)) {
stringValue = null;
}
if (stringValue == null) {
if (attType.isNillable()) {
return null;
}
}
// Use of Converters to convert from String to requested java binding
Object value = Converters.convert(stringValue, attType.getType()
.getBinding());
if (attType.getType() instanceof GeometryType) {
// this is to be passed on in the geometry objects so the srs name
// gets encoded
CoordinateReferenceSystem crs = ((GeometryType) attType.getType())
.getCoordinateReferenceSystem();
if (crs != null) {
// must be geometry, but check anyway
if (value != null && value instanceof Geometry) {
((Geometry) value).setUserData(crs);
}
}
}
return value;
}
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:62,代码来源:PropertyAttributeReader.java
示例17: getType
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
@Override
public GeometryType getType() {
return (GeometryType) super.getType();
}
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:5,代码来源:GeometryDescriptorImpl.java
示例18: getSchema
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/** Get a constructed SimpleFeatureType based on all the available
* details for this table.
*
* @return
* @throws Exception
*/
public SimpleFeatureType getSchema() throws Exception {
/* Build the geometry descriptor for this SimpleFeatureType. Internally we're going to use
* Proj.4 for any projection/ transformation, therefore not (currently) concerned with the
* definition supplied in the GeoPackage */
GeometryInfo geomInfo = getGeometryInfo();
GeometryType gType = new GeometryTypeImpl(
new NameImpl(geomInfo.getGeometryTypeName()),
Geometry.class,
new CoordinateReferenceSystemImpl(""+geomInfo.getSrsID()) );
GeometryDescriptor gDescr = new GeometryDescriptorImpl( gType, new NameImpl( geomInfo.getColumnName() ) );
// Get the field information to build the Attribute Types with
ArrayList<AttributeType> attrTypes = new ArrayList<AttributeType>();
FeatureField ff = null;
Class<?> binding = null;
AttributeTypeImpl attType = null;
String desc = "";
String featureFieldName = null;
for (GpkgField gf : getFields() ) {
ff = (FeatureField)gf;
/* If this is the feature id (and text) we'll add as a FeatureID,
* not as an attribute later */
if (ff.isFeatureID()) {
featureFieldName = ff.getFieldName();
continue;
} else {
binding = ff.getFieldName().equals(geomInfo.getColumnName()) ? Geometry.class : geoPackage.decodeType( ff.getFieldType() );
desc = ff.getTitle()==null || ff.getTitle().equals("") ? ff.getDescription() : ff.getTitle();
attType = new AttributeTypeImpl( new NameImpl(ff.getFieldName()), binding );
attType.setDescription( desc );
attrTypes.add(attType);
}
}
attrTypes.trimToSize();
SimpleFeatureTypeImpl featureType = new SimpleFeatureTypeImpl(
new NameImpl( getTableName() ),
attrTypes,
gDescr);
featureType.setDescription(getDescription());
return featureType;
}
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:61,代码来源:FeaturesTable.java
示例19: loadTilesToCollection
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/**
*
* @param typeName The name of the feature type on the collection
* (should match the tableName)
* @param path The directory where the tiles are stored
* @return
*/
public boolean loadTilesToCollection(String typeName, File path) {
if (!path.exists()) return false;
log.log(Level.INFO, "Loading Images...");
// Build attribute definitions
ArrayList<AttributeType> attrs = new ArrayList<AttributeType>();
attrs.add(new AttributeTypeImpl(new NameImpl("the_image"), Byte[].class ) );
//attrs.add(new AttributeTypeImpl(new NameImpl("the_geom"), Geometry.class) );
// The geometry
GeometryType gType = new GeometryTypeImpl(
new NameImpl("Envelope"),
Geometry.class,
new CoordinateReferenceSystemImpl("3857"));
// Now construct the feature type
Name fTypeName = new NameImpl( typeName );
SimpleFeatureType sft = new SimpleFeatureTypeImpl(
fTypeName,
attrs,
new GeometryDescriptorImpl(gType, new NameImpl("the_geom"))
);
// Create a loader for the tiles
RasterTile loader = new RasterTile( null );
int numLoaded = 0;
try {
// Load each file..
for (File f : path.listFiles()) {
loader.setInitialID( f.toString() );
numLoaded = loader.loadFeatures( f, sft );
}
} catch (Exception e) {
e.printStackTrace();
return false;
}
if (imageCollection==null) imageCollection = new FeatureCollection();
Map<Name, SimpleFeatureType> fTypes = new HashMap<Name, SimpleFeatureType>();
fTypes.put(fTypeName, sft);
List<String> newIDs = imageCollection.mergeAll( fTypes, loader );
log.log(Level.INFO, "Loaded "+newIDs.size()+" images");
return newIDs.size() > 0;
}
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:58,代码来源:GpkgTEST.java
示例20: GeometryDescriptorImpl
import org.opengis.feature.type.GeometryType; //导入依赖的package包/类
/** Simple constructor.<p>
* Creates with default values of; Min=0, Max=1, Nillable = false, DefaultValue = Null.
*
* @param type A {@link GeometryType} that defines the CRS and
* type of geometry, such as LineString, Point, MulitPolygon etc
* @param name The name of the geometry field, such as 'the_geom'.
*/
public GeometryDescriptorImpl(GeometryType type, Name name) {
this(type, name, 0, 1, false, null);
}
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:11,代码来源:GeometryDescriptorImpl.java
注:本文中的org.opengis.feature.type.GeometryType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论