I am working on a program using Eclipse. I added all the jars to my Java and I managed to show multiple points and lines on the JMapFrame by adding layers to the MapContent according to example codes online.
Now I am wondering if I can add a text string next to my point or line to indicate the name of the location. I had a hard time finding the example codes. Below is the codes I used to create a layer with multipoints. Can anoyone help me with creating a layer with text strings next to certain coordinates? Thank you so much for your help. Coordinate[] coordinates = getCoordinatesSequence(); SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder(); builder.setName("feature"); builder.setCRS(DefaultGeographicCRS.WGS84); builder.add("Location", Point.class); final SimpleFeatureType TYPE = DataUtilities.createType("RoutePoints", "points", "the_geom:MultiPoint"); SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(TYPE); GeometryFactory geometryFactory = (GeometryFactory) JTSFactoryFinder.getGeometryFactory(); MultiPoint points = geometryFactory.createMultiPoint(coordinates); featureBuilder.add(points); SimpleFeature feature = featureBuilder.buildFeature(null); DefaultFeatureCollection featureCollection = new DefaultFeatureCollection( "internal", TYPE); featureCollection.add(feature); Style style = SLD.createSimpleStyle(TYPE,Color.cyan); Layer layer = new FeatureLayer(featureCollection, style); Thanks. Kind regards, Johnny
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users