Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Replace request contains only one feature when providing a feature collection #33

Open
ZakUrl opened this issue Nov 10, 2020 · 1 comment

Comments

@ZakUrl
Copy link

ZakUrl commented Nov 10, 2020

The replace request takes only one feature from the given feature collection which is annoying when you want to replace multiple features. I have located the problem in 'index.js at line 143 :

export function Replace(features, params={}) {
  features = ensureArray(features);
  let {filter, inputFormat, srsName} = unpack(
    features[0] || {}, params || {}, 'filter', 'inputFormat', 'srsName'
  );
  let replacements = translateFeatures(
    [features[0]].filter((f)=>f),
    params || {srsName}
  );
  filter = ensureFilter(filter, features, params);
  return wfs('Replace', {inputFormat, srsName}, replacements + filter);
}

To solve the problem I did the following:

export function Replace(features, params={}) {
  features = ensureArray(features);
  let {filter, inputFormat, srsName} = unpack(
    features[0] || {}, params || {}, 'filter', 'inputFormat', 'srsName'
  );
  let replacements = translateFeatures(
    features,
    params || {srsName}
  );
  filter = ensureFilter(filter, features, params);
  return wfs('Replace', {inputFormat, srsName}, replacements + filter);
}

I have replaced the first parameter of translateFeatures by features instead of [features[0]].filter((f)=>f)

@ZakUrl
Copy link
Author

ZakUrl commented Nov 10, 2020

Here is a link to the pull request : #34

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant