Questions tagged [string]

A sequence of characters.

Filter by
Sorted by
Tagged with
1 vote
0 answers
485 views

PyQGIS 'str' object has no attribute 'fields' [closed]

I'm trying to write my first Python script from template in QGIS. I want to delete all fields except specific ones. Therefore I create a list to fill it with all the field names except the specific ...
kj0176's user avatar
  • 11
0 votes
0 answers
83 views

How to input a string (or any type) value to a field for multiple feature layers at once

I work in ArcMap 10.8.1. I added fields to all of my feature layers using Batch Add Field tool. Now I'm trying to find a way to enter values into those fields. Values are identical for each field. My ...
M. Tomas's user avatar
  • 173
1 vote
2 answers
49 views

Changing strings with no decimals to have .0 at the end

I have a points layer with a "Name" column. The "Name" values are strings and similar to 'X501', 'X501.1', and 'X501.2'. I need to change any values like 'X501' to 'X501.0' and ...
Bacon_Sammich's user avatar
0 votes
1 answer
632 views

What VBScript can I use to populate a field with text using the ArcGIS field calculator?

I need to populate one field in the attribute table of a File Geodatabase with text. Every entry in the field is set to a Null value and text entry isn't conditional upon any other factor. Every entry ...
Tye's user avatar
  • 103
1 vote
1 answer
39 views

How to use ArcMap python to parse int from a (part of a) string?

I'm using the ArcMap Field Calculator to parse the year from a field GLVertra_1 with values like this: 1992/05/13 or more generally YYYY/MM/DD, but also containing empty cells (or cells appearing ...
Honeybear's user avatar
  • 1,744
7 votes
4 answers
1k views

Inserting additional text into string field with the Field Calculator in QGIS

In QGIS 3.18.3, I have a GeoPackage attribute table containing a string field that I will call "FIELD_1". All records within "FIELD_1" take the form of a_a_a_a_a, where a = ...
Stu Smith's user avatar
  • 7,649
1 vote
2 answers
741 views

TerraClimate: Error generating chart: Data column(s) for axis #0 cannot be of type string

I am using "TerraClimate: Monthly Climate and Climatic Water Balance for Global Terrestrial Surfaces, University of Idaho" dataset... When I try my code, I have this error message Error ...
Maria Castellaneta's user avatar
3 votes
1 answer
839 views

FME: how to replace a character at a specific index?

Suppose I've a string foo, How can I change the 3rd character (identified by its index) ? The Ruby equivalent would be # Define the variable string and assign the value 'bar' string = 'foo' #=&...
Sumak's user avatar
  • 133
0 votes
1 answer
95 views

Bounding Areas using Feature Collection values (RESOLVE Ecoregions 2017)

I'm pretty new to the Earth Engine and have been working through some of the tutorials to familiarize myself with it. I have very little code experience. What I am trying to accomplish is creating a ...
Carey Johnston's user avatar
2 votes
1 answer
241 views

Changing number of decimal places of a String variable within a Vector Layer using PyQGIS

I have earthquake data and within the data, there are magnitude, longitude and latitude values. However, these values have around 6/7 decimal places but I would like to only have 2 decimal places for ...
LiamHems's user avatar
  • 193
8 votes
2 answers
625 views

What is the maximum number of characters for a label in QGIS 3?

I am trying to determine the maximum number of characters for a label in QGIS 3. I am at over 1,000 characters and it does not display. Is there another way to display text on a map with a large ...
bdelliott's user avatar
  • 415
7 votes
2 answers
1k views

Deleting any characters after certain character in QGIS label expression

I have a shapefile with attribute values like this: C834 K9 L523;L553 W2,T48 I want to display only the characters before certain characters, for example ; and , : C834 K9 L523 W2 How to achieve ...
POGO's user avatar
  • 286
5 votes
1 answer
654 views

How to use label maximum line length for word wrapping in QGIS 3

I am confused on how to use the maximum line length for word wrapping a label in QGIS 3. The dialog and documentation show an option to "Wrap lines to" and then allow selecting "Maximum ...
bdelliott's user avatar
  • 415
3 votes
2 answers
2k views

Cannot convert '#value!" to double

I am trying to convert a string to a numerical format by creating a new field. I get an error message saying "Cannot convert '#VALUE!' to double." What does this mean?
DanG's user avatar
  • 617
2 votes
2 answers
871 views

QGIS: Comparing attribute values from different layers with Expression string builder

I want to compare attribute values from different attributes from multiple layers in the Expression string builder in QGIS (3.16.1) in of these layers, but I don't know how to do that. I've tried out ...
Pedda's user avatar
  • 23
7 votes
1 answer
184 views

Convert a list to string in QGIS

I have edited a field into the attribute form of a QGIS project as a "Value Relation" to create a checkbox where I can choose few possibilities. I have a tree sickness and the field I am ...
Serggg182's user avatar
  • 621
2 votes
1 answer
173 views

Selecting features by characters contained in a text string

Is there a way to select the features of a map by finding text within an attribute table? For example, if several features are listed as "Nature preserve" under a column called "...
jserv's user avatar
  • 195
3 votes
2 answers
2k views

Converting PyQt5.QtCore.QVariant to string

I am using QGIS with the in-built Python console. I want to replace some values in a shapefile with some other values. But when I try to change the attribute values, I get an error about the data ...
Zoe's user avatar
  • 445
3 votes
1 answer
224 views

Selecting in expression features with line break

I'm trying to filter features in a QGIS layer to those with the following in their "description" attribute. <td>CC_W</td> <td>3</td> I think what I need is ...
Kenji Yamada's user avatar
5 votes
2 answers
400 views

Splitting string into "alphabetic" or "numeric" in QGIS 3.10.1

What are the right functions and formulas with the field calculator to delete "alphabet" or "number" inside a field? Let me be clear. I want to be able to delete "alphabetic ...
Yems's user avatar
  • 51
2 votes
1 answer
844 views

Creating new column based on parts of strings in another column in QGIS

I have a column with zoning names (with "subzones" like UV036, UMTs2 etc.) and would like to create a new column with the general zone instead (UV instead of UV036, UMT instead of UMTs2... ...
Philippe Morgan's user avatar
2 votes
1 answer
24 views

Problem in storing splitted strings in attribute table

I want to split strings of column 'Text' and save them in column 'Text_edit'. So far the split and storing the new values in a new column works. However as can be seen in the attached figure, only the ...
Tobias's user avatar
  • 157
2 votes
1 answer
267 views

Concatenating part of string and sorting it using QGIS

I'd like to know how to concatenate part of a string and sort it. For example, i have a FIELD1 (string) and i should have the numbers of the string separated with ';' in the FIELD2. Only the numbers ...
Mark's user avatar
  • 869
3 votes
1 answer
247 views

QGIS: Turning a string into "relative" hyperlink

I have a few columns in my shapefile that to refer to certain folders and files (PDF, JPG etc.). Because these are interesting in a form for each object, so that people can open them. I want to make a ...
ThunderSpark's user avatar
7 votes
2 answers
463 views

Removing two letters only if they appear at end of a field in QGIS labels

I am trying to remove the letters 'a' and 'o' only if they appear at the end of the field 'name' while labeling. For example, I'm working with names like: Ontario, Manitoba, Alberta, Quebec, Nova ...
Jason's user avatar
  • 73
0 votes
1 answer
222 views

How do you add user variables to custom Python functions in QGIS Function Editor?

How do you add user input variables to a Custom Function created in Python in QGIS3.x. I found the below piece of code but need to modify it to control the string to split by and the index value to ...
MrKingsley's user avatar
  • 1,423
4 votes
2 answers
728 views

Count number of times matching string appears in another column (similar to Excel COUNTIF)

Which function can I use to count the number of times a string for a row in column "LeaseName" matches another row's string for "LeaseName"? For example, Row 1 is 'HADLEY #9' and I want to know the ...
Adam C's user avatar
  • 43
2 votes
2 answers
2k views

How to get current date "YYYY-MM-DD" in string format in GEE script

I tried to get current "YYYY-MM-DD" in Google Earth Engine script. I succeeded to get current "YYYY-MM-DD" in "Date" format in GEE script. But I want to convert it to String format for setting as a ...
NM-65's user avatar
  • 21
1 vote
1 answer
151 views

Dissolve ArcGIS Pro Python doesn't take string variable for field list

I try to dissolve layer having multiple fields statistics calculated. I prepared a string variable which has all the information in it. When I paste printed variable into dissolve it works. However I'...
Anna's user avatar
  • 13
2 votes
1 answer
214 views

Proj string issue

Could anyone explain why the target in this proj string is not correct? $ projinfo -s EPSG:4326 -t '+proj=gnom +lat_0=61.39107201212929 +lon_0=-58.56360634793518' -o PROJ target CRS string is not ...
Brendan's user avatar
  • 83
5 votes
2 answers
862 views

Find lower/upper case letters in QGIS

Is there a possibility to find lower and/or upper case letters in QGIS? I know that it is possible to convert all lower to upper: upper('hello WOrld') → 'HELLO WORLD' and all upper case to lower: ...
MartinMap's user avatar
  • 8,137
3 votes
5 answers
475 views

Extracting digits from string in QGIS

I have a string field that I want to extract only the digits example: 1,500 m2 -> 1500 I've tried with regexp_substr("location", '(\\d*)') to remove all after the blank space, but I need ...
Juan Millan's user avatar
2 votes
3 answers
507 views

Rasterize: burning string values into raster (string to real) (QGIS)

I have to rasterize a polygon layer. Unfortunately the values of the field I have to burn into the raster has a variety of string entry's like "L239x" or "a403" (case sensitive!). RAT (Raster ...
MartinMap's user avatar
  • 8,137
13 votes
4 answers
2k views

Counting the occurrence of a specific letter within a string (QGIS)?

I have a field which contains a series of words separated by commas. I am wondering if it is possible to count the number of times the letter 'G' occurs. Alternatively it might be possible to split ...
Sablepoot's user avatar
  • 133
2 votes
1 answer
64 views

ArcPy .replace Field Calculator - replace only standalone 0's with 111, not all instances of 0

I've searched on google intensively, must be missing something here: I only want to replace (in a string field) standalone zeros (len is 1 character), but the .replace function replaces all instances ...
Alston Hicks's user avatar
2 votes
0 answers
151 views

Complex parametrized string to export gpkg in Python [closed]

I'm trying to write a Python script that does a process (in this case a buffer) iteratively. The input layer is always the same but, in each iteration, the name of the output file must change and It ...
César Arquero's user avatar
1 vote
1 answer
33 views

Why does Arcpy CalculateField alter string being written to string field?

I have a "Model_Version" field in my feature class that is being used for record keeping. I do not intend to ever do any numeric operations with it, so I am storing it as a string field. Right now ...
Jeff's user avatar
  • 33
0 votes
0 answers
697 views

ValueError: could not convert string to float: 'x_degree'

I want to create a decimal degree (dd) field from degree minute seconds (DMS) as a script tool. The CSV looks like this. My code looks like this: import arcpy inTable = arcpy.GetParameterAsText(...
Jessica's user avatar
  • 17
0 votes
1 answer
475 views

Adding spaces in string using Python parser of ArcMap field calculator

I am using ArcGIS Desktop 10.6. I have a integer field [no_lot] which contains values in the following format: '3 546 777' I need to transfer the data into a text field for joining purposes. I ...
GEB's user avatar
  • 23
0 votes
0 answers
291 views

Using gdal_translate with a high number of gcp

I've a CSV file witch describes the coordinates of each pixels in a image, it is structured like this: xcoord,ycoord,row,col 716657.6518375501,4784215.095395751,0,0 716657.6915582813,4784215....
Giulio's user avatar
  • 131
0 votes
1 answer
225 views

Slicing all values in field using arcpy.da.UpdateCursor

I have a folder with a (3) shapefiles. Each shp. has a field titled "country" with a country name. I've already set my desired workspace correctly and everything else in my script works for what I ...
Connor Garrett's user avatar
3 votes
0 answers
161 views

QGIS3 python: right(QTextStream) - getting unexpected type ' str'

I have a field type double that I need to reduce from 9 digits to 8 ie 123456789 -> 23456789. If I do it as an integer I loose leading zeros ie 10002345 -> 2345. I am attempting to use refactor fields ...
BrendanP's user avatar
3 votes
2 answers
293 views

Omitting certain style string labels in QGIS 3 rule-based labeling

I’m labeling airport taxiways. The taxiway labels are all strings but they tend to be one of three varieties and I would only like to show one of those. I’ve been trying to mess around with Rule-Based ...
Sarah's user avatar
  • 31
5 votes
1 answer
148 views

Evaluate string in field calculator QGIS

Is there any way to evaluate a string as an expression in QGIS. For example, I want to evaluate the string in Column 'hukg' as an expression.
user1650538's user avatar
0 votes
3 answers
1k views

Concatenating list of strings using ArcPy?

My code from Returning strings showing all vertices from all polygons in shapefile using ArcPy? creates is the following: import arcpy fc=r'D:\GIS Data\TOOLS\EV calc in Python\Data.gdb\PolyWGS842' ...
Giacomo's user avatar
  • 307
2 votes
1 answer
284 views

Returning strings showing all vertices from all polygons in shapefile using ArcPy?

I want to have a string showing all vertices from all polygons in a shapefile. In my example below my code lists all vertices and the first column shows the polygon they are part of (I only have 2 in ...
Giacomo's user avatar
  • 307
0 votes
1 answer
11k views

Python3 Replace "/" With "\" [closed]

I want to import several spatial csv files (points) into QGIS. The path to the folder, where the csv files are located is stored in the variable "Folder_Path". The file names are stored in a list. It ...
GISme's user avatar
  • 411
2 votes
0 answers
111 views

Receiving strange characters from GPS tracker, is this HEX or binary?

I am struggling with a GSM GPS tracker. It looks like a clone of GT02A, and it is a relatively common model. My problem is that when it sends data to my server, it is not readable. I set it to send ...
adrianTNT's user avatar
  • 141
2 votes
0 answers
410 views

Conversion to_string provides NULL in QGIS

I've been trying to convert a decimal row into a string row using a few methods. Below is my CSV file: also, note that csv header has been updated too, State;AverageRainfall;ProbabilityBelow;...
BPDESILVA's user avatar
  • 151
2 votes
1 answer
165 views

Inserting string without ' ' in QGIS modeler?

QGIS 3.4.7 I have a lot of Models where there are some string inputs. In all of them, I have to enter the string between quotation marks ''. I understand the meaning and pourpose of them in any ...
Herbert Santos's user avatar