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

learn more… | top users | synonyms

3
votes
2answers
199 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
54 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
26 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
43 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
252 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() ...
0
votes
1answer
75 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
36 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
52 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
29 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
176 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 ( ...
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
432 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
184 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
44 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
24 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
33 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, ...
1
vote
0answers
46 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. ...
1
vote
1answer
66 views

Fastest way to transfer data from SQL to ArcMap?

I frequently have to use large tables and results from MS SQL in ArcMap and for that saving the data as .xls is one of the options. But when I add the data to arcmap, processes like joining and ...
4
votes
1answer
66 views

How to use MAX SQL statement in ArcGIS?

I would like to use a MAX SQL query for a column in a definition query, where there records that are being queried are the MAXIUM from the field UPDATE_DATE_DATE while grouping by the field ...
0
votes
1answer
66 views

SQL in Python using variable - Arcpy

I have a code in which I'd like a da.UpdateCursor, I have probles with the "where clause", here I am about to use a variable that I get from arcpy.Describe. I have no idea of this even possible. My ...
3
votes
1answer
518 views

Update a table with values from coordinates on GEOMETRY in Oracle

I have 2 columns in a table that represent the X and Y coordinates. The values in those columns don't match the actual coordinates and I want to update them with the coordinates values that are ...
0
votes
1answer
62 views

postGIS 'dynamic' SQL queries

I have a postGIS table: id value geometry 0 10 'g_0_10' 0 20 'g_0_20' 1 10 'g_1_10' 1 20 'g_1_20' 2 10 'g_2_10' 2 20 'g_2_20' ... ...
2
votes
0answers
65 views

Error on qGIS with postgresql views

I have a PostGIS database with various tables and views. With pgAdmin I can make requests on the tables, on the views, all is working. I add tables in QGIS 2.8, it's working, I can read, write, modify ...
1
vote
1answer
268 views

Querying Oracle geometry data type

How to query or find the geometry data type a given Oracle Database is using in SQL Developer (i.e. SDO_Geometry, ST_Geometry, etc)? I thought I could just describe a feature class within the ...
0
votes
0answers
98 views

ogr2ogr conversion error - Can't create fields of type Binary on shapefile layers

I'm having trouble using the ogr2ogr tool on the command line. My data is stored in SQL as binary, type is mixed polygons and multipolygons. I am using the following command for conversion from SQL to ...
1
vote
1answer
105 views

How can I limit a spatial binning query to a specific bounding box?

I am using Esri's GIS tools for Hadoop but I think the query is pretty standard stuff. The SQL/HQL below is from the Esri tutorial found here ...
0
votes
0answers
69 views

Postgres PostGIS geocode_intersection()- How to handle exception?

I have a table in Postgres with a set of records that are street names which needs to be geocoded to get an intersection point.Some of the records would be bad input and when using the ...
0
votes
1answer
115 views

Qgis 2.10 unable to add a new feature in spatialite via sql function “GeomFromText”

Using Python code in my plugin the function in sql language "GeomFromText(POINT(X Y))" gives the following error: "OperationalError: no such function: GeomFromText" Plugin functions in previous ...
0
votes
0answers
81 views

Creating Query Layer with 1:M relationship in ArcGIS?

I am trying to create a query layer in ArcGIS which contains 1:M relationship, When i execute query i am getting blank feature class. My query is as below SELECT a.Industrialcode, a.Industrialname, ...
2
votes
2answers
74 views

CartoDB's SQL API: Row too large

I am trying to run the following PostGIS query using CartoDB's SQL API: SELECT the_geom, ST_Area(ST_Intersection(the_geom::geography,ST_Buffer(ST_SetSRID(ST_MakePoint(-52.4379, ...
4
votes
1answer
41 views

Cartodb API Read Only

Is it possible to generate an API-key in Cartodb with read-only permission? Seems like the default API-key has full controll
-1
votes
2answers
147 views

Sql Query in Postgresql

I am trying to execute a query but I am stuck. I have two tables A and B. The a table has columns gid, geometry(line-string) and value which cells is empty , the B table has got 3 columns gid, ...
0
votes
1answer
79 views

Where clause in MapInfo Table Updates

Is it possible to add a where condition to an update query in MapInfo? At the moment I have to do a query to select the records I need and then do an update on that query. I believe this is ...
0
votes
1answer
78 views

GDAL -SQL or -where options

ogr2ogr -overwrite -t_srs EPSG:3978 -f "ESRI Shapefile" -sql "SELECT * FROM 'Layer Name' WHERE FIELD_NAME = 'A CLASS'" dst.shp src.shp help me out here - looking to 1) reproject a shape and 2) ...
0
votes
0answers
71 views

Selecting all cells not containing a number in SQL

I have a field containing some values. In edit mode, when I click on any one of these values it gets replaced by 1.#QNAN in the cell. I would like to query the table for all cells containing ...
2
votes
1answer
186 views

Show Log of the Sql statements that QGIS generates to retrieve Data from Postgis

Is there a ways to - make QGis log its generated SQL Statement or to - force POSTGIS to log all interaction with QGIS? There is something strange happening to the WFS layer I retrieve in QGIS, since ...
1
vote
1answer
115 views

How to select from geometry column in postgresql?

I've got a table which it has a geometry column filed by some point (ex. "POINT Z (116.309627 39.991285 148)"). now I want to select point's id from the table. I wrote follow sql Code but I force an ...
2
votes
2answers
210 views

how to snap points to lines in QGIS/PostGIS?

I'm attempting to snap approximately 900 points to a line table. I've tried recreating what I have found from a couple of PostGIS answers but not having much luck. To test, I've created two ...
1
vote
1answer
68 views

How to store multi-valued attributes in PostGis using Postgresql [closed]

I have a with meterid,meterreading,reader and date read.I wish to store this data using Postgis database. I used this code via postgresql to create the table CREATE TABLE MeterRdg( meterid ...
1
vote
1answer
97 views

Updating static GTFS data android

I have an android application that takes a static GTFS data that I manually turned into a database. My question is how do I update this GTFS data automatically? Or is that not possible? Any ...
1
vote
0answers
130 views

PostGIS dijkstra routing - specifying source and target as bigint instead of int4?

I'm currently working on a problem where I have to use PostGIS's pgr_dijkstra to calculate the shortest route from a starting point to a destination, and then use ST_AsGeoJSON to convert the route to ...
0
votes
1answer
35 views

Differences between columns in MapInfo

I have two columns in a nodes table, one column has the ground level of the node taken from the model and the other column has the ground level inferred from LiDAR. Is there a query that can be used ...
5
votes
2answers
149 views

QGIS expression builder include relation attributes

I have a set of symbols based on a table in postgis such as this id|type|action_1|action_2|geom In QGIS I have this table symbolised using a rule expression which works effectively. However this ...
2
votes
1answer
98 views

How can I do a subquery inside a subquery in PostGIS?

I need to add a subquery to a working function. Instead of select * from table, I'd like to select * from (select * from table where height>1500) as sub, something that works in other functions I ...
1
vote
1answer
54 views

PgRouting: Target vertex error

I'm trying to make a matrix that shows the cost from a node to the rest of the nodes in a network. The final result I'm looking for is not the cost, but only know if a car can or can not reach each ...
0
votes
1answer
46 views

Querying a raster per pixel using a secondary raster as a condition

So here's the problem. I have two rasters containing bathymetry data: one containing the bathymetry of the sea floor, we'll call this raster1, and another containing the difference between two ...
2
votes
1answer
105 views

ST_Union based on attribute

I have a road network of center lines of MultiLinestrings.They have nodes at every intersection. I try to understand how I can merge roads together that have the same category as attribute (There are ...
3
votes
2answers
374 views

Column 'SHAPE' cannot be null in mysql database even if the query string is correct

I am trying to write an POLYGON into an column named SHAPE which is a geometry type. And created query which looks $sql = "INSERT INTO rokka(zone,district,location,area,SHAPE) VALUES ...
0
votes
1answer
126 views

What command to use in PostGIS to get same result as ArcGIS?

I have two shapefiles and i'm trying to do simple spatial analysis. When I want to know which polygon belongs to other polygon in other shapefile I always use select by location and in Spatial ...