Skip to main content

Questions tagged [syntax]

the structure of statements in a computer language.

Filter by
Sorted by
Tagged with
0 votes
0 answers
27 views

ArcPy Con and SetNull do not recognize constant value

I have a script that requires the SetNull and Con tools to change values in a raster. Here's some examples: # changing 0 to NoData, all other values to 1 background_removed = arcpy.sa.SetNull( ...
Sam's user avatar
  • 1
1 vote
2 answers
78 views

Use gdal_translate on an orthographic PNG image of the Earth centered at Lat=+50N Lon=+5E to proper orthographic GeoTIFF format

How do I gdal_translate an orthographic PNG image of the Earth centered at Lat=+50N Lon=+5E to proper GeoTIFFf format ? I cannot work out how to specify the limits of a full disc. (diameter of Earth ...
Molly's user avatar
  • 35
1 vote
1 answer
71 views

Re-projecting an orthographic image to a equirectangular projection has some sort of problem. The poles are getting truncated. missing parameter?

Re-projecting an orthographic image to a equirectangular projection has some sort of problem. The poles are getting truncated. is there a parameter I am missing? Is there a difference between "...
Molly's user avatar
  • 35
0 votes
1 answer
623 views

Formating a WKT CRS string in a way that R can read it

I have selected a custom CRS using the website https://projectionwizard.org/. I chose this custom CRS because I needed a map of the Neotropics (+ or - from the south of the US to the north of ...
Thales Moreira De Lima's user avatar
2 votes
1 answer
560 views

PDAL +init use deprecated but what is the alternative

With PDAL I was trying to using a proj4 string like +init=epsg:32615 +geoidgrids=C:\vdatum_GEOID12A\vdatum\core\geoid12a\g2012au7.gtx based on an example given on the PDAL website https://pdal.io/en/...
TJR's user avatar
  • 1,612
0 votes
0 answers
114 views

Multiple methods syntax

I am new in Python and learning to use it for spatial processing. I bought the book "Learning Spatial Analysis with Python". In the book, I often see syntaxes with multiple methods (a=module....
GIStrees's user avatar
  • 119
3 votes
1 answer
167 views

hstore_to_map command syntax

I am struggling with the correct hstore_to_map syntax. I extracted power plants from OSM. In the "other tags" field are coal, hydro, solar stated as sources. How do I get/display just the ...
BAE_23's user avatar
  • 677
1 vote
1 answer
54 views

Why is help(activeLayer()) not working?

Why are neither of the commands below returning details on the active layer method? It works when I use the class iface. help(activeLayer) help(activeLayer()) This is the error I get Traceback (...
Chace Carpenter's user avatar
5 votes
2 answers
1k views

Why do single-part WKT polygon vertices require double parentheses?

Regarding the WKT standard: Wikipedia: Well-known text representation of geometry Why do single-part polygon vertices require double parentheses? That seems inconsistent with single-part points and ...
User1974's user avatar
  • 1,172
1 vote
3 answers
63 views

How to prevent '+' operator from concatenating rather than summing [closed]

I am trying to sum two fields and am using the expression below. "Q1 answer" + "Q2 answer" This expression is concatenating the answer to '32' when the answer should be '5' (3 ...
Laura Bennett's user avatar
1 vote
0 answers
252 views

Dealing with white spaces in attribute names in ogr2ogr

I am trying to convert a sub-set of my geodatabase into a shapefile using ogr2ogr. The problem is that both the attribute name and the value have spaces, so when I use sql to subset it gives me syntax ...
rm167's user avatar
  • 469
0 votes
1 answer
50 views

Creating circle polygons for 'Protection Zones' that are specific to individual points measured by radius in metres using QGIS

I have found similar questions to this but nothing that will work for my particular circumstance. I have points as a vector layer, I want to display their measured protection zones that are individual ...
BloomingT's user avatar
7 votes
1 answer
605 views

VS Code Intellisense with modern arcpy syntax

Does anyone know to get VS Code's intellisense to work with modern arcpy syntax? This post addresses VS Code not recognizing the correct interpreter at all: VS Code autocomplete for ArcPy But that isn'...
itsrainingschmen's user avatar
5 votes
2 answers
1k views

Syntax for using other fields in Advanced Python field calculator in QGIS

What is the syntax for the "Advanced Python field calculator" when using other fields as input in QGIS 3.2.20? (The example below is not the actual function. I have a complex if-else, ...
Bera's user avatar
  • 74.7k
1 vote
1 answer
93 views

Space Syntax Toolkit - What do the abbreviations (i.e. INThh) stand for?

I cannot seem to find any information on the used abbreviations in the Space Syntax Toolkit, such as these: Is there any documentation available on the used abbreviations?
Topow's user avatar
  • 361
1 vote
1 answer
75 views

How to treat unlinks for computation in the Space Syntax toolkit?

Since I cannot find documentation about unlinks for Space Syntax analysis, can unlinks (bridges/ tunnels) be treated just like regular portions of the urban grid? Meaning I can join them to be ...
Topow's user avatar
  • 361
7 votes
1 answer
2k views

Refering to the input-layer of a QGIS model in field calculator expression

The setting In a QGIS model, I have an input layer polygon from which a grid is created. On this grid-layer, a new attribute field should be created based on an expression that refers to the input ...
Babel's user avatar
  • 73.1k
3 votes
2 answers
949 views

log naturalis syntax in GEE?

I am using Google Earth Engine (JavaScript) to calculate brightness temperature by converting at-satellite radiance of Landsat 8. In literature the formula T = K2 / (ln((K1/L)+1) -273.15 (T: ...
Benno_Banton's user avatar
12 votes
3 answers
3k views

QGIS expression with overlay-fuction: filter-condition based on comparison of attributes from two layers

In QGIS 3.18, I have two point layers: layer_1 with attribute id_1 and layer_2 with id_2. I want to use the overlay_nearest function: overlay_nearest(layer[,expression][,filter][,limit=1][,...
Babel's user avatar
  • 73.1k
2 votes
1 answer
879 views

QGIS Field Calculator Syntax Error Problem

I never before worked with the field calculator and this problem is driving me nuts ... Interpretationserror: syntax error, unexpected NAME syntax error, unexpected ')', expecting $end My expression ...
bluesharxx's user avatar
1 vote
2 answers
236 views

JoinFeature attribute_relationship syntax (arcpy)

I am building a Python Toolbox for ArcGIS using Python 3 with ArcPy. I have two tables that I need to relate based upon an attribute. The information on the documentation for the JoinFeatures() ...
Sharpie171's user avatar
2 votes
0 answers
358 views

How to write syntax to sum values for unique IDs in Survey123 Summary Report?

How do I get a sum of values for a question for each uniquely named pump station in a Survey123 summary report? I've developed a workflow for my client to do Pump Station inspections using Survey123.  ...
Katie B.'s user avatar
  • 807
2 votes
0 answers
132 views

QGIS Advanced Python Field Calculator Syntax

I am attempting to calculate the difference between two azimuths using the following code in the QGIS Advanced Python Field Calculator : def azimuthDifference(): Model_Azimuth = <Model_Azimuth&...
tacarn's user avatar
  • 143
3 votes
1 answer
117 views

Performing "Joinattributebylocation" in PyGQIS

I'm new to QGIS and PyQGIS. My task is to draw points on a map and find which points are in a specific area. To accomplish this I have three shapefiles of which two contains similar data which are ...
Slashy27's user avatar
1 vote
1 answer
2k views

How to filter for distinct values and apply multiple filters in QGIS attribute table?

I am very new to QGIS. I am doing an assignment for class where we have to answer several questions about data obtained from Global Fishing Watch. One of the questions is how many vessels have a ...
Isaac98H's user avatar
1 vote
1 answer
122 views

ArcPy syntax for nested Con statement

I am trying to convert a process usually used in ArcGIS Tools to arcpy in a Jupyter notebook. I have a very long Con statement that basically takes all the values of 10 rasters and adds them together....
ChristineF's user avatar
0 votes
2 answers
131 views

Syntax for converting tuple into string with Merge in ArcPy

I have a tuple of unknown elements, which I want to convert into a string for using in the arpy command arcpy.Merge_management([Input1, Input2, ..., Inputx], "D:\\test.shp") In my example I ...
Kunibert's user avatar
1 vote
1 answer
1k views

GDAL raster calculator

I have a series of raster data (GeoTIFF) with 5 bands (B / G / R / rededge / NIR). I would like to calculate different indices by using the gdal raster calculator. I would like to use the batch ...
Hardau's user avatar
  • 101
0 votes
1 answer
1k views

New GeoServer WFS error NoSuchAuthorityCodeException

What is causing this error? org.opengis.referencing.NoSuchAuthorityCodeException: No code "EPSG:4326," from authority "European Petroleum Survey Group" found for object of type "IdentifiedObject". ...
Ivan Heitmann's user avatar
3 votes
1 answer
3k views

ArcGIS Pro Calculate Field giving WARNING 002858: Certain rows set to NULL due to error while evaluating Python expression

I'm working with some county level data for the 2016 US Election. I'm trying to calculate a blank Text field "Winner" based on two numeric fields "votes_dem" and "votes_gop" where it will take the ...
Tom S's user avatar
  • 33
3 votes
1 answer
153 views

Insert Cursor Having an Issue With Reading the Syntax of a List

In my code below, how do I get the Desired Output? # Get a list of all 'SITE_NFID' in the dashboard_site_summary table that don't have a match in the nfid_fqn_associations table ...
GIS_GOD's user avatar
  • 389
1 vote
1 answer
36 views

Cleaning SQL queries [closed]

I have a bit of SQL code that look similar to this: SELECT sum(case when latitude = '0' then 1 else 0 end) as count_zero, sum(case when latitude is NULL then 1 else 0 end) as count_null, sum((case ...
Nic Pickers's user avatar
3 votes
1 answer
810 views

Creating a table view using SQL? [closed]

I'm trying to create a table view using SQL to join a table and a feature class together. When I try to create the view, I get an error saying there is an incorrect syntax near the keyword 'CREATE'. I'...
Mark1994's user avatar
0 votes
1 answer
958 views

PostGIS-syntax: export query-result to QGIS / Shapefile

Using PostGIS: syntax-basics for function, I was able to solve a long-standing problem by creating a geometry, using a SQL-query with PostGIS. However, I want to use the created geometry in QGIS and ...
Babel's user avatar
  • 73.1k
3 votes
1 answer
268 views

Syntax-basics for using ST_ApproximateMedialAxis() function in PostGIS

I tried to solve a problem I had in QGIS (see Simplifying multiple lines to create central axis?). I just need to know how the correct syntax works to use the function ST_ApproximateMedialAxis(...
Babel's user avatar
  • 73.1k
1 vote
1 answer
199 views

Raster calculator - problems with syntax

I have a raster layer with values ranging from 0.00597303 to 0.102894 and I want to assign specific number representing a group to specific range of values: Group 4: x >= 0.1 Group 3: 0.01 <= x ...
Petr's user avatar
  • 175
4 votes
2 answers
245 views

Adjusting condition in field calculator in QGIS [duplicate]

I need to calculate a score based on an area field using these ranges: if >= 30000 (square meters) then 4 (score) if < 30000 AND >= 10000 then 3 if < 10000 AND >= 5000 then 1 if &...
Olivier's user avatar
  • 73
1 vote
1 answer
642 views

Raster calculator issue in QGIS 3.8 and 3.8.1

I am trying to perform a simple raster calculation on an elevation layer to occlude certain values. I have used the following expression: ( ( "clipped_elev@1">500) AND ("clipped_elev@1"<1000))*"...
Techie_Gus's user avatar
  • 2,130
2 votes
1 answer
91 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 ...
Andrew Rickard's user avatar
14 votes
4 answers
3k views

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

I am confused concerning the quotation marks syntax ('single' vs "double") in QGIS. I know something about the quotation marks and the way they are applied in Python scripting (i.e. comments,...
Taras's user avatar
  • 33.3k
1 vote
1 answer
62 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 ...
Paul's user avatar
  • 63
0 votes
1 answer
36 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@...
Flavio Felix's user avatar
5 votes
2 answers
392 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 ...
Edward Hampson's user avatar
3 votes
1 answer
388 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 ...
Maiyuran Kurukkal's user avatar
0 votes
1 answer
204 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 ...
Matt A. 's user avatar
4 votes
2 answers
1k 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 ...
Spyros's user avatar
  • 135
1 vote
1 answer
60 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'...
UnsoughtNine's user avatar
0 votes
0 answers
156 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(...
vcruvinelr's user avatar
4 votes
3 answers
533 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 ...
EduardoHansson's user avatar
1 vote
0 answers
159 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 ...
Shub's user avatar
  • 942