Package org.geotools.feature

Examples of org.geotools.feature.FeatureType


                    List residualProperties = new ArrayList(properties);
                    residualProperties.removeAll(extraGeometries);
                    residualProperties.add("nearest_distance");
                    residualProperties.add("nearest_bearing");
                    String[] residualNames = (String[]) residualProperties.toArray(new String[residualProperties.size()]);
                    FeatureType targetType = DataUtilities.createSubType(superFeatureType(meta.getFeatureType()), residualNames);
                    features = new FeatureBoundsFeatureCollection(features, targetType);
                }

                results.addFeatures(meta, features);
            }
View Full Code Here


            throw new ServiceException(e, "problem with FeatureResults", request.getHandle());
        }
    }
   
    private FeatureType superFeatureType(FeatureType oldType) {
        FeatureType featureType = null;
        try {
            FeatureTypeBuilder typeBuilder = FeatureTypeBuilder.newInstance(oldType.getTypeName());
            typeBuilder.setNamespace(oldType.getNamespace());

            //typeBuilder.setDefaultGeometry(oldType.getDefaultGeometry());
View Full Code Here

        }
        return featureType;
    }
   
    private Feature superFeature(Feature oldFeature, Double distance, Double bearing) {
        FeatureType featureType = superFeatureType(oldFeature.getFeatureType());
        Object[] attbs = new Object[featureType.getAttributeCount()];
        for (int i = 0; i < oldFeature.getFeatureType().getAttributeCount(); i++) {
            attbs[i] = oldFeature.getAttribute(i);
        }
        attbs[attbs.length - 2] = distance;
        attbs[attbs.length - 1] = bearing;
        try {
            return featureType.create(attbs, oldFeature.getID());
        } catch (Exception e) {
            LOGGER.severe("Error createing super feature: " + e); e.printStackTrace();
        }
        return null;
    }
View Full Code Here

   *
   */
  private void save() throws Exception
  {
    FeatureStore fs = (FeatureStore) ds.getFeatureSource("poly_county");
    FeatureType ft = fs.getSchema();
   
    MemoryDataStore memorystore =new MemoryDataStore();
   
    ArrayList polys = new ArrayList(resultPolygon);
   
    Geometry gfinal = null;
    if (polys.size() == 1)
    {
      gfinal = (Polygon) polys.get(0);   //POLYGON
    }
    else
    {
      GeometryFactory gf = ((Polygon) polys.get(0)).getFactory();
      gfinal = new MultiPolygon((Polygon[]) polys.toArray( new Polygon[polys.size()]),   gf    );
    }
   
    gfinal = gfinal.buffer(0); // for topologic problems.
   
     
      Object[] values = new Object[5];
      values[ft.find("module")] = MODULE;
      values[ft.find("gen_full")] = gfinal;
     
      values[ft.find("gen_1")] = generalize(gfinal,tolerance1);;
      values[ft.find("gen_2")] = generalize(gfinal,tolerance1);;
      values[ft.find("gen_3")] = generalize(gfinal,tolerance1);;
     
      Feature f = ft.create(values);
      memorystore.addFeature(f);
   
    fs.addFeatures(memorystore.getFeatureReader("poly_county"));
   
  }
View Full Code Here

//               ushighway  int,
//               statehighway int,
//               otherName text     ) with oids;
   
    FeatureStore fs = (FeatureStore) ds.getFeatureSource("major_roads");
    FeatureType ft = fs.getSchema();
   
    MemoryDataStore memorystore =new MemoryDataStore();
   
    System.out.println("saving interstate");
   
View Full Code Here

     *             DOCUMENT ME!
     * @throws DataSourceException
     *             DOCUMENT ME!
     */
    public FeatureType getSchema(String typeName) throws IOException {
      FeatureType schema = super.getSchema(typeName);

      try {
        return DataUtilities.createSubType(schema, null,
            DefaultGeographicCRS.WGS84);
      } catch (SchemaException e) {
View Full Code Here

        DataConfig dataConfig = getDataConfig();
        DataStoreConfig dsConfig = dataConfig.getDataStore(typeForm
                .getDataStoreId());
        DataStore dataStore = dsConfig.findDataStore(request.getSession()
                                                            .getServletContext());
        FeatureType featureType = dataStore.getSchema(typeForm.getTypeName());
        FeatureSource fs = dataStore.getFeatureSource(featureType.getTypeName());
       
        LOGGER.fine("calculating bbox for their dataset" );
        Envelope envelope = DataStoreUtils.getBoundingBoxEnvelope(fs);
       
        if (envelope.isNull()) // there's no data in the featuretype!!
        {
          LOGGER.fine("FeatureType '"+featureType.getTypeName()+"' has a null bounding box" );
            ActionErrors errors = new ActionErrors();
            errors.add(ActionErrors.GLOBAL_ERROR,
                new ActionError("error.data.nullBBOX",featureType.getTypeName() ));
            saveErrors(request, errors);
            return mapping.findForward("config.data.type.editor");
        }
       
        typeForm.setDataMinX(Double.toString(envelope.getMinX()));
View Full Code Here

      }
      if (schemaAttributes == null || schemaAttributes.isEmpty()) {
        schemaAttributes = new ArrayList();
        List createList = form.getCreateableAttributes();
        System.out.println("schemaAtts null, createList: " + createList);
        FeatureType fType = getFeatureType(form, request);
        for (int i = 0; i < fType.getAttributeCount(); i++) {
      AttributeType attType = fType.getAttributeType(i);
      AttributeTypeInfoConfig attributeConfig = new AttributeTypeInfoConfig(attType);
       schemaAttributes.add(attributeConfig);
        //new ArrayList();
        //DataStoreConfig dsConfig = config.
        //FeatureType featureType = config.get
View Full Code Here

    private void executeAdd(ActionMapping mapping, TypesEditorForm form,
        UserContainer user, HttpServletRequest request) {
        String attributeName = form.getNewAttribute();
       
  FeatureType fType = getFeatureType(form, request);
        AttributeForm newAttribute = newAttributeForm(attributeName, fType);
        form.getAttributes().add(newAttribute);
    }
View Full Code Here

        return newAttribute;
    }

    private FeatureType getFeatureType(TypesEditorForm form,
               HttpServletRequest request) {
  FeatureType featureType = null;

        try {
            DataConfig config = ConfigRequests.getDataConfig(request);
            DataStoreConfig dataStoreConfig = config.getDataStore(form
                    .getDataStoreId());
View Full Code Here

TOP

Related Classes of org.geotools.feature.FeatureType

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.