[QGIS-Developer] Paste geometry functionality

Germán Carrillo carrillo.german at gmail.com
Wed Nov 29 18:27:29 PST 2023


Hi Tomas,

  Let's say we have a layer L (PostgreSQL/PostGIS) with features A, B
>
> and C with corresponding attribute values set.
>   Now some external party sends us a shapefile S with an updated
> geometry G which we want to apply to feature B.
>   We want to:
>   1. Select G in layer S and press Ctrl+C
>   2. Select feature B in layer L (layer is in edit mode).
>   3. Do "Paste geometry" which should change geometry of feature B but
> leave all attribute values intact. This must be an update (not
> delete/insert) operation for record B in database table, as database
> would usually have different sequences, triggers with business logic
> etc.
>
>
Do you happen to have a common field in your layers L and S, which
allows you to know that geometry G goes to feature B?
If that's the case, you could apply all geometry updates at once, based on
this common field.

In its current version (v1.5.0), the plugin "Append Features To Layer" can
update features based on common field values (e.g., an ID or a code).
It'd be simple to add a "Only update geometries" option. I've just created
a feature request [1], feel free to join if you'd like to help testing a
dev version.


*Disclaimer: I wrote the plugin :)*

Regards,

Germán
-----------
[1] https://github.com/gacarrillor/AppendFeaturesToLayer/issues/22


El mié, 29 nov 2023 a las 13:52, Keith Jenkins via QGIS-Developer (<
qgis-developer at lists.osgeo.org>) escribió:

> > I am aware of a python plugin for that but it does not work for
> > large geometries as clipboard size limit is reached pretty fast on
> > windows.
>
> Hi, Tomas.
>
> I just tested the "Geometry Paster" plugin and also ran into this
> clipboard size limit.  It looks like the code for the plugin tries to
> avoid this problem:
>
> csv.field_size_limit(sys.maxsize)
>
> But this doesn't seem to have the intended effect.  On my machine,
> sys.maxsize is 9223372036854775807, which appears to be too large for
> setting the csv.field_size_limit.  One workaround would be to open the
> QGIS Python console and set it manually to the maximum longint value:
>
> csv.field_size_limit(2147483647)
>
> It looks like there is already a pull request to fix this in the
> plugin, from just 3 days ago:
> https://github.com/nextgis/qgis_geometry_paster/pull/12/files
>
> Cheers,
> Keith
>
> On Tue, Nov 28, 2023 at 3:37 PM Tomas Straupis via QGIS-Developer
> <qgis-developer at lists.osgeo.org> wrote:
> >
> > Hello
> >
> >   I was wondering, is there any reason why "paste geometry" (for
> > vector features) is not implemented in QGIS? Or is it simply because
> > nobody implemented it (I'm thinking of trying to do that)?
> >
> >   The use case is different government cadastres where geometry is
> > provided by external institutions and institution responsible for
> > maintaining the cadastre is adding the attribute values. While they
> > can use full feature paste (with attributes) for initial record
> > creation, updating requires the possibility to paste geometry only
> > without changing any attribute values.
> >
> >   Thank you
> >
> > P.S. I am aware of a python plugin for that but it does not work for
> > large geometries as clipboard size limit is reached pretty fast on
> > windows.
> >
> > --
> > Tomas
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>


-- 
-----------
   |\__
(:>__)(
   |/
Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
https://twitter.com/GeoTux2 <http://twitter.com/GeoTux2>

<http://gis.stackexchange.com/users/4972/germ%c3%a1n-carrillo>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20231129/98c26351/attachment-0001.htm>


More information about the QGIS-Developer mailing list