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

Matthias Kuhn matthias at opengis.ch
Tue Nov 8 07:35:01 PST 2016


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



More information about the Qgis-user mailing list