.getFeatureFactory(null);
public SimpleFeature toFeature(Entity entity, Geometry geom) {
SimpleFeatureType ft = entity instanceof Node ? OSMUtils.nodeType() : OSMUtils.wayType();
SimpleFeatureBuilder builder = new SimpleFeatureBuilder(ft, FEATURE_FACTORY);
builder.set("visible", Boolean.TRUE); // TODO: Check this!
builder.set("version", Integer.valueOf(entity.getVersion()));
builder.set("timestamp", Long.valueOf(entity.getTimestamp().getTime()));
builder.set("changeset", Long.valueOf(entity.getChangesetId()));
String tags = OSMUtils.buildTagsString(entity.getTags());
builder.set("tags", tags);
String user = entity.getUser().getName() + ":" + Integer.toString(entity.getUser().getId());
builder.set("user", user);
if (entity instanceof Node) {
builder.set("location", geom);
} else if (entity instanceof Way) {
builder.set("way", geom);
String nodes = buildNodesString(((Way) entity).getWayNodes());
builder.set("nodes", nodes);
} else {
throw new IllegalArgumentException();
}
String fid = String.valueOf(entity.getId());
SimpleFeature simpleFeature = builder.buildFeature(fid);
return simpleFeature;
}