Package org.geotools.data.crs

Examples of org.geotools.data.crs.ReprojectFeatureResults


        }
                //ensure reprojection occurs, do not trust query, use the wrapper 
                FeatureCollection<SimpleFeatureType, SimpleFeature> fColl = null;//fSource.getFeatures(q);
                //FeatureCollection fColl=null;
                if ( reproject ) {
                  fColl=new ReprojectFeatureResults( fSource.getFeatures(q),mapContext.getCoordinateReferenceSystem() );
                } else
                  fColl=fSource.getFeatures(q);
               
                // encodes the current layer, using the defined style
                writer.writeFeatures(fColl, layer.getStyle(),ftsList);
View Full Code Here


                regionatingFilter));
        q.setFilter(finalFilter);

        // make sure we output in 4326 since that's what KML mandates
        if (sourceCrs != null && !CRS.equalsIgnoreMetadata(WGS84, sourceCrs)) {
            return new ReprojectFeatureResults(featureSource.getFeatures(q),
                    WGS84);
        }

        return featureSource.getFeatures(q);
    }
View Full Code Here

        } else if(srsHandling == ProjectionPolicy.FORCE_DECLARED && !nativeCRS.equals(declaredCRS)) {
            fc =  new ForceCoordinateSystemFeatureResults(fc, declaredCRS);
            nativeCRS = declaredCRS;
        } else if(srsHandling == ProjectionPolicy.REPROJECT_TO_DECLARED && targetCRS == null
                && !nativeCRS.equals(declaredCRS)) {
            fc = new ReprojectFeatureResults(fc,declaredCRS);
        }

       
        //was reproject specified as part of the query?
        if (targetCRS != null ) {
            //reprojection is occuring
            if ( nativeCRS == null ) {
                //we do not know what the native crs which means we can
                // not be sure if we should reproject or not... so we go
                // ahead and reproject regardless
                fc = new ReprojectFeatureResults(fc,targetCRS);
            }
            else {
                //only reproject if native != target
                if (!CRS.equalsIgnoreMetadata(nativeCRS, targetCRS)) {
                    fc = new ReprojectFeatureResults(fc,targetCRS);                       
                }
            }
        }
        return fc;
    }
View Full Code Here

         */
        try {
            if (qCsr != null && cCsr != null) {
                if (cCs != null)
                    results = new ForceCoordinateSystemFeatureResults(results, cCs);
                results = new ReprojectFeatureResults(results, cCsr);
                if (qCs != null)
                    results = new ForceCoordinateSystemFeatureResults(results, qCs);
                results = new ReprojectFeatureResults(results, qCsr);
            } else if (qCs != null && cCsr != null) {
                // complex case 2, reprojected then forced
                // mergedQuery.setCoordinateSystem(cCs);
                // mergedQuery.setCoordinateSystemReproject(cCsr);
                try {
                    if (cCs != null)
                        results = new ForceCoordinateSystemFeatureResults(results, cCs);
                    results = new ReprojectFeatureResults(source.getFeatures(mergedQuery), cCsr);

                    results = new ForceCoordinateSystemFeatureResults(results, qCs);
                } catch (SchemaException e) {
                    throw new DataSourceException("This should not happen", e);
                }
            } else {
                // easy case, we can just put toghether one forced cs and one
                // reprojection cs
                // in the mixed query and let it go

                // mergedQuery.setCoordinateSystem(qCs != null ? qCs : cCs);
                // mergedQuery.setCoordinateSystemReproject(qCsr != null ? qCsr
                // : cCsr);
                CoordinateReferenceSystem forcedCS = qCs != null ? qCs : cCs;
                CoordinateReferenceSystem reprojectCS = qCsr != null ? qCsr : cCsr;

                if (forcedCS != null)
                    results = new ForceCoordinateSystemFeatureResults(results, forcedCS);
                if (reprojectCS != null)
                    results = new ReprojectFeatureResults(results, reprojectCS);
            }
        } catch (IOException e) {
            throw e;
        } catch (Exception e) {
            throw new DataSourceException("A problem occurred while handling forced "
View Full Code Here

                transformer.setCoordinateReferenceSystem( target );
  }
 
  public void testNormal() throws Exception {
   
    Iterator reproject = new ReprojectFeatureResults( delegate, target ).iterator();
    Iterator reader = delegate.iterator();
   
    while( reader.hasNext() ) {
      SimpleFeature normal = (SimpleFeature) reader.next();
      SimpleFeature reprojected = (SimpleFeature) reproject.next();
View Full Code Here

    }
   
  }
 
  public void testBounds() throws Exception {
      ReprojectFeatureResults rfr = new ReprojectFeatureResults( delegate, target );
      rfr.getBounds();
  }
View Full Code Here

        }
                //ensure reprojection occurs, do not trust query, use the wrapper 
                SimpleFeatureCollection fColl = null;//fSource.getFeatures(q);
                //FeatureCollection fColl=null;
                if ( reproject ) {
                  fColl=new ReprojectFeatureResults( fSource.getFeatures(q),mapContext.getCoordinateReferenceSystem() );
                } else
                  fColl=fSource.getFeatures(q);
               
                // encodes the current layer, using the defined style
                writer.writeFeatures(fColl, ftsList);
View Full Code Here

        }
        q.setFilter(finalFilter);

        // make sure we output in 4326 since that's what KML mandates
        if (sourceCrs != null && !CRS.equalsIgnoreMetadata(WGS84, sourceCrs)) {
            return new ReprojectFeatureResults(featureSource.getFeatures(q),
                    WGS84);
        }

        return featureSource.getFeatures(q);
    }
View Full Code Here

        } else if(srsHandling == ProjectionPolicy.FORCE_DECLARED && !nativeCRS.equals(declaredCRS)) {
            fc =  new ForceCoordinateSystemFeatureResults(fc, declaredCRS);
            nativeCRS = declaredCRS;
        } else if(srsHandling == ProjectionPolicy.REPROJECT_TO_DECLARED && targetCRS == null
                && !nativeCRS.equals(declaredCRS)) {
            fc = new ReprojectFeatureResults(fc,declaredCRS);
        }

       
        //was reproject specified as part of the query?
        if (targetCRS != null ) {
            //reprojection is occuring
            if ( nativeCRS == null ) {
                //we do not know what the native crs which means we can
                // not be sure if we should reproject or not... so we go
                // ahead and reproject regardless
                fc = new ReprojectFeatureResults(fc,targetCRS);
            }
            else {
                //only reproject if native != target
                if (!CRS.equalsIgnoreMetadata(nativeCRS, targetCRS)) {
                    fc = new ReprojectFeatureResults(fc,targetCRS);                       
                }
            }
        }
        return fc;
    }
View Full Code Here

        } else if(srsHandling == ProjectionPolicy.FORCE_DECLARED && !nativeCRS.equals(declaredCRS)) {
            fc =  new ForceCoordinateSystemFeatureResults(fc, declaredCRS);
            nativeCRS = declaredCRS;
        } else if(srsHandling == ProjectionPolicy.REPROJECT_TO_DECLARED && targetCRS == null
                && !nativeCRS.equals(declaredCRS)) {
            fc = new ReprojectFeatureResults(fc,declaredCRS);
        }

       
        //was reproject specified as part of the query?
        if (targetCRS != null ) {
            //reprojection is occuring
            if ( nativeCRS == null ) {
                //we do not know what the native crs which means we can
                // not be sure if we should reproject or not... so we go
                // ahead and reproject regardless
                fc = new ReprojectFeatureResults(fc,targetCRS);
            }
            else {
                //only reproject if native != target
                if (!CRS.equalsIgnoreMetadata(nativeCRS, targetCRS)) {
                    fc = new ReprojectFeatureResults(fc,targetCRS);                       
                }
            }
        }
        return fc;
    }
View Full Code Here

TOP

Related Classes of org.geotools.data.crs.ReprojectFeatureResults

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.