Package org.geotools.feature

Examples of org.geotools.feature.AttributeTypeBuilder


  public static SimpleFeatureType createGPXPointDataType() {

    final SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    simpleFeatureTypeBuilder.setName(GPX_POINT_FEATURE);

    final AttributeTypeBuilder attributeTypeBuilder = new AttributeTypeBuilder();

    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Geometry.class).nillable(
        true).buildDescriptor(
        "geometry"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "Latitude"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "Longitude"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "Elevation"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Date.class).nillable(
        true).buildDescriptor(
        "Timestamp"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Comment"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Integer.class).nillable(
        true).buildDescriptor(
        "Satellites"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "VDOP"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "HDOP"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "PDOP"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Symbol"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Classification"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "GeoHeight"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "Course"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "MagneticVariation"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Source"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Link"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Fix"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Integer.class).nillable(
        true).buildDescriptor(
        "Station"));

    return simpleFeatureTypeBuilder.buildFeatureType();
View Full Code Here


  public static SimpleFeatureType createGPXWaypointDataType() {

    final SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    simpleFeatureTypeBuilder.setName(GPX_WAYPOINT_FEATURE);

    final AttributeTypeBuilder attributeTypeBuilder = new AttributeTypeBuilder();

    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Geometry.class).nillable(
        true).buildDescriptor(
        "geometry"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "Latitude"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "Longitude"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "Elevation"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Name"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Comment"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Description"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Symbol"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Link"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Source"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Integer.class).nillable(
        true).buildDescriptor(
        "Station"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "URL"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "URLName"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        String.class).nillable(
        true).buildDescriptor(
        "Fix"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "MagneticVariation"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "GeoHeight"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).nillable(
        true).buildDescriptor(
        "Elevation"));

    return simpleFeatureTypeBuilder.buildFeatureType();
View Full Code Here

  public static SimpleFeatureType createFeatureType(
      final String typeName ) {
    final SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    simpleFeatureTypeBuilder.setName(typeName);

    final AttributeTypeBuilder attributeTypeBuilder = new AttributeTypeBuilder();

    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Geometry.class).buildDescriptor(
        "geometry"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).buildDescriptor(
        "Value"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).buildDescriptor(
        "Normalized"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).buildDescriptor(
        "Percentile"));
    return simpleFeatureTypeBuilder.buildFeatureType();
  }
View Full Code Here

  public static SimpleFeatureType createFeatureType(
      final String typeName ) {
    final SimpleFeatureTypeBuilder simpleFeatureTypeBuilder = new SimpleFeatureTypeBuilder();
    simpleFeatureTypeBuilder.setName(typeName);

    final AttributeTypeBuilder attributeTypeBuilder = new AttributeTypeBuilder();

    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Geometry.class).buildDescriptor(
        "geometry"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).buildDescriptor(
        "Summer"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).buildDescriptor(
        "Winter"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).buildDescriptor(
        "Difference"));
    simpleFeatureTypeBuilder.add(attributeTypeBuilder.binding(
        Double.class).buildDescriptor(
        "Percentile"));
    return simpleFeatureTypeBuilder.buildFeatureType();
  }
View Full Code Here

                    }
                }

                if ( rebuild ) {
                    //rebuild with proper crs
                    AttributeTypeBuilder b = new AttributeTypeBuilder();
                    b.init(old);
                    b.setCRS( getCRS(info.getSRS()) );
                    ad = b.buildDescriptor(old.getLocalName());
                }
            }
            catch( Exception e ) {
                //log exception
            }
View Full Code Here

        }
       
        //remap the attribute to type date and ensure schema ordering is the same
        //@todo improve FeatureTypeBuilder to support this directly
        AttributeDescriptor existing = builder.remove(field);
        AttributeTypeBuilder attBuilder = new AttributeTypeBuilder();
        attBuilder.init(existing);
        attBuilder.setBinding(type);
        builder.add(index, attBuilder.buildDescriptor(field));

        return builder.buildFeatureType();
    }
View Full Code Here

        ImportData data, ImportTask task) {

        SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
        typeBuilder.setName(convertTypeName(featureType.getTypeName()));

        AttributeTypeBuilder attBuilder = new AttributeTypeBuilder();
        for (AttributeDescriptor att : featureType.getAttributeDescriptors()) {
            attBuilder.init(att);
            typeBuilder.add(attBuilder.buildDescriptor(convertAttributeName(att.getLocalName())));
        }
       
        return typeBuilder.buildFeatureType();
    }
View Full Code Here

    @Test
    public void testXMLUnsafeAttributeRenaming() {
        SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
        typeBuilder.setName("badatts");

        AttributeTypeBuilder attBuilder = new AttributeTypeBuilder();
        attBuilder.setBinding(String.class);
        typeBuilder.add(attBuilder.buildDescriptor("123_number_first"));
        attBuilder.setBinding(String.class);
        typeBuilder.add(attBuilder.buildDescriptor("i has spaces"));

        SimpleFeatureType badatts = typeBuilder.buildFeatureType();
        badatts = FeatureDataConverter.DEFAULT.convertType(badatts, null, null, null);

        assertEquals("_123_number_first", badatts.getAttributeDescriptors().get(0).getLocalName());
View Full Code Here

  public static SimpleFeatureType buildFeatureType(String sName, int iShapeType, Class<?>[] fields,
      String[] sFields, CoordinateReferenceSystem crs) {
    SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
    builder.setName(sName);

    AttributeTypeBuilder attBuilder = new AttributeTypeBuilder();
    builder.add(toGeometryAttribute(iShapeType, crs,attBuilder));
    builder.setDefaultGeometry("geom");
    for (int i = 0; i < sFields.length; i++) {
      AttributeType type = attBuilder.binding(fields[i]).buildType();
      AttributeDescriptor descriptor = attBuilder.buildDescriptor(sFields[i], type);
      builder.add(descriptor);
    }
    return builder.buildFeatureType();
   
  }
View Full Code Here

            FeatureType gsft = factory.createFeatureType(new NameImpl(GS_NAMESPACE, "Record"), ft.getDescriptors(), null, false, null, ft.getSuper(), null);
            return gsft;
        }

        public AttributeDescriptor getFeatureDescriptor() {
            AttributeTypeBuilder builder = new AttributeTypeBuilder();
            AttributeDescriptor descriptor = builder.buildDescriptor(new NameImpl(GS_NAMESPACE, "Record"), delegate.getFeatureType());
            return descriptor;
        }
View Full Code Here

TOP

Related Classes of org.geotools.feature.AttributeTypeBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.