On 04/02/13 14:04, Ákos Maróy wrote:
> Hi,
>
> I'm trying to reproject feature sources to a different CRS when
> rendering them using a StreamingRenderer. Basically I have the following
> pipeline:
>
> DataStore -> SimpleFeatureSource -> Layer -> MapContent
>
> where the MapContent object is drawn using a StreamingRenderer.
>
> now, I'd like to reproject the features that are rendered through this
> pipeline, and I wonder what is the intended way of achieving this. I
> tried to add a Query with a SetCoordinateSystemReproject to the
> FeatureLayer:
>
> Style style = ...
> MapContent map = new MapContent();
> CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:3416");
> SimpleFeaturesource fs = dataStore.getFeatureSource("featureName");
> FeatureLayer layer = new FeatureLayer(fs, style);
> Query query = new Query(Query.ALL);
> query.setCoordinateSystemReproject(targetCrs);
> layer.setQuery(query);
> map.addLayer(layer);
> GTRenderer rendered = new StreamingRenderer();
> renderer.setMapContent(map);
> renderer.paint(...);
>
actually I did find a solution to this, and it looks like:

...
CoordinateReferenceSystem targetCrs = CRS.decode("EPSG:3416");
SimpleFeaturesource fs = dataStore.getFeatureSource("featureName");
Query query = new Query(Query.ALL);
query.setCoordinateSystemReproject(targetCrs);
FeatureLayer layer = new FeatureLayer(fs.getFeatures(query), style);
map.addLayer(layer);
...



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to