--- Begin Message ---
Jody,
thanks for response.
>>Is this the same as EPSG:4326? or DefaultGeogrpahicCRS.WGS84?
yes
in order to get this DataStore reprojected , i made a special treatment for this layer as follow:
       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);
          DataStore store = fs.getDataStore();
FeatureSource retroSource = store.getView(q); this.featureSource = retroSource;
this code works fine for this layer
Pierre

Jody Garnett a écrit :

LepiMarbois wrote:

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)

It may just be a mistake? We will have to get more specific in order to figure out where the problem is; try a couple of things 1. check the CRS used by the memory datastore; if it is null then the reproject code would not be able to work (we need a source and a target crs in order set up the math transfor fo the screen) 2. check the getFeatues method and see what Query is being sent to the Memory Datastore; is it the same as for shapefile? 3. check the output of getFeatures on memory datastore and getFeatures on shapefile for the same query; are they both reprojecting? or is one of them wrong ... the renderer sometimes checks the output and tries to do reprojecting on its own..

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) );

Is this the same as EPSG:4326? or DefaultGeogrpahicCRS.WGS84?

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);
            }

That all looks okay; but please check what comes out of fs.getFeatures( q ); we should make sure you are getting what you expect. If not please create a bug report with a test case showing thing problem.

I am the author of MemoryDataStore and would like to help check if anything is being done wrong.
Jody





--- End Message ---
-------------------------------------------------------------------------
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