When I post the question, it said that the content is out of the limit(50Kb), so I have to remove some markups.
This is the whole sld: <?xml version="1.0" encoding="utf-8"?> <StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <NamedLayer> <Name>def</Name> <UserStyle> <Name>xx</Name> <FeatureTypeStyle> <Rule> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#ffffff</CssParameter> <CssParameter name="stroke-width">10</CssParameter> <CssParameter name="stroke-dasharray">5 2</CssParameter> <CssParameter name="stroke-linejoin">bevel</CssParameter> <CssParameter name="stroke-linecap">square</CssParameter> </Stroke> </LineSymbolizer> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#e31a1c</CssParameter> <CssParameter name="stroke-width">6</CssParameter> <CssParameter name="stroke-dasharray">5 2</CssParameter> <CssParameter name="stroke-linejoin">bevel</CssParameter> <CssParameter name="stroke-linecap">square</CssParameter> </Stroke> </LineSymbolizer> <TextSymbolizer> <Label> <!--<ogc:Literal>linepath</ogc:Literal>--> <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> </UserStyle> </NamedLayer> </StyledLayerDescriptor> On Thu, Aug 27, 2015 at 1:44 PM, Andrea Aime <andrea.a...@geo-solutions.it> wrote: > Hi, > you should share the whole SLD, I see you have skipped bits of it > > Cheers > Andrea > > On Thu, Aug 27, 2015 at 1:55 AM, maven apache <apachemav...@gmail.com> > wrote: > >> 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 >> >> > > > -- > == > GeoServer Professional Services from the experts! Visit > http://goo.gl/it488V for more information. > == > > Ing. Andrea Aime > @geowolf > Technical Lead > > GeoSolutions S.A.S. > Via Poggio alle Viti 1187 > 55054 Massarosa (LU) > Italy > phone: +39 0584 962313 > fax: +39 0584 1660272 > mob: +39 339 8844549 > > http://www.geo-solutions.it > http://twitter.com/geosolutions_it > > *AVVERTENZE AI SENSI DEL D.Lgs. 196/2003* > > Le informazioni contenute in questo messaggio di posta elettronica e/o > nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il > loro utilizzo è consentito esclusivamente al destinatario del messaggio, > per le finalità indicate nel messaggio stesso. Qualora riceviate questo > messaggio senza esserne il destinatario, Vi preghiamo cortesemente di > darcene notizia via e-mail e di procedere alla distruzione del messaggio > stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, > divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od > utilizzarlo per finalità diverse, costituisce comportamento contrario ai > principi dettati dal D.Lgs. 196/2003. > > > > The information in this message and/or attachments, is intended solely for > the attention and use of the named addressee(s) and may be confidential or > proprietary in nature or covered by the provisions of privacy act > (Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection > Code).Any use not in accord with its purpose, any disclosure, reproduction, > copying, distribution, or either dissemination, either whole or partial, is > strictly forbidden except previous formal approval of the named > addressee(s). If you are not the intended recipient, please contact > immediately the sender by telephone, fax or e-mail and delete the > information in this message that has been received in error. The sender > does not give any warranty or accept liability as the content, accuracy or > completeness of sent messages and accepts no responsibility for changes > made after they were sent or for other risks which arise as a result of > e-mail transmission, viruses, etc. > > ------------------------------------------------------- >
------------------------------------------------------------------------------
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users