Package org.geotools.gml2.bindings
Class GML2ParsingUtils
Object
GML2ParsingUtils
Utility methods used by gml2 bindings when parsing.
- Author:
- Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic StringMetadata key used to indicate if a feature type has been parsed from a XML schema, or reflected out of a sample feature -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<Geometry>Wraps the elements of a geometry collection in a normal collection.static CoordinateReferenceSystemstatic SimpleFeaturefeature(SimpleFeatureType fType, String fid, Node node) static SimpleFeatureTypefeatureType(XSDElementDeclaration element, BindingWalkerFactory bwFactory) Turns a xml type definition into a geotools feature type.static SimpleFeatureTypefeatureType(XSDElementDeclaration element, BindingWalkerFactory bwFactory, CoordinateReferenceSystem crs) Turns a xml type definition into a geotools feature type.static SimpleFeatureTypefeatureType(Node node) Turns a parse node instance into a geotools feature type.static SimpleFeatureparseFeature(ElementInstance instance, Node node, Object value, FeatureTypeCache ftCache, BindingWalkerFactory bwFactory) Utility method to implement Binding.parse for a binding which parses into A feature.
-
Field Details
-
PARSED_FROM_SCHEMA_KEY
Metadata key used to indicate if a feature type has been parsed from a XML schema, or reflected out of a sample feature
-
-
Constructor Details
-
GML2ParsingUtils
public GML2ParsingUtils()
-
-
Method Details
-
parseFeature
public static SimpleFeature parseFeature(ElementInstance instance, Node node, Object value, FeatureTypeCache ftCache, BindingWalkerFactory bwFactory) throws Exception Utility method to implement Binding.parse for a binding which parses into A feature.- Parameters:
instance- The instance being parsed.node- The parse tree.value- The value from the last binding in the chain.ftCache- The feature type cache.bwFactory- Binding walker factory.- Returns:
- A feature type.
- Throws:
Exception
-
featureType
Turns a parse node instance into a geotools feature type.For each child element and attribute of the node a geotools attribute type is created. AttributeType#getName() is derived from the name of the child element / attribute. Attribute#getType() is derived from the class of the value of the child element / attribute.
Attribute types for the mandatory properties of any gml feature type (description,name,boundedBy) are also created.
- Parameters:
node- The parse node / tree for the feature.- Returns:
- A geotools feature type
- Throws:
Exception
-
featureType
public static SimpleFeatureType featureType(XSDElementDeclaration element, BindingWalkerFactory bwFactory) throws Exception Turns a xml type definition into a geotools feature type.- Parameters:
element- The element declaration.bwFactory- The binding walker factory.- Returns:
- The corresponding geotools feature type.
- Throws:
Exception
-
featureType
public static SimpleFeatureType featureType(XSDElementDeclaration element, BindingWalkerFactory bwFactory, CoordinateReferenceSystem crs) throws Exception Turns a xml type definition into a geotools feature type.- Parameters:
element- The element declaration.bwFactory- The binding walker factory.crs- The coordinate reference system to use on this feature type.- Returns:
- The corresponding geotools feature type.
- Throws:
Exception
-
feature
public static SimpleFeature feature(SimpleFeatureType fType, String fid, Node node) throws Exception - Throws:
Exception
-
crs
-
asCollection
Wraps the elements of a geometry collection in a normal collection.
-