I'm trying to parse a GML file and make it visible with GeoTools. It is imported into the MapFrame and the geometry is there, as i get information about the polygon if i click on the mappane with the InfoTool.
But it is invisible. Is this a styling problem? Or am i using the wrong aproach in general?
 
Best regards
 
File gmlFile = new File("...mypolygon_px6_gml3.1.1.gml");    
InputStream gmlInStream = new FileInputStream(gmlFile);
GML gml = new GML(Version.GML3);
SimpleFeatureCollection featureCollection = gml.decodeFeatureCollection(gmlInStream);
        
final StyleBuilder builder = new StyleBuilder();
final PolygonSymbolizer polygonSymbolize = builder.createPolygonSymbolizer(Color.RED, Color.GREEN, 1);
final Rule rule = builder.createRule(polygonSymbolize);
rule.setElseFilter(true);
final Rule rules[] = new Rule[] { rule };
final FeatureTypeStyle featureTypeStyle = builder.createFeatureTypeStyle("Feature", rules);
final Style style = builder.createStyle();
style.setName("style");
style.getDescription().setTitle("User Style");
style.getDescription().setAbstract("Definition of Style");
style.featureTypeStyles().add(featureTypeStyle);
        
FeatureLayer layer = new FeatureLayer(featureCollection, style);
MapContent mapcontent = new MapContent();
mapcontent.getViewport().setBounds(layer.getBounds());
mapcontent.addLayer(layer);
JMapFrame.showMap(mapcontent);

Attachment: mypolygon_px6_gml3.1.1.gml
Description: Binary data

_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to