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

Added wrapper for OGR_L_SetFeature #264

Merged
merged 2 commits into from Jun 30, 2022

Conversation

geohardtke
Copy link
Contributor

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

Hi, I tried to find a way to update the value of a field in a vector and couldn't find a way to achieve that. Maybe I missed something? If so, sorry. Otherwise here is a pull request that implements a wrapper for OGR_L_SetFeature.

It can be used as follows:

        let ds_options = DatasetOptions {
            open_flags: GdalOpenFlags::GDAL_OF_UPDATE,
            ..DatasetOptions::default()
        };
        let ds = Dataset::open_ex("three_layer_ds.s3db"), ds_options).unwrap();
        let mut layer = ds.layer(0).unwrap();
        let fids: Vec<u64> = layer.features().map(|f| f.fid().unwrap()).collect();
        let feature = layer.feature(fids[0]).unwrap();
        feature.set_field_integer("id", 1).ok();
        layer.set_feature(feature).ok();

@rmanoka
Copy link
Contributor

rmanoka commented Jun 19, 2022

This is a good API addition; thanks and apologies for the delay @geohardtke . Could you pls. fix the conflicts?

Copy link
Contributor

@rmanoka rmanoka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; will merge it in a couple days unless there are more suggestions.

@rmanoka
Copy link
Contributor

rmanoka commented Jun 30, 2022

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 30, 2022

Build succeeded:

@bors bors bot merged commit 674cfe9 into georust:master Jun 30, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants