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

regression : can't create a feature #16156

Closed
qgib opened this issue Jan 29, 2013 · 7 comments
Closed

regression : can't create a feature #16156

qgib opened this issue Jan 29, 2013 · 7 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Jan 29, 2013

Author Name: Philippe Dorelon (Philippe Dorelon)
Original Redmine Issue: 7072
Affected QGIS version: master
Redmine category:vectors


In master revision (94491b8),
it seems impossible to create a feature with geometry: the new object disappears after its creation.

Thanks all


@qgib
Copy link
Contributor Author

qgib commented Jan 29, 2013

Author Name: Nathan Woodrow (@NathanW2)


We are going to need some more information then that in order to track down the issue. What type of layer are you using?

@qgib
Copy link
Contributor Author

qgib commented Jan 29, 2013

Author Name: Philippe Dorelon (Philippe Dorelon)


In fact, the bug appears when there is a join on the edited layer. I tested it with shape files, spatialite files on points and lines.


  • 5282 was configured as test.zip

@qgib
Copy link
Contributor Author

qgib commented Mar 6, 2013

Author Name: Philippe Dorelon (Philippe Dorelon)


I think the problem is in @qgsvectorlayereditbuffer.cpp : QgsVectorLayerEditBuffer::addFeature@
This lines :

int layerFieldCount = L->dataProvider()->fields().count() + mAddedAttributes.count() - mDeletedAttributeIds.count();
  if ( layerFieldCount != f.attributes().count() )
    return false;
</code>

@f.attributes().count()@ includes @joinfields@, @layerFieldCount@ doesn't.

With something like that, it works:

int layerFieldJoinCount=0;
  for ( int i = 0; i < L->mUpdatedFields.count(); ++i )
  {
      if ( L->mUpdatedFields.fieldOrigin(i)==QgsFields::OriginJoin )
    {
        layerFieldJoinCount++;
    }
  }
  int layerFieldCount = L->dataProvider()->fields().count() + layerFieldJoinCount + mAddedAttributes.count() - mDeletedAttributeIds.count();
</code>

@qgib
Copy link
Contributor Author

qgib commented May 29, 2013

Author Name: Denis Rouzaud (@3nids)


Does it make sense to have all joined fields in the edit form as they won't be used?

@qgib
Copy link
Contributor Author

qgib commented May 29, 2013

Author Name: Denis Rouzaud (@3nids)


Should be fixed by these two requests:
#576
#546

Reply from Minoru:
I think it's right. In 1.8, joined fields are editable. Input values
are displayed in the attribute table, but their values are not saved
when I save the layer as a new file.
My patch[1] does not hide joined fields in new feature form, but it
makes joined fields uneditable. As soon as we create a new feature on
join layer, fields in the joined table are bind to the new feature
corresponding to the value of the target field. I believe that editing
join layer should work well with two patches[1][2].

@qgib
Copy link
Contributor Author

qgib commented Jul 9, 2013

Author Name: Nathan Woodrow (@NathanW2)


What is the status of this?

@qgib
Copy link
Contributor Author

qgib commented Jul 9, 2013

Author Name: Nathan Woodrow (@NathanW2)


Fixed in changeset "aca3dfaf77a227e95c67a5dabbe67887b30a53fe".


  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats) labels May 24, 2019
@qgib qgib added this to the Version 2.0.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Vectors Related to general vector layer handling (not specific data formats)
Projects
None yet
Development

No branches or pull requests

1 participant