I am not sure if that was a bug or it was caused by my mis-using. If that's a bug, I will report it soon.
On Thu, Aug 27, 2015 at 5:48 AM, Jody Garnett <jody.garn...@gmail.com> wrote: > That is also really confusing to me! Streaming renderer must be seeing > the features (or an entry would of been created for them in the label > cache). I am not sure why the line symbolizer is skipping over the > features. It looks like your XRoad line (which is drawn in one picture) > extends passed the edge of the screen. > > Still this kind of thing looks to be a bug (best reported to > https://osgeo-org.atlassian.net/projects/GEOT ) rather than asked as a > question on stack exchange :) > > > -- > Jody Garnett > > On 26 August 2015 at 00:39, maven apache <apachemav...@gmail.com> wrote: > >> This is a question I have posted at stackchange( >> http://gis.stackexchange.com/questions/159551/label-rendered-with-empty-features-using-geotools),however >> it did not own much attention, so I tried to post it here. And I will >> update the origin post once it is solved here. >> >> Origin post: >> I am using geotools to generate some images based on the shapefile data, >> it works well until I tried to add labels for the line features: the labels >> are rendered even there are no features in the images. >> Check http://i.stack.imgur.com/MVVAe.png, and >> http://i.stack.imgur.com/hNtKi.png >> As shown, the result is not what I expected, the labels are rendered >> without attached with the feature. >> >> This is the core rendering codes: >> public BufferedImage render(ShapefileDataStore dataStore, int x, int y, >> int zoom, int width, int height) { >> double[] box = new double[]{.....}; >> ReferencedEnvelope bbox = new ReferencedEnvelope(box[0], box[2], >> box[1], box[3], crs); >> BufferedImage image = new BufferedImage(rwidth, rheight, >> BufferedImage.TYPE_INT_ARGB); >> Graphics2D g = image.createGraphics(); >> g.setComposite(AlphaComposite.Clear); >> g.fillRect(0, 0, rwidth, rheight); >> g.setComposite(AlphaComposite.Src); >> MapContent mapContent = new MapContent(); >> try { >> String schemaName = dataStore.getSchema().getName().toString(); >> Style style=createStyle(); >> mapContent.addLayer(new >> FeatureLayer(dataStore.getFeatureSource(), style)); >> synchronized (renderer) { >> renderer.setMapContent(mapContent); >> renderer.paint(g, imageSize, bbox); >> } >> } catch (Exception e) { >> } finally { >> mapContent.dispose(); >> g.dispose(); >> } >> return image; >> } >> public Style createStyle(){ >> SLDParser sldParser = new SLDParser(styleFactory, new >> File("style.sld").toURL()); Style[] ss = sldParser.readXML(); return >> ss[0]; >> } >> >> And the style.sld: >> <StyledLayerDescriptor version="1.0.0"> >> ... >> <FeatureTypeStyle> >> <Rule> >> <Name>Single symbol</Name> >> <LineSymbolizer> >> <Stroke> >> <CssParameter >> name="stroke">#ffffff</CssParameter> >> <CssParameter >> name="stroke-width">10</CssParameter> >> .... >> </Stroke> >> </LineSymbolizer> >> <TextSymbolizer> >> <Label> >> <ogc:PropertyName>name</ogc:PropertyName> >> </Label> >> <Font> >> <CssParameter >> name="font-family">Arial</CssParameter> >> <CssParameter >> name="font-size">18</CssParameter> >> </Font> >> <Fill> >> <CssParameter >> name="fill">#a4bdc5</CssParameter> >> </Fill> >> <VendorOption >> name="followLine">true</VendorOption> >> </TextSymbolizer> >> </Rule> >> </FeatureTypeStyle> >> ... >> </StyledLayerDescriptor> >> Did I miss anything? >> >> Thanks. >> >> >> ------------------------------------------------------------------------------ >> >> _______________________________________________ >> GeoTools-GT2-Users mailing list >> GeoTools-GT2-Users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> >> >
------------------------------------------------------------------------------
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users