public static VectorLayer createGeometryLayer(List<Geometry> gs)
{
if (gs.size() == 0) return null;
FeatureCollection fc = new FeatureList();
EnvelopeBuf eb = new EnvelopeBuf();
for(Geometry g : gs){
ShapeFeature f = createFeature(g);
fc.insert(f);
f.setFeatureClass(fc);
eb.mergeEnvelop(g.getEnvelop());
}
fc.setMetadata( new LayerMetadata("Geometry",gs.get(0).getGeometryType()));
fc.setEnvelope(eb.toEnvelop());
return new VectorLayer(fc);
}