2

If I clone a feature from a Vector Layer A and I add it to another Layer B, I assume this happens only in client side and it doesn't really affect my B Layer on server at all, am I right?

# Note: Syntax is CoffeeScript

clone = featureFromA.clone()

# This returns the Source of a layer by its name
layerBSource = @app.getMapLayerSource('LayerB')

layerBSource.addFeature(clone)

I guess this is a really stupid question, but I didn't find any information on the API Docs about this.

1

Yes, you are just adding the feature at client side. To store the source you need to use an appropriate write function for your desired ol.format.

E.g.

  • ol.format.GeoJSON.writeFeaturesObject(features, opt_options) (API)
  • ol.format.WFS.writeTransaction(inserts, updates, deletes, options) (API)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.