Hi,
i am looking at the MapViewer demo in relation to my project and taking ideas from their into mine, in particular the load function. At present, the application uses a file->open technique where the user selects the .shp file to use and displays it, which it does successfully. But, in doing so, the app also reads the .sld file where the location has been hard coded into the app and read it. Right now, the app does not show the road names from my .dbf file which is the problem. The function code snippet is as follows:
public void displayShapeFile(File shpFile, File sldFile)
{
StyleFactory factory = CommonFactoryFinder.getStyleFactory(null);
// Create parser to parse SLD File and a style factory
SLDParser stylereader = new SLDParser(factory,sldFile);
// create an array style to read the xml
org.geotools.styling.Style[] style = stylereader.readXML();
// add layter for style and features
mapContext.addLayer(source,style[0]);
mapPane.repaint();
// Use this to define the "context" which holds the displayed layers
// defines contents
mapPane.setContext(mapContext);
mapPane.setReset(true);
// catc/try statenment ended.
I've been following the demo the best i can, but clearly something is missing. Can somebody tell me why it is not displaying my road names please. I've given the .sld for referrence.
roadText.sld