[Qgis-user] Creating parent feature with geometry from child feature

Nyall Dawson nyall.dawson at gmail.com
Tue Nov 8 22:57:31 PST 2016


On 9 November 2016 at 16:26, Neumann, Andreas <a.neumann at carto.net> wrote:
> Hi Nicolas,
>
> We have similar issues in our projects.
>
> It looks like a bug to me that the default value is called that many times.
>
> Matthias: any comments on that? Or can you explain why this happens and how
> this can be potentially fixed?


It's (probably) fixed with https://github.com/qgis/QGIS/pull/3733, but
testing & confirmation would be good!

Nyall

>
> Greetings,
>
> Andreas
>
> On 2016-11-08 17:50, Nicolas Boisteault wrote:
>
> Logs confirm the issue :
>
> First time form opened :
>
> 2016-11-08 17:45:03 CET [15733-1] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-2] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-3] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-4] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-5] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-6] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-7] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-8] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-9] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-10] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:45:03 CET [15733-11] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
>
> Second time form opened :
>
>
> 2016-11-08 17:47:10 CET [15733-48] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-49] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-50] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-51] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-52] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-53] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-54] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-55] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-56] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-57] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
> 2016-11-08 17:47:10 CET [15733-58] user at carto LOG: statement: SELECT
> nextval('public.station_gid_seq'::regclass)
>
> If someone can confirm this issue I'll open a ticket.
>
>
>
> Le 2016-11-08 17:27, Nicolas Boisteault a écrit :
>
> What is weird is that every time I open the form it increments sequence of
> 11 not 1. So I guess nextval is called 11 times! I'll try to log that. I'm
> using QGIS 2.18.
>
> Le 2016-11-08 16:35, Matthias Kuhn a écrit :
>
> Yes, every time you open a form, a new gid is retrieved (nextval is
> executed) what makes the counter go up very fast.
>
> Another thing that could need some attention (it might have changed with
> https://github.com/qgis/QGIS/pull/3733 but I didn't check in detail).
>
> Matthias
>
> On 11/08/2016 04:19 PM, Nicolas Boisteault wrote:
>
> Matthias,
>
> Thank you for the tip.
>
> It works without transactional editing.
>
> I enabled it to test and I like the fact that observation layer is
> automatically put in editable state when I put station layer as
> editable. It is very convenient for users. I'll modify the foreign
> key constraint and will tell if it works for me.
>
> Now I have an issue which is not related to transactional editing. When
> I create a new station the gid parameter is incremented by +11 not +1.
>
> Can anyone confirm this issue? Thanks.
>
> Le 2016-11-08 14:44, Matthias Kuhn a écrit :
>
> Nicolas,
>
> Sorry I forgot: you will probably also need to enable transactional
> editing and set the foreign key constraint check to deferred to make it
> work properly.
>
> Regards
> Matthias
>
> On 11/08/2016 02:08 PM, Nicolas Boisteault wrote:
>
> This is perfect! Thank you very much Matthias.
>
> Le 2016-11-08 12:45, Matthias Kuhn a écrit :
>
> Go to the project properties and on the data sources tab check "evaluate
> default values on provider side".
>
> Regards
> Matthias
>
> On 11/08/2016 12:37 PM, Nicolas Boisteault wrote:
>
> Hi Matthias Kuhn,
>
> First thank you very much for your help and your work on this feature
> There is room for improvement but this functionality is already great
> as it.
>
> Another question. I also tried to add a station and an observation from
> the station form.
>
> When creating, I have 'nextval('public.station_gid_seq'::regclass)' in
> the gid attribute and in the id_station attribute too which is good
> to me.
>
> Now if i save the observation feature first it won't work because the
> station feature it refers doesn't exist. It is logical to me.
>
> But if save the new station feature, it only save this feature and not
> the relative observation with the newly foreign created.
>
> Is it a bug or a limitation? Thanks.
>
> Le 2016-11-08 12:09, Matthias Kuhn a écrit :
>
> Hi Nicolas,
>
> This is a limitation of the current implementation.
>
> You can either add a new station without geometry first and then
> select
> it in the attribute table and use the add part tool to add a geometry.
>
> Or add it from its own layer and then link it to the parent
> observation.
>
> I agree there is room for improvement.
>
> Regards
> Matthias
>
> On 11/08/2016 11:49 AM, Nicolas Boisteault wrote:
>
>
>
> Hi List,
>
> I have two tables :
>
>   * station : gid, geom (point)
>   * observation : id, id_station (foreign key)
>
> There is a 1:N relation; for one station feature there are multiple
> observation features.
>
> I add the relation between my two tables in QGIS -> project
> properties.
> I use the relation reference widget on id_station and check 'able the
> add of new entities' (not sure about my english translation)
>
> So now when I create a new observation I can click the plus symbol to
> add a station but I can't see how I can create the point
> geometry. I'm
> not able to click the map.
>
> Any hint? Thank you all.
>
> --
>
> Nicolas BOISTEAULT
>
>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
> <mailto:Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>>
> <mailto:Qgis-user at lists.osgeo.org
> <mailto:Qgis-user at lists.osgeo.org>
> <mailto:Qgis-user at lists.osgeo.org
> <mailto:Qgis-user at lists.osgeo.org>>>
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
> <mailto:Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>>
> <mailto:Qgis-user at lists.osgeo.org
> <mailto:Qgis-user at lists.osgeo.org>
> <mailto:Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>>>
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user



More information about the Qgis-user mailing list