Acronym for Structured Query Language. A syntax for retrieving and manipulating data from a relational database.

learn more… | top users | synonyms

0
votes
0answers
23 views

if then else statement in Exponare?

I am currently trying to rewrite an SQL statement for Exponare so that if the user is not the administrator only certain attribute table columns are displayed should a query or selection be performed. ...
0
votes
0answers
23 views

Selection Based on Range of Values from another table

I'll try to explain this is as simply as possible. I've figured out how to create this table in SQL, no problem. But I'd like to have this done in python as part of a larger model. I have a feature ...
4
votes
1answer
254 views

Merging multiple feature classes in file geodatabase with ogr2ogr?

Is there a way to merge multiple feature classes into one feature class in a geodatabase with ogr2ogr? If this isn't possible with ogr2ogr, is there another method? I'm using the ESRI File Geodatabase ...
3
votes
1answer
29 views

how to create a new row with a counted points in postgis

I have two tables in postgis (pgadmin). In one table there are points and in the other table there are polygons(provinces). The tables are both over the same location (Netherlands). I want to count ...
0
votes
0answers
49 views

Set alias for subfields when performing query

As mentioned within the ESRI-docs we can set an Alias for the subfields of an SQL-query performed onto a file-geodatabase as follows: IQueryDef2 filter = (IQueryDef2) featureWorkspace.CreateQueryDef()...
4
votes
0answers
123 views

Create polygon from lines in PostGIS

I'm trying to divide a polygon in smaller polygons from a line, but I think I can't use the st_split function. What I need is to create small polygons inside a big one, using linestring grid. I've ...
2
votes
2answers
133 views

Formatting SQL expression for calculate field (management) tool?

I am trying to take the population census tract and calculate the percentage of population by each census tract in the field (Populati_2). To do this I'm creating a new field with the total sum of the ...
1
vote
1answer
55 views

Possible CartoDB SQL add-on?

Is there a possible add-on that will simplify the user experience when creating a SQL statement? More specifically, is there a GUI that would allow the user to create a SQL statement similar to ...
1
vote
1answer
49 views

Get lat and long in two columns as floats for all points in MULTILINESTRING in PostGIS?

ST_DumpPoints(geom) gives me something like this: ("{1,1}",0101000020E61000002DEDD45CEEB362C0CE1951DA1BC24E40) ("{1,2}",0101000020E6100000C94AD826F1B362C09D4B7BC72CC24E40)... Where I want it to ...
2
votes
1answer
56 views

How to create lines from coordinates?

I have a data table about national bus lines, with timestamps, vehicle IDs, line IDs (which line the bus is moving on), and coordinates(geom). I can add my points to QGIS on show them on OSM, but I'd ...
1
vote
2answers
167 views

Checking if SQL where clause is valid with Make Feature Layer?

Unfortunately it's possible to apply an invalid SQL where clause when using arcpy.MakeFeatureLayer_management. This can cause issues later in a script. For example, I created a feature layer and ...
0
votes
1answer
74 views

Arc 10.2.2 crashes when adding query layer?

I'm trying to add a query layer from an Oracle database into a blank 10.2.2. map. I enter the query, validate, finish, and the software thinks for a second and then just winks out. No error message,...
1
vote
3answers
70 views

Intersection of 2 Linestrings (not interpolated)

I am struggling with a query in POSTGIS I want to find linestring geometries where the geometries are containing the same point. I don't want to calculate the intersection points. I only want to ...
7
votes
3answers
506 views

Constructing Voronoi diagram in PostGIS

I'm trying to construct voronoi diagram from grid of points using modified code from here. This is SQL query after my modifications: DROP TABLE IF EXISTS example.voronoi; WITH -- Sample set of ...
1
vote
3answers
50 views

Is a SQL String Aggregate possible in arcgis?

I have created a feature class from the results of a 1:many join between a table and a polygon layer in ArcGIS 10.3. The polygon layer contains land parcels and the table contains names. Where a 1:...
0
votes
1answer
33 views

Parcel Owner to see only his parcel in map application

How can i create a map where user can only see his parcel. parcel are defined has one unique ID. I have Arcgis online Server and Desktop Advanced license. the map to be published in a web application ...
0
votes
1answer
45 views

Negative numeric values in Geoserver sql view params

I want make some query based in lon/lat values of a specific place. A simple example is this: SELECT C.tipo, C.geom FROM climas AS C WHERE ST_Contains(ST_SetSRID(C.geom, 4326), ST_SetSRID(ST_Point(%x%...
1
vote
1answer
87 views

Postgis/SpatiaLite SQL query to connect MySQL, Access or Oracle database

In SpatiaLite or Postgis, how can one create a SQL query to read a table from a MySql or Oracle database? I don't know **the correct SQL syntax to connect to a table in a MySql or Oracle database **....
1
vote
2answers
46 views

Viewing results of ST_Difference

I've got an ST_Difference query runnning error free in PostGIS, and in PGAdmin I can see the output table but it's not viewable in QGIS - The table name appears in DB Manager but says "There is no ...
2
votes
0answers
40 views

QGIS - WHERE SQL within a processing.runalg statement for v.surf.rst in python console

I'm creating lots of raster files with grass:v.surf.rst so rather than using the graphical interface I wanted to use the python console (and potentially put in in a script at some point). However ...
1
vote
1answer
98 views

How to make a SQL query that would sum multiple records in ArcGIS?

I've got a large file geodatabase that contains a polyline feature class of water-pipes. The feature class have many fields, but the ones that I'm interested in is that of the water-pipe's Length and ...
1
vote
1answer
27 views

Polygons created for holes after running ST_Collect

I ran an ST_Collect query on a polygon dataset using ogr2gor -dialect sqlite -sql SELECT ST_Collect(geometry),id FROM wl_test GROUP BY id The result is a multipart polygon, which is what I want, ...
1
vote
1answer
27 views

postgis: union of faces of st_dump

I am trying to make a web application that renders 3D buildings (LoD1). I have a PostGIS (2.2.1dev) database which contains the 2D geometry of the buildings and the height. I used st_extrude to make a ...
0
votes
1answer
39 views

Using MapInfo SQL?

I am trying to create a map of U.S. counties that shows migration patterns. I have a table of all US counties and a table that has migration information. Some counties do not have migration, ...
2
votes
1answer
217 views

How to use ST_DWithin to query features from one table within a distance of a specific feature or features in another table

I'm pretty new with PostGIS. I have a parcel layer and a census block layer in a postgres database, and I would like to be able to query out all census blocks within a specified distance of a specific ...
0
votes
0answers
99 views

PHP, PostGIS & Geojson

I'm using Lumen to connect to postgis and I want to execute this query: WITH query AS (SELECT ST_GeomFromGeoJSON('{"type": "Polygon","coordinates": [[[366063.228612569917459, 623109.765295544289984],[...
1
vote
0answers
46 views

Inserting search box using dataset column using CartoDB?

I have got some problems to add a search box that can runs searching points from a column of my dataset. I've read this article: How can I link the search box to a dataset column in CartoDB? but I'...
0
votes
1answer
89 views

Using function in SQL query with ArcPy?

I am trying to join points to polygons based on whether their addresses match as well as if the distance between them is less than 2500 feet. I defined a haversine function that computes the distance ...
2
votes
1answer
43 views

GRASS PyWPS Create a new vector map from user selected polygon

My goal is to select a specific polygon in which the user clicked and make a new vector map that contains only the selected polygon. I see two ways: Convert XY coordinate from literal input to a ...
0
votes
0answers
10 views

Using predefined variables in whereclause? [duplicate]

Can't seem to figure out how to use variables for an SQL whereclause in python. e.g. want to select_analysis(layer, "new sel", field = attribute) with field and attribute being predefined by user ...
2
votes
1answer
105 views

Esri ArcSDE 10.3.1 Query Inspire Metadata from Oracle (11g) Enterprise GeoDB via SQL

As the title says - I want to create a query in Oracle SQL which will read all dates from the geoprocessing history which can be found using ArcCatalog to show the "Description"-tab from a feature. (...
2
votes
0answers
28 views

Filter features based on attribute percentage threshold [duplicate]

I have a layer (vector layer imported from a Shapefile) in QGIS 2.8.3 with a bunch of features with a single numerical attribute, 'level'. I would like to filter the features with a threshold that is ...
3
votes
2answers
247 views

subquery in select by attribute in Arcgis

I have a table with several fields. field A contains the same kind of values as does field B. I tried to select all points where the value in field A does not exist in anywhere field B using query ...
1
vote
2answers
55 views

PostGIS insert failed without raising error

I'm learning PostGIS through a book "PostGIS in action". The SQL code written in the book has a lot of issues and I've figured most of them except this one: Copied from the book chapter: CREATE ...
1
vote
1answer
28 views

Querying two Separate Columns in ArcPy SQL {where clause}? [duplicate]

Using ArcPy I'm Trying to Set up a Where Clause in my "FeatureClassToFeatureClass_conversion" This {Where Clause} needs to Query Two Columns in the data: FEATURE = 'ENVIRONMENT' and TEMPERATURE &...
1
vote
1answer
38 views

Aggregating taxi data to census block data based on number of taxi trips?

I am doing a study on taxi demand using block level census data and taxi drop off and pick data in the form of Latitude and Longitude around the united states. I am hoping to create a map that shows ...
1
vote
1answer
49 views

Change field names in SQL Server Management Studio

I am building a spatial view using SQL Server Management Studio 2014. One of the tables I am using to build this view has field names that are not compatible with esri; the field names have slashes, ...
2
votes
1answer
361 views

Connecting QGIS, SpatiaLite and Python?

I am trying to connect with python code, QGIS and Spatialite, to do SQL query. I have read some tips and I tried with this code, but no add anything. Any Idea? uri=QgsDataSourceURI() uri....
0
votes
1answer
89 views

Generating pivot table in PostgreSQL that ties cities to counties using QGIS (or PostGIS)?

I have a cities shapefile and a counties shapefile. I have the counties shapefile imported to a PostgreSQL table. I haven't transferred my cities to PostgreSQL yet, but the issue I really want to ...
1
vote
1answer
40 views

Sum and groupby several conditions

I have a road network where each link is part of a reference number. I am trying to sum up the length of roads per reference number and status. My nested query fails and just sum the total length of ...
1
vote
0answers
60 views

refine nearest_node with radius-distance ( ST_Distance, ST_DWithin )

i am a hobby-IT-person and currently stuck with some simple problem, maybe somebody can help me: This is my working POSTGIS-function, source by underdark: ALTER TABLE distance_graz ADD COLUMN ...
1
vote
0answers
30 views

How would I build the syntax inside a request in the case I wanted to multiply 2 variables?

I would like add something to my previous question (here: How to build QgsExpressions in python?) How would I build the syntax inside this request in the case I wanted field_name to be also a ...
4
votes
2answers
221 views

How to build QgsExpressions in python?

How can I build a feature request expression using variable inside expression? For example values = [1, 2, 3] for j in range( y ): it = vl.getFeatures( QgsFeatureRequest().setFilterExpression ( u'"...
0
votes
0answers
34 views

Number of rows returned via `shp2pgsql` for a given shapefile

With the shp2pgsql tool, I see it converts a shapefile into a SQL statement. Upon closer examination, does the SQL generated ALWAYS contains 1 insert statement for 1 row? Or are there instances where ...
1
vote
3answers
591 views

How do I find points that are NOT within a list of polygons using MS SQL?

I have a table of points, and and a table of polygons. I have managed to build queries (MS SQL) to get the containing polygon for a given point, as well as listing all the points within a specified ...
0
votes
0answers
190 views

How to improve performance when using a large amount of data (big tables) in ArcGIS?

I'm working with the kinematic wave method to determine the runoff of a basin, I am using the explicit method for resolution (The Lax-Wendroff scheme): I'm working with script code in python (i'm ...
0
votes
1answer
49 views

Using ST_Extrude in Postgres 9.2, with PostGIS 2.2.0

I'm trying to use the function ST_Extrude() in Postgres 9.2. I enabled the PostGIS 2.2.0 extension and the PostGIS_SFCGAL extension (which carries the ST_Extrude function). I can see the function in ...
0
votes
0answers
28 views

Dealing with NULL values in geodatabase using GDAL commands?

I have a geodatabase and I'd like to return a value for NULL. (When I look at my raster layer, there are a lot of zeroes which I am assuming is because of the NULL values) Is there a way to use the ...
0
votes
1answer
34 views

How Update one table row with combare with the other polygon table using their geom in SQL Server

a-> points b -> Polygon i want to update city trow in table a with compare b of geom in SQL server this is the PostgreSQL Query update a set city=b.name from b where st_contains(b.the_geom, a....
1
vote
0answers
52 views

calculate positive difference by column common value with sql

I have one table with a few columns (and around 9000 rows) see below. Now I would like to calculate the positive difference from R where Xn has the same value and when Xn has the same value as Yn. ...