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

learn more… | top users | synonyms

1
vote
2answers
39 views

Load multi CSV files from local disc to Postgres

I want to load a lot of CSV files from a local disc in an already created postgres database. Which is the easiest way to do that? By using SQL or Java? I suppose that I need a loop for doing that, but ...
3
votes
2answers
61 views

How to reproduce FME Change Detector results in PostGIS?

we would like to use the function change detector from FME in PostGIS. We had a try with the following SQL-Statements but the function doesn´t work. There are no results in the end. The single ...
0
votes
0answers
28 views

ArcGIS Workflow Manager Query - Find Duplicate Job_ID

We have a query in ArcGIS Workflow Manager 10.2 shown below that shows "All Assigned Jobs". Due to the nature of our workflows (parallel workflows), some jobs are duplicated more than once in the ...
1
vote
1answer
38 views

ogr2ogr command : chaining -clipsrc and -sql filters?

I'am currently doing a clip then SQL query to select the biggest cities out of Natural Earth data via 2 commands : ogr2ogr -clipsrc 1 52 7 49 ./tmp.shp ...
0
votes
1answer
44 views

Find nearest node function

I am trying to get work the next function but i don't know if it is incomplete because the query SELECT * FROM pgr_nearest_node1('jaen',-3.75,37.779); does not provide any results. Here is the ...
0
votes
1answer
55 views

pgr_drivingdistance wrapper

Pgr_drivingdistance function works as : SELECT seq, id1 AS node, cost FROM pgr_drivingDistance( 'SELECT id, source, target, cost FROM edge_table', id, distance, false, ...
0
votes
0answers
28 views

Syntax error drivingdistance

I am new in sql and i am trying to get that works a subquery with pgr_drivingdistance and pgr_pointsaspolygon but i get the next error: subqueries in FROM must to have an alias,for example, FROM ...
1
vote
1answer
70 views

Adding Nodes to Linestrings at Overlapping Points with Polygon Layer in Spatialite

I have two Spatialite tables. A table called 'lines' which contains a PK column called OGC_FID and a LINESTRING column called GEOM. A table called polys which contains a PK column called OGC_FID and ...
0
votes
1answer
43 views

PgRouting function wrapper

I'm trying to adapt the pgr_fromAtoB function to pgr_fromAtoMult replacing pgr_dijkstra function to pgr_drivingdistance.Here is the code: CREATE OR REPLACE FUNCTION pgr_fromAtoMult(IN tbl character ...
0
votes
0answers
43 views

GeoServer Style referencing SQL Server data store

I have a SQL server (2012) based data store in GeoServer (version 2.6) . For better readability I created a spatial layer with a whitespace in a column (attribute) name. Trying to use a style with ...
3
votes
1answer
72 views

PostGIS multiple conditional statement on spatial join

I want to make a multiple conditioned spatial query in PostGIS 2.0/PostgreSQL 9.3., OS Windows 7. There are 2 tables, cadastre (Polygon) and roads (Linestring). Query: Select the sum (one number) of ...
1
vote
1answer
28 views

Using MOD within a GROUP BY subquery on point dataset

I have a dataset of 200 points (in shp/f gdb/p gdb format) in ArcGIS. I am trying to use the MOD() function within a GROUP BY subquery as a definition query on the layer to thin out the data. What ...
0
votes
1answer
64 views

MapInfo Calculating the number of Points that Fall within a Boundary

I have two layers in MapInfo (points and polygons). I need to select points which fall within polygons where the income > 1500 I tryed this one but not working: ...
1
vote
1answer
59 views

Merging multiple tables using SQL in CartoDB

I have 5 separate tables in CartoDB each with a varying number of columns, but all containing these 4 columns (the_geom, name, type, unit_code). I want to merge them all into 1 new table and get rid ...
0
votes
0answers
17 views

SQL query syntax for NDVI grid in ArcGIS for Desktop?

I am trying to extract by attribute pixels with a Value >0 (i.e., the vegetation in an NDVI grid file) in ArcGIS. Every time I try to extract by attribute (spatial analyst tools/extraction), my SQL ...
0
votes
1answer
44 views

PostGis - BBox -vs- ST_intersects Queries

CartoDb Recommend here that the following query is faster than an St_intersects Query SELECT * FROM {table_name} WHERE the_geom && ST_SetSRID(ST_MakeBox2D(ST_Point(-73.9980, 40.726), ...
0
votes
1answer
21 views

Walking-Driving area with Leaflet,OpenLayers

Could be possible to get a walking or driving distance area using pgr_drivindistance,pgr_alphashape and/or pgr_pointsaspolygon when an user click any location on map with Leaflet or OpenLayers?. I ...
3
votes
0answers
76 views

Spatial query too slow to handle bigger OSM extracts

I'm trying to compute some statistics for OSM data using PostgreSQL 9.3.5 and PostGIS 2.1.4. I started with a small bavaria extract which I downloaded from Geofabrik. The db schema is the normal API ...
0
votes
0answers
39 views

`Execute SQL` in Processing QGIS 2.6

I made a small model with Processing in QGIS 2.6. The final layer should be the result of a SQL query. Now, in the Execute SQL dialog window I can add the query: select name, max(ele) as ele, geom ...
1
vote
2answers
51 views

How can I add another WHERE filter to a PostGIS query?

I have this query, which works well, for an OSM database: SELECT row_to_json(fc) FROM ( SELECT ST_AsGeoJSON(ST_Transform(ST_Intersection(lg.geometry, bbox.geom), 4326))::json As geometry, ( ...
1
vote
0answers
43 views

SQL query works in PostgreSQL but not in GeoServer SQL View

I can't find a solution for this problem after a couple of hours of research. The query is: SELECT searchaddress('some string'); FETCH ALL IN mycursor; The function searchaddress returns a ...
0
votes
1answer
82 views

CartoDB layer selector - selecting data from 2 layers

I used the CartoDB layer selector example (http://cartodb.github.io/cartodb.js/examples/layer_selector.html) with my data. Works fine. Now, what I really want to do is to select data from 2 layers at ...
0
votes
2answers
50 views

Link to another table in CartoDB infowindow

I have two layers in CartoDB, one with spatial data, school_count, and one without, heisman_winners. I want to visualize my spatial layer but when a user clicks on a feature I want it to display data ...
2
votes
1answer
55 views

SQL query as part of featureClick in CartoDB.js

I am a complete novice at both Javascript and SQL so am learning as I'm going with this! I have made a webpage that shows a map with a layer of points on the left hand side of the page. What I want ...
2
votes
1answer
43 views

Why can't I add a Spatialite table with clip results in QGIS?

I have 2 layers and I want to make a clip of layer 1 with layer 2 in SpatiaLite (I'm using the DB Manager within QGIS). That's the code I'm using: create table clipped_lines as select * from lines, ...
1
vote
1answer
61 views

MapInfo, SQL data from multiple tab files which have the same columns

New to the GIS forum so apologies in advance for any potential etiquette failures... I'm working in MapInfo. I have multiple tables with the same structure. One of my columns is pipe diameter. I ...
1
vote
1answer
24 views

CartoDB - “sql applied has errors” message - where can I see the error text?

I'm still getting my bearings with the interface it seems... When running a SQL query in CartoDB against a table... it seems like a get the correct result, but I also get a see a "sql applied has ...
1
vote
1answer
25 views

send to WFS a custom sql query using jquery

If anyone please, could gimme me a hand on this question. I have a web sql client that the user can write a sql statement and I want to sent it via WFS to geoserver, run it, and based on the results, ...
2
votes
2answers
86 views

Query for numeric field against text field that contains a numeric value

In my database, I have one field, Service_Day, formatted as numeric, which contains a single digit number 1 through 7 (for days of week). I want to compare it against another field, called Region, ...
0
votes
1answer
31 views

SQL in CartoDB to select using OR more efficiently

I made this map a CartoDB map to to show the countries that have banned their citizens working as maids in the Gulf states, I also want to show the Gulf states as one colour. I created this SQL ...
0
votes
2answers
63 views

Can I include data from multiple rows in CartoDB infowindow?

I have a visualization in CartoDB of a set of data points in table pointlayer. I am using cartodb.js and have a nice map for browser consumption. When a user clicks on a point, I'd like to run a sql ...
3
votes
0answers
85 views

Preserve datatypes when using SQLite and QGIS

Following Nathan's SpatiaLite/DBManager solution in this answer, I find that once the layer is loaded from DB Manager into QGIS (2.6.1), any calculated fields are appearing as text values instead of ...
0
votes
2answers
88 views

How to use cartodb.js without storing sql in javascript

Using cartodb.js, how can I change the layer definition without building the sql dynamically in javascript and passing it as a parameter. Aside from revealing my table structure (not a huge deal at ...
1
vote
2answers
79 views

Multi Value User Input as Variable in SQL Statement

I'm attempting to write a script that takes a user's selection as a parameter and uses that as part of the SelectByAttributes function. The parameter represents field attributes and is multi value, ...
1
vote
0answers
18 views

SpatiaLite / QspatiaLite: get subgroup row ids

I'm using QspatiaLite plugin to join polygon ids to points that are within those polygons. Now I' d like to get subgroup rownumbers for each subgroup of points with same polygon id! Like so.. grp_ID ...
1
vote
5answers
147 views

Selectively removing whitespace from a string with SQL

I have two columns of adresses that I need to join. Column 1 has the adresses formatted as "Some Street 12 A" while column 2 has them formatted as "Some Street 12A." Ie. the last whitespace between ...
0
votes
1answer
33 views

Modeling SQL Query to add statistical data to a geometry

Hello I have a problem modelling a SQL Query for the following problem: I have two tables with geometries from Shapefile der Verwaltungsgrenzen (WGS84). Of interest for me are Kreise and Gemeinden, ...
0
votes
0answers
39 views

Query for finding nearest distance and driving time from objects in a different tables

I have 4 postGIS tables: employees_wgs Facilites and (created by osm2po): at_2po_4pgr at_2po_4pgr_vertices_pgr What I want to do is: make a query to populate two columns in "employees_wgs" ...
0
votes
0answers
32 views

How to save SQL-like WHERE as .qqf in QGIS 2.6?

I used to use QGIS 1.7.4. And there was "advanced search". I can save SQL where clause as .qqf. But I installed QGIS 2.6 and I cannot find this kind of things. Could you please teach me how to save ...
6
votes
1answer
119 views

SQL “Case” statement when count(*) is 0

I am trying to write the following SQL command using case clause. with x as (select the_geom as geom from table1 where st_dwithin(the_geom, st_setsrid(st_makepoint(28.959495,41.019913), 4326), ...
1
vote
1answer
73 views

Computing intersections for each geometry in a table

I have a table with many Linestrings and for each of these Linestrings I need to figure out which other Linestrings, from the same table, intersect with it. If I recall correctly this gives me a ...
1
vote
1answer
47 views

OGROGR and SQL: unexpected reserved keyword error?

As I do the following query on naturalearth places.shp : ogr2ogr -f GeoJSON -sql "SELECT * FROM ne_10m_populated_places WHERE ADM0NAME = 'India' ORDER BY POP_MAX DESC LIMIT 1,30" places.tmp.geo.json ...
1
vote
2answers
97 views

OGR2OGR and SQL: selecting 30 biggest places from a country?

I use ogr2org to filter naturalearth places.shp : ogr2ogr -f GeoJSON -where "ADM0NAME = 'India' AND POP_MAX > 500000" places.tmp.geo.json ne_10m_populated_places.shp I would prefer to select the ...
1
vote
1answer
55 views

How to perform a calculation using attributes of groups of features in ArcGIS?

I have a table with information about 2000 aquifers (thickness, area, depth, volume etc.; there are 20 fields approximately). One of these fields is an internal code, i.e. DK_12_456_XXX; the last 3 ...
0
votes
2answers
62 views

SQL filter to show one layer only if another layer is missing

I have two oracle tables that represent buildings in my town. The first table represent buildings that are surveyed and measured accurately but doesn't cover all the parts of the town while the second ...
2
votes
2answers
241 views

Spatial join versus classical join

What are the main differences between a spatial join and a classical database join such as an equi (inner) join?
0
votes
1answer
49 views

SpatiaLite - WITH, view or sub-query?

I am running on Windows 8.1 SpatiaLite_gui 1.8.0, SpatiaLite version 4.2.0 and SQLite 3.8.5. I need to interrogate one single spatial table whith those attributes: ID | val | val_1 | val_2 | Geom ...
1
vote
0answers
19 views

Needing to find parent zip code of a bunch of missing zip codes in the US

We're using MapPoint to export zip code / territory combinations. Unfortunately, the export doesn't include PO Box zip codes which mean that we're missing a lot of zip codes The PO Box zip codes are ...
0
votes
0answers
89 views

ModelBuilder Iterate Row Selection & Variable Expected Fields in Summary Statistics

I have a model using a Iterate Row Selection. The inline variable produced by the iterator is used in the SQL expression of a Table Select tool. Note that this Table Select tool does not use the ...
1
vote
1answer
383 views

ArcMap “One or more layers failed to draw: An invalid SQL statement was used”

I created a model involving the tool Make XY Event Layer because I want to plot latitude and longitude points in CSV file columns. The model runs without errors and appears to have plotted the points ...