Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant