[Qgis-developer] Auto increment field for shapefiles?

kimaidou kimaidou at gmail.com
Sun May 18 06:35:06 PDT 2014


Hi,

I meant use an integer to store the data, and only "mimic" the serial for
Shapefiles and other formats. Though I did not take into account the
edition of the file by external programs... On (messy) workaround could be
to compare the last row id when openinig the Shapefile for checking if it
has been changed outside QGIS, and if needed compute the max(id) +1 to
recalculate the next serial status. It sounds a bit naïve, but could work..

I also agree Geopackage or Spatialite should be used instead of Shapefiles !


2014-05-17 20:18 GMT+02:00 Alex Mandel <tech_dev at wildintellect.com>:

> On 05/17/2014 07:07 AM, Andrea Peri wrote:
> > The dbf spec has a type serial ?
> >
> > I don't remenber , but not sure of this.
> >
> It does but not in dbf IV which is what shapefiles use (from a little
> online poking) only in later versions like dbf 7.
>
> > If the dbf has not a serial type.
> >
> > This enhance will mena to produce a new kind of shapfile
> > readable only from QGIS.
> >
> > I guess should be avoided to produce incompatible new formats.
> >
> > Andrea.
> >
> I think what's being proposed is that the QGIS project is the only thing
> that tracks that's serial, in the dbf field definition would stay
> Integer. Of course editing the file in another program can easily break it.
>
> I'd rather see effort into making other formats 1st class to help move
> people off of shapefiles. Note ArcGIS does now support Spatialite
> http://blog.geomusings.com/2013/08/07/spatialite-and-arcgis-10-dot-2/
> And we expect Geopackage adoption to follow in the next few years.
>
> Course if this really bugs someone, by all means implement something
> just don't break the compatibility of the files.
>
> -Alex
>
> >
> > 2014-05-17 11:02 GMT+02:00 Paolo Cavallini <cavallini at faunalia.it>:
> >
> >> Il 17/05/2014 00:38, mmekuria ha scritto:
> >>> I am not sure what you mean, Paulo. But there is already the Feature Id
> >>> (Object Id in ArcGIS) in QgsFeature. Do you mean having that a
> mandatory
> >>> field that gets populated every time a feature is created within a
> >>> shapefile?
> >>
> >> Almost: I mean let the user define a field as SERIAL
> >> http://www.postgresql.org/docs/9.3/static/datatype-numeric.html
> >> also for non-database data types (especially shp).
> >> It does not seem too difficult, now that we have a record number
> function
> >> in the
> >> expressions.
> >> All the best.
> >>
> >> --
> >> Paolo Cavallini - www.faunalia.eu
> >> Corsi QGIS e PostGIS: http://www.faunalia.eu/training.html
> >> _______________________________________________
> >> Qgis-developer mailing list
> >> Qgis-developer at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >>
> >
> >
> >
> >
> >
> > _______________________________________________
> > Qgis-developer mailing list
> > Qgis-developer at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20140518/82b18c88/attachment-0001.html>


More information about the Qgis-developer mailing list