[Qgis-developer] $id not working as default value
Tim Sutton
tim at kartoza.com
Tue Dec 27 10:55:27 PST 2016
Hi
> On 27 Dec 2016, at 9:40 AM, Neumann, Andreas <a.neumann at carto.net> wrote:
>
> Hi Nyall,
>
> Thanks for clarifying.
>
> This needs to be properly documented and taught in QGIS courses.
>
>
I wonder if it is not worth floating the idea of layer annotations - something like GDAL does with it's aux.xml files that we can store stuff like this in. It is a shame to open a layer in one project where you have serial counters implemented, and then have to redo it in another project (and remember to do it). I know it would only work for file based (or maybe QGIS Layer Files too?) datasets but I recon that would cover most use cases since the 'proper' databases already have mechanisms to deal with this. Along with that we could have the layer creation dialog include a serial field type which would set up the constraints and annotate them in the layer annotation file.
Just a thought anyway...
Regards
Tim
> Andreas
>
> On 2016-12-27 02:03, Nyall Dawson wrote:
>
>> On 23 December 2016 at 23:37, Paolo Cavallini <cavallini at faunalia.it <mailto:cavallini at faunalia.it>> wrote:
>>>
>>> Il 23/12/2016 14:32, Giovanni Manghi ha scritto:
>>>
>>>> The solution from the Gitter discussion
>>>>
>>>> aggregate( 'layername','max',"id")+1
>>>
>>> thanks Giovanni
>>>
>>>> We need of course a more user friendly way to allow users have
>>>> incremental/serial ids in their shapefiles...
>>>
>>> sure, e.g. a named preset expression, as previously suggested.
>>> all the best.
>>
>> In master you can add UNIQUE and NOT NULL constraints to the field
>> from within QGIS. This will cause QGIS to automatically populate it
>> with a serial type value whenever a new feature is created.
>>
>> Nyall
>>
>>
>>> --
>>> Paolo Cavallini - www.faunalia.eu <http://www.faunalia.eu/>
>>> QGIS & PostGIS courses: http://www.faunalia.eu/training.html <http://www.faunalia.eu/training.html>
>>> https://www.google.com/trends/explore?date=all&geo=IT&q=qgis,arcgis <https://www.google.com/trends/explore?date=all&geo=IT&q=qgis,arcgis>
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
>>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer <http://lists.osgeo.org/mailman/listinfo/qgis-developer>_______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org <mailto:Qgis-developer at lists.osgeo.org>
>> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
>> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer <http://lists.osgeo.org/mailman/listinfo/qgis-developer>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
—
Tim Sutton
Co-founder: Kartoza
Project chair: QGIS.org
Visit http://kartoza.com <http://kartoza.com/> to find out about open source:
Desktop GIS programming services
Geospatial web development
GIS Training
Consulting Services
Skype: timlinux
IRC: timlinux on #qgis at freenode.net
Kartoza is a merger between Linfiniti and Afrispatial
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20161227/1838382a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: KartozaNewLogoThumbnail.jpg
Type: image/jpeg
Size: 6122 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20161227/1838382a/attachment-0001.jpg>
More information about the Qgis-developer
mailing list