Examples of MfFeatureCollection


Examples of org.mapfish.geo.MfFeatureCollection

          parameters.put("geoIdPValue", geoIdPValue);
                 
        // geoserver call
          try {
           
              MfFeatureCollection featureCollection = featuresProvider.getFeatures(featureSource, parameters);
              List featureList = new ArrayList(featureCollection.getCollection());
              MfFeature feature = (MfFeature) featureList.get(0);
             
              //Geometry from GeoServer
              MfGeometry geom = feature.getMfGeometry();
             
             
              // JSON creation
              JSONObject jsonProperties = new JSONObject();
         
              //for each col
              for(int j=0; j<nc; j++){
                jsonProperties.accumulate(
                    dataStoreMeta.getFieldName(j),
                    record.getFieldAt( dataStoreMeta.getFieldIndex(dataStoreMeta.getFieldName(j)) ).getValue()
                )
              }
             
              //for each prop
              if(feature instanceof SbiFeature) {
                JSONObject properties = ((SbiFeature)feature).getProperties();
                Iterator keysIterator = properties.sortedKeys();
                while(keysIterator.hasNext()) {
                  String key = (String)keysIterator.next();
                  jsonProperties.accumulate(key, properties.get(key));
                }
              }
             
              MfFeature featureToCollect = SbiFeatureFactory.getInstance().createFeature(geoIdPValue, geom, jsonProperties);
              outputFeatureCollection.add(featureToCollect);
            } catch (Exception e) {
              e.printStackTrace();
            }
        }
       
          JSONStringer stringer = new JSONStringer();
          MfGeoJSONWriter builder = new MfGeoJSONWriter(stringer);
          builder.encodeFeatureCollection(new MfFeatureCollection(outputFeatureCollection));
         
          servletIOManager.tryToWriteBackToClient(stringer.toString());
     
    } catch(Throwable t) {
      t.printStackTrace();
View Full Code Here

Examples of org.mapfish.geo.MfFeatureCollection

  /** Logger component. */
    private static transient Logger logger = Logger.getLogger(FeaturesProviderDAOWFSImpl.class);
   
   
  public MfFeatureCollection getFeatures(Object fetureProviderEndPoint, Map parameters) {
    MfFeatureCollection featureCollection;
   
    String wfsUrl;
    String layerName;
    String geoIdPName;
    String geoIdPValue;
View Full Code Here

Examples of org.mapfish.geo.MfFeatureCollection

  /** Logger component. */
    private static transient Logger logger = Logger.getLogger(FeaturesProviderDAOFileImpl.class);
   
 
  public MfFeatureCollection getFeatures(Object fetureProviderEndPoint, Map parameters) {
    MfFeatureCollection featureCollection;
   
    String geoIdPName;
    String geoIdPValue;
    JSONObject fetaure;
   
    logger.debug("IN");
   
    featureCollection = null;
   
    try {
      geoIdPName = (String)parameters.get(GEOID_PNAME);
      logger.debug("Parameter [" + GEOID_PNAME + "] is equal to [" + geoIdPName + "]");
     
      geoIdPValue = (String)parameters.get(GEOID_PVALUE);
      logger.debug("Parameter [" + GEOID_PVALUE + "] is equal to [" + geoIdPValue + "]");
 
      if(!geoIdPName.equalsIgnoreCase(indexOnAttribute)) {
        createIndex((String)fetureProviderEndPoint, geoIdPName);
      }
     
      fetaure = lookupTable.get(geoIdPValue);
      logger.debug("Feature [" + geoIdPValue +"] is equal to [" + fetaure + "]");
      if(fetaure != null) {
        Object x = JSON_READER.decode(fetaure);
        logger.debug("Decoded object is of type [" + x.getClass().getName() + "]");
        MfFeature mfFeature = (MfFeature)x;
        Collection<MfFeature> mfFeatures = new ArrayList();
        mfFeatures.add(mfFeature);
        featureCollection = new MfFeatureCollection(mfFeatures);;
        logger.debug("Feature [" + geoIdPValue + "] added to result features' collection");
      } else {
        logger.warn("Impossible to find feature [" + geoIdPValue + "]");
      }
    } catch(Throwable t) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.