I am testing adding a point set to a map using the Geotools API. I followed this example as far as I could The problem of creating a point and adding it to FeatureCollection , as the example code is old, and things like FeatureCollections are out of date. Instead, I tried to use an instance of DefaultFeatureCollection, and I'm not sure if I use it correctly, and therefore the points do not appear on the map. What am I doing wrong? Here is my code:
private void plotMarkers() { final SimpleFeatureType TYPE = this.createFeatureType(); final SimpleFeatureBuilder BLDR = new SimpleFeatureBuilder(TYPE); DefaultFeatureCollection features = new DefaultFeatureCollection(); // arbitrary start position Coordinate pos = new Coordinate(0, 0); final double pointSpacing = 1.0; String title = "Test"; features.add(creatureFeature(BLDR, pos, title)); // display points on screen Style style = SLD.createPointStyle("circle", Color.RED, Color.RED, 1.0f, 5.0f); Layer layer = new FeatureLayer(features, style); this.getMapContent().addLayer(layer); }
gis point geotools coordinate
cj5 Apr 10 '15 at 17:22 2015-04-10 17:22
source share