So I have tried a few different ways to create SimpleFeatures for a single data point, from various different samples of code, with no success.
I can successfully create a FeatureCollection that contains the information such that the point is drawn on the map in the display. The issue i'm having is when I click on the point using the information tool, rather than displaying the ACTUAL data for the Point, it instead displays the word "Point" (which i believe is telling me it's of type Point.class rather than the Points data).
Fairly simple setup:
SimpleFeatureTypeBuilder typeBuilder = new SimpleFeatureTypeBuilder();
typeBuilder.setName("test point information");
typeBuilder.setSRC(COORDINATE_REFERENCE_SYSTEM); // WGS84
typeBuilder.add("geom", Point.class);
typeBuilder.add("name", String.class);
typeBuilder.add("number", Integer.class);
SimpleFeatureType TYPE = typeBuilder.buildFeatureType();
DefaultFeatureCollection featureCollection = new DefaultFeatureCollection("internal",TYPE);
WKTReader2 wkt = new WKTReader2();
double longitude = positionCoordinate.getX();
double latitude = positionCoordinate.getY();
String pointString = "POINT("+longitude+" "+latitude+")";
String name = "Position"
int ID = 0;
featureCollection.add( SimpleFeatureBuilder.build(TYPE, new Object[]{ wkt.read(pointString), name, ID }, "PlatformPos"));
Style style = SLD.createPointStyle(...)
return new FeatureLayer(featureCollection, style);
The name in the information panel appears correctly, along with the number. But the Point displays "geom: Point". I have ensured it is not using awt Point anywhere and every reference to Point is the org.locationtech.jts.geom.Point.
Thanks