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

learn more… | top users | synonyms

0
votes
1answer
5 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
294 views

How to create a search box and SQL statement for searching an attribute field?

How can I add a HTML search bar that the user can use to search an attribute field for a polygon layer, and then tie that input into the SQL statement? So far I am able to hard code the query of ...
0
votes
1answer
303 views

SQL Geometry Query similar to Select by Centroid

Does anyone know if it's possible to query SQL geometry by something like 'centroid of polygon'...similar to ArcMap's select by location? I'm using SQL Server 2008 R2 as the DBMS. I have two polygon ...
1
vote
2answers
457 views

Function for Selecting Points in a Polygon

I've been banging on this for a few hours, but since I'm relatively new to PostgreSQL and PostGIS, I can't find the solution. I'm trying to create a stored procedure (function) which will return all ...
1
vote
1answer
13 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 ...
0
votes
0answers
7 views

Creating Temp Table in SQL

I am trying to understand how I could make my Temporary Table Ambiguous instead of having to write out all of the different combinations within my data: Declare @Year as Integer Declare @LastYear as ...
1
vote
1answer
120 views

SQL-query should return GeoJSON FeatureCollection

I'm trying to return a GeoJSON FeatureCollection object from a SQL-query with PostgreSQL 9.3 and PostGIS 2.1. This is my query so far: SELECT row_to_json(fc) AS p FROM (SELECT 'FeatureCollection' ...
0
votes
1answer
190 views

How do you create a CartoDB viz with a dynamic SQL statement?

I want to create a CartoDB viz where the where parameter in my SQL statement changes dynamically at runtime. When I share my CartoDB viz from the dashboard, I can't help but notice the the SQL ...
1
vote
1answer
17 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, ...
1
vote
1answer
250 views

How to import .csv file to CartoDB using SQL?

How to import .csv file to CartoDB using SQL, the data given below : POINT | TOP_dm | BOTTOM_dm | X_RD | Y_RD 35AP7600 | 4418 | 4368 | 262053 | 467223 35AP7601 | ...
2
votes
2answers
52 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
2answers
24 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 ...
0
votes
2answers
42 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 ...
0
votes
1answer
24 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 ...
1
vote
2answers
49 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, ...
2
votes
2answers
778 views

How to convert Geometry type column to degree Minutes Second in SQL Server 2008 R2

I have shape column of type geometry and I want to convert X and Y coordinates into Degree Minutes Second format using SQL query and i am using sql server 2008 R2. Currently I got Lat and long using ...
0
votes
1answer
161 views

Geometry datatype to latitude /Longitude MS SQL Server

I need to convert Sql Server geometry datatype to latitude /Longitude I have just imported a shapefile to my table (geometry) This query does not work:- select geom.Lat as [Latitude], ...
3
votes
0answers
69 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 ...
2
votes
2answers
163 views

Selection subquery using another table in database ArcGIS

I need to 'extract' a list of variables based on the IDs from another table. Using a subquery seems to be the best method. I have a large list of variables and have outside calculated a second list. ...
1
vote
2answers
121 views

adding geometries to a source, target table for multiple rows in pgrouting

I am having an issue trying to perform the pgr_dijkstra algorithm and getting back a line in my table for multiple rows. I have a table that has a columns of source, target node id's but I cannot ...
0
votes
1answer
46 views

Get a sql view to persist in a CartoDB visualization

I'm new to CartoDB and so far impressed. But I'm struggling with how to get a sql query to persist in a visualization. I type it in, like 'SELECT * FROM env_feedlots where active = 'Y' and BIRDS > 0', ...
1
vote
0answers
13 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
94 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 ...
2
votes
1answer
339 views

SQL Server UNion of geography feature returns FULLGLOBE result?

I have some trouble with sql server 2012. I store coordinates of french cities in my database as geography object (with ESRI 4326) and i want to make the UNION of some cities. I have in result ...
4
votes
3answers
287 views

Maximum length of WHERE clause with IN statement

I need to get all features from feature class where their field value matches to input array. To achive this one may set IQueryFilter.WhereClause property similar to 'FIELD_NAME IN (array[0], ...
1
vote
1answer
109 views

Trying to use SQL API from Oracle PL/SQL to CartoDB

I am trying to make an http call from within an Oracle server to CartoDB. To do so I have developed a custom PL/SQL package that will generate the SQL and make the calls. A sample API call is below. ...
2
votes
3answers
2k views

Trigger on SQL Server 2008 ArcSDE 10 and ArcGIS Server 10

I need to build a sql server db trigger to update a date field with the current date when a record is inserted or updated, I think. I will be using the date field as a way to recognize ...
1
vote
1answer
730 views

Trigger a python script to run after a row is added to the feature class

I have a Python script which runs on a SDE feature class daily (as a scheduled task). I would actually like this script to run whenever a new row is added to the feature class (data is captured in the ...
3
votes
1answer
253 views

Triggers for delta tables

I have been facing an issue to capture the delta updates on SDE. We have written triggers on A and D tables to capture the delta updates(to capture the version name based on state id's), however I ...
0
votes
1answer
26 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, ...
4
votes
3answers
4k views

ArcGIS - Create a join based on multiple fields

I have two feature classes in a File Geodatabase that I would like to join based on multiple fields. I've searched this site and Google and all I have come up with was to use the Make Query Table ...
0
votes
0answers
23 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" ...
2
votes
2answers
138 views

Finding Polygons which do not touch any other polygon in a single oracle database table

I currently have an oracle table of approximately 100,000 records - all of which are polygons. I want to find all the polygons which do not touch any other polygon within the same table. There are a ...
0
votes
0answers
25 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 ...
5
votes
1answer
89 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
62 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
49 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 ...
1
vote
2answers
79 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
39 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 ...
3
votes
1answer
610 views

Cartodb - SQL query of public visualization of a private table

The team at CartoDB have recently(last few days) made some useful updates that now allow public visualisation maps to reference data in private tables. The change has only been made in the last day ...
3
votes
1answer
265 views

Python SQL connection causes crash in ArcMap

I have the following code which I have striped down to just included the part that is causing a crash in ArcMap. import pymssql # Connect to the Research db using Windows Integrated Authentication. ...
0
votes
2answers
57 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
212 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
40 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
14 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 ...
5
votes
2answers
80 views

How to draw radius of a circular point buffer using PostGIS

I have generated circular buffers of points in a shapefile. The generated circles and points share a common ID/key, say pt_id. My question is Is it possible to use PostGIS to generate a third layer ...
1
vote
1answer
526 views

How do I insert a geometry as WKT to SQL Server Spatial with PHP?

I have a web mapping application built on Bootleaf (Leaflet + Bootstrap). Using the leaflet Draw plugin the user can create a polygon on the map. I'd like to insert that polygon into a geometry ...
0
votes
0answers
71 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
0answers
131 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 ...
4
votes
1answer
85 views

SQL-query in arcpy - SELECT WHERE feature between two values

I need to select features between two values in python with arcpy. However, whenever I try to run the code below, it returns with error message "An invalid SQL statement was used". whereclause = ...