[email protected] wrote: > Hi Jody, > > Ah, I see how the CRS gets updated in the geometry attribute now. > However, for complex features, it doesn't even go through > ReprojectingFeatureCollection, that's why the schema doesn't get recreated > with the new CRS. > > My stack trace starts from ContentFeatureCollection, then > ContentFeatureSource(line 499): > > if ( !canReproject() ) { > if (query.getCoordinateSystemReproject() != null) { > try { > reader = new ReprojectFeatureReader(reader, > query.getCoordinateSystemReproject()); > } catch (Exception e) { > if(e instanceof IOException) > throw (IOException) e; > else > throw (IOException) new IOException("Error occurred > trying to reproject data").initCause(e); > } > } > } > > It creates ReprojectFeatureReader, which creates the transformer without > touching the schema. > > The code that assumes userData as CRS is in > GeometryCoordinateSequenceTransformer.transform(Geometry) line 138: > > if (crs != null) { > transformed.setUserData(crs); > } > > My original patch actually checked if it's a map or not, to be consistent > with GML2EncodingUtils. I removed it though, as from my observation when > stepping through the code, it's never a map? > > Original patch included GeometryCoordinateSequenceTransformer (that is > commented out below): > > if ((g.getUserData() == null) || g.getUserData() instanceof > CoordinateReferenceSystem) { > //set the new one to be the target crs > if (crs != null) { > transformed.setUserData(crs); > } > // } else if (g.getUserData() instanceof Map) { > // Map userData = (Map)g.getUserData(); > // userData.put(CoordinateReferenceSystem.class, crs); > } > > It's then called in GML2EncodingUtils which traces back to > AbstractGeometryTypeBinding.getProperty(), like you said. > > Hmm.. maybe the problem is that it should always use > ReprojectFeatureCollection? > > I'll write a separate email to Justin re: the binding, since I'm not sure how > to do it correctly. > Thanks for all your help so far.
Rini, I think I stumbled in exactly the same problem today: http://jira.codehaus.org/browse/GEOS-4072 I _think_ the problem could be solved by passing down the attribute SRS via the pico context like we do for parsing. Even there it seems to be a GeoServer specific hack, see AbstractGeometryTypeBinding.setCRS/initializeChildContext in the GeoServer WFS module. Maybe something similar can be done when encoding the property so that the geometry can get the CRS from the context again. Anyways, just thinking out loud, Justin should know better. Cheers Andrea ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
