Package org.geotools.feature

Examples of org.geotools.feature.FeatureType


        for (int i = 0; i < nLayers; i++) {
            MapLayer layer = layers[i];
            FeatureReader featureReader = null;
            FeatureSource fSource = layer.getFeatureSource();
            FeatureType schema = fSource.getSchema();

            try {
                Expression bboxExpression = fFac.createBBoxExpression(mapContext
                        .getAreaOfInterest());
                GeometryFilter bboxFilter = fFac.createGeometryFilter(FilterType.GEOMETRY_INTERSECTS);
                bboxFilter.addLeftGeometry(bboxExpression);
                bboxFilter.addRightGeometry(fFac.createAttributeExpression(
                        schema, schema.getDefaultGeometry().getName()));

                Query bboxQuery = new DefaultQuery(schema.getTypeName(),
                        bboxFilter);

                LOGGER.fine("obtaining FeatureReader for "
                    + schema.getTypeName());
                featureReader = fSource.getFeatures(bboxQuery).reader();
                LOGGER.fine("got FeatureReader, now writing");

                String groupId = null;
                String styleName = null;

                groupId = schema.getTypeName();

                styleName = layer.getStyle().getName();

                writer.write("<g id=\"" + groupId + "\"");
View Full Code Here


  private void makeMapBuilderFiles(File previewDir,
                  FeatureTypeInfo layer,
                  Envelope bbox)
    throws FileNotFoundException, IOException
  {
    FeatureType featureType = layer.getFeatureType();
    String ft_name = featureType.getTypeName();
    String ft_namespace = layer.getNameSpace().getPrefix();
   
    File html_file = new File(previewDir, ft_namespace + "_"+ ft_name+".html");
    File config_file = new File(previewDir, ft_namespace + "_"+ ft_name+"Config.xml");
    File xml_file = new File(previewDir, ft_namespace + "_"+ ft_name+".xml");
View Full Code Here

        FeatureTypeConfig ftConfig;
        //JD: GEOS-399, wrap rest of method in try catch block in order to
        // report back nicely to app
    try {
      FeatureType featureType = dataStore.getSchema(featureTypeName);

      ftConfig = new FeatureTypeConfig(dataStoreID,
              featureType, false);

      // DJB: this comment looks old - SRS support is much better now. 
      //     TODO: delete this comment (but wait a bit)
      // What is the Spatial Reference System for this FeatureType?
      //
      // getDefaultGeometry().getCoordinateSystem() should help but is null
      // getDefaultGeometry().getGeometryFactory() could help, with getSRID(), but it is null
      //
      // So we will use 0 which means Cartisian Coordinates aka don't know
      //
      // Only other thing we could do is ask for a geometry and see what it's
      // SRID number is?
      //
     
      ftConfig.setSRS(0);
     
      // attempt to get a better SRS
      try {
        CoordinateReferenceSystem crs = featureType.getDefaultGeometry().getCoordinateSystem();
        Set idents = crs.getIdentifiers();
        Iterator it = idents.iterator();
        while (it.hasNext())
        {
          Identifier id = (Identifier) it.next();
          if (id.toString().indexOf("EPSG:") != -1)    // this should probably use the Citation, but this is easier!
          {
            //we have an EPSG #, so lets use it!
            String str_num = id.toString().substring(id.toString().indexOf(':')+1);
            int num = Integer.parseInt(str_num);
            ftConfig.setSRS(num);
            break// take the first EPSG
          }
        }
      }catch(Exception e)
      {
        e.printStackTrace(); // not a big deal - we'll default to 0.
      }
     
     
      FeatureSource fs = dataStore.getFeatureSource(featureType.getTypeName());
             
      // TODO translate to lat long, pending
      //This should not be done by default, as it is an expensive operation.
      //especially for very large tables.  User may know it, if not he
      //can hit the generate button (which is why it's there).
View Full Code Here

        FeatureTypeConfig ftConfig = (FeatureTypeConfig) request.getSession().getAttribute(DataConfig.SELECTED_FEATURE_TYPE);
        DataConfig dataConfig = getDataConfig();
        DataStoreConfig dsConfig = dataConfig.getDataStore(ftConfig.getDataStoreId());
        DataStore dataStore = dsConfig.findDataStore(request.getSession().getServletContext());
        FeatureType featureType = dataStore.getSchema(ftConfig.getName());
        FeatureSource fs = dataStore.getFeatureSource(featureType.getTypeName());
       
        ftConfig.setLatLongBBox(DataStoreUtils.getBoundingBoxEnvelope(fs));
        request.getSession().setAttribute(DataConfig.SELECTED_FEATURE_TYPE, ftConfig);
       
        return mapping.findForward("config.data.type.editor");
View Full Code Here

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

            try {
                return DataUtilities.createSubType(schema, null, FORCED_WGS84);
            } catch (SchemaException e) {
                throw new DataSourceException(e.getMessage(), e);
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.