Skip to end of metadata
Go to start of metadata

As you can see in the diagram, features, feature types and attribute types are just interfaces.

This means that you cannot instantiate them directly, but also that you can provide your own specialized versions that wrap legacy objects you may have in your own application.

You can create a Feature by hand with the following steps:

  • create an array of attribute types, describing the attributes in your feature type, using the
    AttributeTypeFactory static methods;
  • create a FeatureType out of the attribute types using the FeatureTypeFactory static methods;
  • create the set of attribute values that describe your specific feature;
  • create the Feature object by using the FeatureType as a factory.

The following code snippet illustrates this process:

Of course, you won't usually be involved in feature creation (that's the work of DataStores) but it's nice to know how to do it by hand, to have a better understanding of how things work.

Features are usually accessed from DataStores in a streaming way. Should you need to handle a set of Features in memory, have a look at the FeatureCollection class, which is a specialized Set designed to hold features and provides a convenient FeatureIterator that doesn't require you to use casts when calling the next() method.

  • No labels