Dear All,
I have build a data store with  CRS (WGS84) containing points displayed 
on a DefaultMapLayer.
This works fine with other layers with shapefile, gridcoverage of 
different  CRS, but, if I want to change the projection for all the 
layers, given another CRS, the layer containing the MemoryDatastore is 
not reprojected, while this works fine for the other layers 
(shapefile,gridcoverage)
Is that due on how I build the FeatureType , featurecollection( I tried 
several manners , same result)?
Does that comes from the MemoryDatyaStore( I changed in 
CollectionDataStore, same results)?
Does that comes on from how I change the projection on the 
DefaultMapLayer ?
Or anything else ? Any idea will be very appreciated.
Many thanks,
Pierre
 
I work with Geotools 2.4.4
Code to build FeatureType :
 
public static FeatureType createFeatureType()throws SchemaException   {    
                          final AttributeType GEOM = 
AttributeTypeFactory.newAttributeType("Location",Point.class,true, 
null,null,
                                                  
Projections.getCRS(Projections.WGS84) );
                          final AttributeType nom = 
AttributeTypeFactory.newAttributeType(s_nompoint,String.class, true );
                          final AttributeType taille = 
AttributeTypeFactory.newAttributeType(s_taille,Double.class );
                          final AttributeType rotation = 
AttributeTypeFactory.newAttributeType(s_rotation,Double.class );
                          final AttributeType offsetx = 
AttributeTypeFactory.newAttributeType(s_offsetx, Double.class );
                          final AttributeType offsety = 
AttributeTypeFactory.newAttributeType(s_offsety, Double.class );
                          final AttributeType couleur = 
AttributeTypeFactory.newAttributeType(s_couleur,String.class );
                          final AttributeType symbol = 
AttributeTypeFactory.newAttributeType(s_symbol,String.class );
                          final AttributeType référence = 
AttributeTypeFactory.newAttributeType(s_référence,String.class );
                          return  FeatureTypeFactory.newFeatureType(new 
AttributeType[]
                                                            { 
GEOM,nom,taille,rotation,offsetx,offsety,couleur,symbol,référence},"Point"); 

                          }
 
code to make transformation for any layer on DefaultMapLayer
 
FeatureSource fs = getFeatureSource();
        String storeTypeName = fs.getDataStore().getTypeNames()[0];      
        FeatureType schema = fs.getSchema();          
        CoordinateReferenceSystem crs =  
schema.getDefaultGeometry().getCoordinateSystem(); 
            if (crs == null)
              {System.out.println ("pas de CRS ");return;}      
                   CoordinateReferenceSystem outCRS = 
context.getCoordinateReferenceSystem() ;       
        DefaultQuery q = new DefaultQuery(storeTypeName);
        q.setCoordinateSystem(crs);
        q.setCoordinateSystemReproject(outCRS);
                   setQuery(q);
            }


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to