Re: [Qgis-user] Rename column

2021-06-01 Thread Richard McDonnell
In relation to editing Tables, reordering, remaning etc.. can be carried out 
using Refactor fields, which can be found in the Processing Toolbox
Regards,

Richard.




——
Richard McDonnell MSc GIS, FME Certified Professional
FRM Data Management

——
Oifig na nOibreacha Poiblí
Office of Public Works

Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36
Jonathan Swift Street, Trim, Co Meath, C15 NX36
——
M +353 87 688 5964 T +353 46 942 2409
https://gov.ie/opw

——
To send me files larger than 30MB, please use the link below 
https://filetransfer.opw.ie/filedrop/richard.mcdonn...@opw.ie

Email Disclaimer: 
https://www.gov.ie/en/organisation-information/439daf-email-disclaimer/

——
MSc GIS, FME Certified Professional

——
Oifig na nOibreacha Poiblí
Office of Public Works

Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36
Jonathan Swift Street, Trim, Co Meath, C15 NX36
——
M +353 87 688 5964 T +353 46 942 2409
https://www.opw.ie

——
Email Disclaimer: https://www.opw.ie/en/disclaimer/
From: Qgis-user  On Behalf Of Tudorache, 
Marian
Sent: 01 June 2021 15:27
To: Ursula Heinze ; Qgis-user@lists.osgeo.org
Subject: Re: [Qgis-user] Rename column

There should be a method renameAttribute as part of QgsVectorLayer class.

You can do something like that:

layer = iface.activeLayer()
for field in layer.pendingFields():
if field.name() == 'old':
with edit(layer):
idx = layer.fieldNameIndex(field.name())
layer.renameAttribute(idx, 'new')

Good luck!
Marian

From: Qgis-user 
mailto:qgis-user-boun...@lists.osgeo.org>> 
On Behalf Of Ursula Heinze
Sent: June 1, 2021 5:26 AM
To: Qgis-user@lists.osgeo.org<mailto:Qgis-user@lists.osgeo.org>
Subject: [EXT] [Qgis-user] Rename column

CAUTION: This email originated from outside of the organization. If you do not 
recognize the sender or you are not certain the content is safe, then do not 
click on any links or open any attachments.
AVERTISSEMENT : Ce courriel provient d’une source externe à l’organisation. Si 
vous ne reconnaissez pas l’expéditeur ou si vous doutez de la sécurité du 
contenu, ne cliquez sur aucun lien et n’ouvrez aucune pièce jointe.

Hello,
I have a little problem with the field calculator. I want to rename a column, 
and I don´t find any way to do it.
Now I tried to copy the field values in a new column with the right name, and 
am also not successful. Has anybody an idea for me, how to solve the problem? 
Many thanks in advance!
Ursula Heinze

Gesendet von 
Mail<https://urldefense.com/v3/__https:/go.microsoft.com/fwlink/?LinkId=550986__;!!P0kg3YazkQ!W94jRKLCVMrbhztEtw9jiDUPiECzoEscG5JxdIsa3_vpvGZuh4v0QGxdDJLtJD0Tmg$>
 für Windows 10




This electronic message, as well as any transmitted files included in the 
electronic message, may contain privileged or confidential information and is 
intended solely for the use of the individual(s) or entity to which it is 
addressed. If you have received this electronic message in error please notify 
the sender immediately and delete the electronic message. Any unauthorized 
copying, disclosure or distribution of the electronic message is strictly 
forbidden. NAV CANADA accepts no liability for any damage caused by any virus 
and/or other malicious code transmitted by this electronic communication.

Le présent message électronique et tout fichier qui peut y être joint peuvent 
contenir des renseignements privilégiés ou confidentiels destinés à l’usage 
exclusif des personnes ou des organismes à qui ils s’adressent. Si vous avez 
reçu ce message électronique par erreur, veuillez en informer l’expéditeur 
immédiatement et supprimez le. Toute reproduction, divulgation ou distribution 
du présent message électronique est strictement interdite. NAV CANADA n’assume 
aucune responsabilité en cas de dommage causé par tout virus ou autre programme 
malveillant transmis par ce message électronique.

Please note that the existing 01-6476XXX / 046-9426XXX numbering ranges will no 
longer be available after 30th April 2021.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Rename column

2021-06-01 Thread Tudorache, Marian
There should be a method renameAttribute as part of QgsVectorLayer class.

You can do something like that:

layer = iface.activeLayer()
for field in layer.pendingFields():
if field.name() == 'old':
with edit(layer):
idx = layer.fieldNameIndex(field.name())
layer.renameAttribute(idx, 'new')

Good luck!
Marian

From: Qgis-user  On Behalf Of Ursula Heinze
Sent: June 1, 2021 5:26 AM
To: Qgis-user@lists.osgeo.org
Subject: [EXT] [Qgis-user] Rename column

CAUTION: This email originated from outside of the organization. If you do not 
recognize the sender or you are not certain the content is safe, then do not 
click on any links or open any attachments.
AVERTISSEMENT : Ce courriel provient d’une source externe à l’organisation. Si 
vous ne reconnaissez pas l’expéditeur ou si vous doutez de la sécurité du 
contenu, ne cliquez sur aucun lien et n’ouvrez aucune pièce jointe.

Hello,
I have a little problem with the field calculator. I want to rename a column, 
and I don´t find any way to do it.
Now I tried to copy the field values in a new column with the right name, and 
am also not successful. Has anybody an idea for me, how to solve the problem? 
Many thanks in advance!
Ursula Heinze

Gesendet von 
Mail<https://urldefense.com/v3/__https:/go.microsoft.com/fwlink/?LinkId=550986__;!!P0kg3YazkQ!W94jRKLCVMrbhztEtw9jiDUPiECzoEscG5JxdIsa3_vpvGZuh4v0QGxdDJLtJD0Tmg$>
 für Windows 10




This electronic message, as well as any transmitted files included in the 
electronic message, may contain privileged or confidential information and is 
intended solely for the use of the individual(s) or entity to which it is 
addressed. If you have received this electronic message in error please notify 
the sender immediately and delete the electronic message. Any unauthorized 
copying, disclosure or distribution of the electronic message is strictly 
forbidden. NAV CANADA accepts no liability for any damage caused by any virus 
and/or other malicious code transmitted by this electronic communication.

Le présent message électronique et tout fichier qui peut y être joint peuvent 
contenir des renseignements privilégiés ou confidentiels destinés à l’usage 
exclusif des personnes ou des organismes à qui ils s’adressent. Si vous avez 
reçu ce message électronique par erreur, veuillez en informer l’expéditeur 
immédiatement et supprimez le. Toute reproduction, divulgation ou distribution 
du présent message électronique est strictement interdite. NAV CANADA n’assume 
aucune responsabilité en cas de dommage causé par tout virus ou autre programme 
malveillant transmis par ce message électronique.
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Rename column

2021-06-01 Thread Ujaval Gandhi
You can also use the 'Refactor Fields' algorithm from the Processing
Toolbox - which can not only rename the fields but also change the order
and types as well.
[image: Logo] 
Ujaval Gandhi
Spatial Thoughts
mobile: +91-8095684687
email: uja...@spatialthoughts.com
[image: LinkedIn icon]   [image:
Twitter icon] 



On Tue, Jun 1, 2021 at 3:35 PM Matt Boyd  wrote:

> You can rename columns (or fields) in the layer properties (need to
> have editting turned on)
> In the field calculator, sometimes I have issues with the data type
> and "fieldname" doesn't work so well but if I do "1*fieldname" it
> does.
>
>
>
> On Tue, Jun 1, 2021 at 7:31 PM Ursula Heinze 
> wrote:
> >
> > Hello,
> >
> > I have a little problem with the field calculator. I want to rename a
> column, and I don´t find any way to do it.
> >
> > Now I tried to copy the field values in a new column with the right
> name, and am also not successful. Has anybody an idea for me, how to solve
> the problem? Many thanks in advance!
> >
> > Ursula Heinze
> >
> >
> >
> > Gesendet von Mail für Windows 10
> >
> >
> >
> > ___
> > Qgis-user mailing list
> > Qgis-user@lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] Rename column

2021-06-01 Thread Matt Boyd
You can rename columns (or fields) in the layer properties (need to
have editting turned on)
In the field calculator, sometimes I have issues with the data type
and "fieldname" doesn't work so well but if I do "1*fieldname" it
does.



On Tue, Jun 1, 2021 at 7:31 PM Ursula Heinze  wrote:
>
> Hello,
>
> I have a little problem with the field calculator. I want to rename a column, 
> and I don´t find any way to do it.
>
> Now I tried to copy the field values in a new column with the right name, and 
> am also not successful. Has anybody an idea for me, how to solve the problem? 
> Many thanks in advance!
>
> Ursula Heinze
>
>
>
> Gesendet von Mail für Windows 10
>
>
>
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


[Qgis-user] Rename column

2021-06-01 Thread Ursula Heinze
Hello,
I have a little problem with the field calculator. I want to rename a column, 
and I don´t find any way to do it. 
Now I tried to copy the field values in a new column with the right name, and 
am also not successful. Has anybody an idea for me, how to solve the problem? 
Many thanks in advance!
Ursula Heinze

Gesendet von Mail für Windows 10

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user