I have developed a standalone swing application loaded with a shapefile of a road network using geotools (v.14.3). Now I would like to implement a feature where the user may zoom the map, and at a pre-set zoom level, the traffic volumes of the currently visible road would be drawn close to the road (Here's a sample, instead of letters, there would be the traffic volume in a number). Traffic volume is a number which the user would need to take decisions.

I've seen an example here where they discuss about drawing circles and other polygons on a separate layer on a JmapPane.

How can I draw the traffic volume of the currently zoomed road?


Simply create an SLD style with a MaxScaleDenominator set to the value that you want the labels to be added and a TextSymbolizer with a reference to the traffic volume attribute. You will probably want to set some of the options listed at the bottom of the TextSymbolizer section of the documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.