Questions tagged [syntax]

the structure of statements in a computer language.

Filter by
Sorted by
Tagged with
2
votes
1answer
39 views

Query land use (Raster calculator)

I have a land use raster file and am trying to use the raster calculator to query the file for surface water. The saga formula (11 = surface water band): (a, 11) This does not work. Can anyone ...
7
votes
3answers
952 views

Difference between quotation marks ('single' vs “double”) in QGIS

I am not a new QGIS user, however, I am still confused concerning the quotation marks syntax ('single' vs "double"). I know something about the quotation marks and the way they are applied in Python ...
1
vote
1answer
35 views

Syntax for if clause with an inline variable in modelbuilder

In the "Calculate Value" tool I am trying to slice the inline variable (%Name%) with another variable (A) that will be a result of the length of the %Name% variable. For example if %Name% = 11 then I ...
0
votes
1answer
31 views

Calculate conditional in line feature using an expression

I'm trying to calculate a conditional in a line feature but I can't see were my sintax is wrong. Could you guys help me? def Reclass(TIPO_PAV): if TIPO_PAV=='TERRA': return !shape.length@...
4
votes
2answers
143 views

How do I convert a string into a column number in QGIS Expression Builder?

I want to highlight parts of a map based on the page number in an atlas. Ideally I'd use the expression builder in the layer style menu to set the Column to equal the atlas page number. My expression ...
3
votes
1answer
72 views

Select By attribute - top 100 values for each district

I am trying to determine the highest 100 values for each district in a shapefile. I have 27 unique districts and 62834 records, but not sure how to proceed. I could "split by attribute" based on the ...
0
votes
1answer
54 views

ArcGIS Pro Script Tool Syntax Error

I'm trying to learn how to create Script Tools in ArcGIS Pro, so I thought I would start small with a tutorial on https://www.e-education.psu.edu/geog485/node/120 The tutorial has you make a simple ...
4
votes
2answers
363 views

QGIS stopEditing function in python

I am trying to stop the edits using the python console of the QGIS and the code QgsTrackedVectorLayerTools.stopEditing(layer,False) where layer is the layer in the edit mode. I am receiving the ...
1
vote
1answer
57 views

If Statement Satisfied but not Entering?

I have some code that seems to behave as expected and occasionally satisfies an if loop I've created but the code never seems to enter the loop. Even where the if statement is satisfied. The 'Warning'...
0
votes
0answers
80 views

Python script from Python Toolbox do not work and show no error

I have a Python ToolBox with two Custom Python Scripts. The first one works well, but when I try to run the second, there is no errors, but the operation do not run. import arcpy class Toolbox(...
4
votes
3answers
214 views

QGIS query/syntax for overlapping features

I have a dataset (buildings, polygons) that has some overlapping features. Some buildings are old and already demolished but are still in the dataset. I want to hide all these. These have properties ...
1
vote
0answers
109 views

Merge Symmetrical Difference and Intersection Line

I tried to merge these two types of lines I have from using the geometric tools "Intersection & Symmetrical difference". They end up being part of the same line and I want to join them together ...
2
votes
0answers
99 views

Zoom to Postcode QGIS Plugin error: “”

When trying to use the ZoomToPostcode plugin in QGIS 2.16.2 Nødebo, after inputting a postcode to jump to I am prompted to download updated postcode files. Clicking Yes generates a "Unable to download ...
2
votes
2answers
4k views

PostGIS: Update table with st_geometryfromtext [duplicate]

I'm trying to update a column wkb_geometry in a table locations by creating a point from the eastings and northings cols from the same table. The database is PostGreSQL with PostGIS extension: UPDATE ...
3
votes
2answers
209 views

ogr2ogr sql - how to call file from a variable set in a loop in windows batch

I have a command ogr2ogr -f sqlite -dsco SPATIALITE=YES " !outfile!.sqlite !infile1! -nln !outfile! -dialect sqlite -sql "SELECT ST_Intersection(A.geometry, B.geometry) AS geometry, A.name, B.name ...
1
vote
0answers
95 views

Calculation appropriate angular step depth in depthmapX

I am a new depthmapX user in which trying to calculate segment step depth from specific segment to store cumulative angles for each segment. Is there anyone who can provide advice to implement it? ...
2
votes
2answers
1k views

Copying some entries from one column to another with QGIS field calculator? [closed]

I have some rows in the AttributeTable where I want to copy some entries from one column to another. I thought that the best way to do this was in the field calculator and use a CASE WHEN expression ...
2
votes
2answers
1k views

Checking if optional parameter/field has been used or not in ArcPy?

I have 6 arcpy.GetParameterAsText The first one is a feature class and the remaining 5 are fields (some being optional). I plan to use an if statement to check if any fields have been selected for ...
2
votes
1answer
768 views

Arcpy.Intersect_analysis problem

I am very new to Python, after using ArcGIS for a few years (Toolbox only). I thought I'd get stuck in and try and pick it up as I went along, but I've come to a stumbling block with ...
1
vote
2answers
196 views

SelectLayerByAttribute() got an unexpected keyword argument

I am trying to update a field with a new value as I updated a Domain for a web purpose. I am new to this. I want be able to choose the layer and then the field to update M=Municipal S=State C=...
0
votes
1answer
94 views

Error in Raster Calculator when copying syntax typed in text editor

I have a very long operation string using conditionals and simple operations. However, I get an error when copying the syntax to Raster Calculator, apparently the commands are not recognized when ...
-1
votes
1answer
57 views

python script sytax error [closed]

I keep getting this syntax error and don't know why. Brand new to python. # Opens a feature class from a geodatabase and prints the spatial reference   import arcpy   featureClass = "C:/Users/Travis ...
2
votes
1answer
111 views

QGIS Marker Expressions

I am working on writing basic expressions to control the Marker Properties. My previous question on the syntax for color was graciously answered , but I soon realized that I need to know the syntax ...
0
votes
1answer
619 views

Writing expression for field calculator in Python?

I have a script where I calculate a couple of variables, add a new field then need to do a field calculation that field. Once I get everything set up, it's the expression that I have a hard time ...
2
votes
1answer
6k views

How can I make buffer with ST_Buffer in PostGIS

I am trying to make a buffer(0) as a fix-geometry process in PostGIS 2.2.2. It like this: SELECT ST_Buffer(ST_GeomFromText('POINT(100 90)'),0,4); I am using sources from this man-page. It ...
1
vote
1answer
107 views

Assign row object as field name in ArcGIS

Is there a specific way to assign the object that for example row[0] returns in a SearchCursor to a new field name? I mean how to write it in add field syntax, this doesn't work: arcpy....
2
votes
1answer
417 views

SyntaxError with custom function using QgsFeatureRequest.setFilterExpression

def get_subsel(layer,filter): layers = iface.mapCanvas().layers() for lyr in layers: if lyr.name() == layer: request = QgsFeatureRequest().setFilterExpression(filter) ...
1
vote
3answers
348 views

Using if else syntax in field calculator with Python?

I want to calculate a field in the field calculator that are dependent on the values in 4 other columns. My columns are "A", "B", "C" and "D" Now I want to fill the column "X" with: if "A" and "B" ...
3
votes
0answers
93 views

VBScript Syntax Error in ArcGIS labeling? [closed]

I have been using a script on older ArcGIS to convert depths in engineering format to the Hydrographic format seen on charts. On trying to use it I get a syntax error in Line 14. No matter how I ...
2
votes
1answer
84 views

ArcGIS Field Editor if/else syntax with python

I am just starting with Python and ArcGIs so here is my question: I have the column "DB_Low" (Type "Long") and want to fill a new column by changing values. The new column will be a Float-Type field. ...
1
vote
1answer
68 views

ArcGIS - if clause in the field editor with python

I have 2 columns in my table. "dB1" and "dB2" Now I want to calculate a third columnn "dB3" depending of the entries in column "dB1" and "dB2" if "dB1" or "dB2" have an entry of "0" I want to ...
3
votes
0answers
172 views

Translating ArcGIS field calculator python expressions in to QGIS field calculator python expression?

I'm transitioning to QGIS from ArcGIS. I'm having trouble getting my python field calculator expressions to work in the QGIS advanced python field calculator. Here is a screenshot of the working ...
1
vote
0answers
55 views

problem with raster calculator syntax [closed]

I am trying to build a raster representing the output from a logistic regression model. i keep getting syntax errors. heres the script: -2.41-(15.97 * "Topographic_Predictors\wadem10m_annsolrad") - (...
3
votes
1answer
515 views

Conditional Statement in QGIS Field Calculator

I'm using QGIS to calculate total loss in an earthquack attack. I wrote this expression in Field Calculator. CASE WHEN "build_type" = 1 AND "MMI" < 5 THEN "perc_loss" = 0 WHEN "build_type"...
2
votes
1answer
342 views

Syntax error in a query with ST_AsText and ST_CENTROID

I have a table in a PostGIS database where with this query : SELECT ST_CENTROID(pol8.geom) AS geom FROM polygon8 AS pol8; I got this: geom -----------...
4
votes
1answer
516 views

QGIS Raster Calculator syntax

I have tried this several different ways and get lots of NaN. I need to specify that in my raster 'test1', I want a certain set of values to equal 1 and the rest to equal zero. For instance, I want 1,...
1
vote
1answer
762 views

Syntax error at or near “1” — PostGIS in Action — Chapter 11 SQL data dump

I'm following along with PostGIS in Action, 2nd ed., chapter 11, while attempting the SQL dump from the data files and I'm getting the following error: ERROR: syntax error at or near "1" LINE 189: 1 ...
1
vote
1answer
544 views

Using decimals in ArcGIS Raster Calculator tool?

I would like to create a new raster by using the following regression equation in the Raster Calculator tool in ArcGIS 10.3: Outputras=0,000826345+(0,000203494*"Roads_density.tif") ("Roads_density....
3
votes
0answers
567 views

QGIS Space Syntax plugin with OSM data?

I'd like to do a space syntax analysis for a city I observe, but when I use the Space Syntax Plugin, the desired shapelayer roads doesn't show up. It's an OSM vector layer, what do I have to do to ...
1
vote
1answer
432 views

Editing values in attribute table column

I have an attribute table with 5,000 records in QGIS. From this I have selected a subsection of 200 records whose attributes I need to modify. In the column called 'NAME' I would like to replace the ...
-1
votes
1answer
853 views

postgis/postgres ST_Distance and GROUP BY

Trying to find the nearest road to a postcode point and order the results by distance. The roads are named according to UK convention so A606 etc and there are multiple entries for many road numbers (...
0
votes
1answer
64 views

Writing code expression in Calculate Value to find cell value or Minimum cell value?

I have a calculate value tool that I'm using to skip rasters without features/no data. I'm very new to python and do not know much about proper formatting and syntax. Right now, the tool works but ...
0
votes
1answer
241 views

mapbasic - how to link my database in my mapbasic coding

I'm creating a tool in MapBasic that identifies the PCI clash in 4G I need help: How do I add database data into MapBasic? How can I calculate mod values and colour the output in MapInfo based on ...
0
votes
1answer
64 views

Calculate field value based on lat long. Have longitude values which are negative?

Very new to python, fairly experienced with ArcMap. I am trying to create an alphanumeric index based on point locations My code string for the numeric part is here: def calc(!LONG_x!): if !...
0
votes
2answers
164 views

Syntax Raster Calculator

I have never worked with the raster calculator before and I can't solve my problem. There are two raster datasets. One contains roads ( "closed", "in use", "under construction") and the other dataset ...
4
votes
2answers
577 views

Command syntax in ArcGIS python script

I'm in the process of learning to use python to automate some tasks in ArcGIS, and while I've done a couple of on line courses about python I'm still learning to use it within ArcGIS. I've had some ...
3
votes
3answers
652 views

Syntax error running script in PythonWin after success in ArcPy

I am building a script to automate a water outage map(I'm new to Python). In the ArcGIS Desktop 10.1 window the script runs fine. However in Pythonwin and IDLE I get syntax errors(In Pythonwin reads: ...
4
votes
2answers
429 views

Seeking documentation for {z}/{x}/{y} syntax in tilesource urls?

Speaking of tilesource urls such as http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.png is there any technical documentation or canonical reference for the curly braces syntax? I'd specifically ...
1
vote
0answers
275 views

Notepad++ syntax highlighting for *.map [closed]

I can't find how to customize syntax highlighting for mapfile (*.map files) in Notepad++. I actually have add this syntax file recommended in this post. BUT the syntax highlighting is not good, ...
1
vote
0answers
215 views

IDL 7.1.2; How to plot negative correlation in Taylor diagram [closed]

I am working on a model's run performance evaluation, three runs of GFDL-CM2.0 and five runs of GFDL-CM2.1 are used for temperature and precipitation for the years 1979-2000. The objective is to ...