for (Layer layer : map.getLayers()) {
// create vector data sources before the map
if (layer.getSource() != null && layer.getSource() instanceof VectorSource) {
VectorSource vectorSource = (VectorSource) layer.getSource();
if (vectorSource.getFeatures() != null) {
for (Feature feature : vectorSource.getFeatures()) {
builder.append("var " + feature.getJsId() + " = new " + feature.getJsType() + "("
+ feature.renderJs() + ");\n");
}
}
}