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

learn more… | top users | synonyms

1
vote
1answer
438 views

Using sql SELECT DISTINCT in Fusion Tables API

How do I go about using sql SELECT DISTINCT in fusion tables API?
2
votes
0answers
21 views

Write userID to field automatically every time an object is edited

Currently every user has to put his/her useriD in a field after every change made to an object in the database. This takes time and can be forgotten easily. Is there a SQL-Command giving back the ...
1
vote
0answers
11 views

CartoDB - timestamp SQL help

I've explored this forum fairly extensively trying to get answers as to why my SQL isn't working. I need help with the timestamp on a torque map. I've used the following formula, obviously changing ...
2
votes
1answer
57 views

Grouping polygons by spatial attributes

I'm working with a dataset that contains millions of polygons representing leased properties. In many cases, there are multiple polygons that are drawn on top of one another (representing multiple ...
1
vote
1answer
13 views

How to get Cartodb.js to use https?

I have a simple SQL query from my Cartodb account to populate a chart. Here is the link The chart works fine outside my company on a public network but I keep getting the following error when ...
8
votes
3answers
3k views

Label points at regular intervals using ArcGIS for Desktop?

I'm working with lines on roads represented by a large number of sequencial points. Since labeling all of them would make the points impossible to identify, I'd like to know if there is a way to label ...
7
votes
1answer
126 views

Join by attribute / spatialite with SQL / left outer join in QGIS

I have a layer with polygons (let's call it "woods") that is intersected by "n" line-objects ("roads"). Every road has an unique attribute roadid. I need to add ALL the roadid's (not only the first ...
3
votes
2answers
39 views

replace records in layer with records form another layer by id and column name QGIS

I have a two polyline layers - one with 2800 rows, the other with 150 rows. Each row has a unique id column. I need to replace the records in one column of the the 2800-row layer with the records ...
3
votes
1answer
449 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 ...
2
votes
1answer
532 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 ...
0
votes
1answer
424 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 ...
-2
votes
1answer
32 views

How much RAM do I need per SDE DB [closed]

Estimating RAM required is never a fixed number. However, there are base figures to follow for example for arcgis server services. How much RAM do I need to plan per DB? I'm using SQL Server but ...
4
votes
2answers
66 views

In terms of SQL, what exactly is Query Layer's “Unique Identifier” doing?

When you make a link with a database using Query Layer in ArcMap, you must select a Unique Identifier, which ensures that the resulting Layer only has unique records in the Attribute table. In some ...
5
votes
2answers
921 views

How to run custom queries on vector layers and display results?

Is there a way to display the result of a query in QGIS? For instance : To get the total number of inhabitants : SELECT SUM( inhabitants ) FROM countries To get the total density : SELECT ...
0
votes
0answers
6 views

Null output from Transform function of Spatialite

I am using Spatialite, an extension of SQlite and I have some problems running the transform function. According to the Spatialite functions page ...
3
votes
1answer
74 views

Running PostGIS ST_ClusterWithin on large dataset?

I am trying to use the new ST_ClusterWithin in PostGIS 2.2 to help me aggregate building polygons that are within 5 metres. The source data has > 13million polygons. I ran the following query on a ...
3
votes
1answer
32 views

How to replace a directory using QGIS Field calculator?

I have a column called Hotlink full of incorrect directories and I need to edit them. They currently read C:/ABCD/filename.pdf and I want them to read C:/Maps/ABCD/ABCD/filename.pdf The script I'm ...
2
votes
0answers
33 views

Using Make Query Table to join featureclass with table using 2 fields

I would like to join a forest density table to a forest ownership featureclass in a geodatabase based on two columns in each (TPO_Owner and County_Nm) so I can populate the Density column in the ...
1
vote
2answers
219 views

Query to find all lines connected to other

I have problem with one spatial (Oracle) query. Simplified overview of the problem is: I have two tables: CREATE TABLE thin_lines ( id NUMBER PRIMARY KEY, geom SDO_GEOMETRY), color ...
2
votes
1answer
345 views

How to make SQL definition query in ArcGIS to show only unique values (hide duplicates)?

I have a vector file with field of type LONG. Some values of this field are duplicates. Is it possible to make such SQL definition query in ArcGIS 10.3 to show only unique values without duplicates? ...
2
votes
1answer
181 views

Conditional SQL Query

I've been running a code that searches a desired field in a feature class and performs an specified SQL query based on whether the field is string or double. The variables are just temporary fillers ...
1
vote
1answer
24 views

Selecting the minimum point in a polygon

I am attempting to find the minimum point value within a polygon using ArcGIS 10.3. I have two datasets: 1) A series of polygons & 2) A series of points scattered about. After selecting a given ...
2
votes
1answer
555 views

Spatial joining syntax

A standard PostGIS point-in-polygon query might look like this. (example tutorial) SELECT p.*,b.polyname FROM points p, shapes s WHERE ST_Within(p.the_geom,s.the_geom) Imagine this was not a ...
2
votes
1answer
2k 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 ...
3
votes
2answers
1k views

Deleting records from multiple, similar feature classes by attribute values using SQL statement in ArcGIS Desktop?

I have several hundred geodatabase feature classes which all have the exact same fields. I need to go through each of those feature classes and delete any records which match an SQL query (the same ...
1
vote
1answer
226 views

How to query the data using SQL in the infowindow of CartoDB

I want to use a SQL join to merge data from 2 tables and display it in the info-window. When I give my query Select table_2.hos_name,table_2.revenue from table_1,table_2 where table_1.area_name = ...
2
votes
4answers
1k views

Finding center point of MULTILINESTRING using PostGIS?

How to find the center point of MULTILINESTRING, which lies on the multiline? I am using SQL in PostGIS
2
votes
0answers
35 views

How can I convert a shapefile from a single line segment to separate side segments using PostGIS?

I have a shapefile (STC) which is a single line segment per street with information for both the odd and even sides of the street. This .shp file has to be converted to separate side segments. To do ...
29
votes
11answers
17k views

How to connect to PostGIS database from ArcMap?

How can I connect to a PostGIS database from ArcMap? Solutions for ArcGIS 9.3, 10.0 and later are acceptable. Ideally, I would like to be able to perform spatially enabled queries and receive the ...
0
votes
1answer
827 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
0answers
15 views

Subset of spatial data causes slow SQL Spatial STIntersects

I've been having an issue were a specific subset of data causes an SQL spatial intersect to run extremely slowly. I am running sets of 1000 points against a subset of polygon layer to be intersected. ...
2
votes
1answer
56 views

Creating SpatiaLite View in QGIS?

Using these instructions (there are several other examples to find, all look the same and all of them seem to work) http://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/sp-view.html "Hand-writing ...
1
vote
2answers
303 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 ...
2
votes
3answers
920 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?
1
vote
1answer
698 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 ...
1
vote
1answer
148 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 ...
1
vote
0answers
24 views

How to access a feature by specific field value using python ogr in an efficient way?

I have one point layer and one polygon layer with a common identifier attribute field called "N", same objects amounts but Feature IDs (FID) are different. I have to iterate on the first one and what ...
5
votes
2answers
80 views

How can I cluster all points in a postgis table together based on their distance from each other?

I have a PostGIS (in postgres 9.3) table which has Points. I want to figure out the "clusters" in the data. If 2 points are < X distance apart, they should be added to a cluster, and this should be ...
1
vote
1answer
23 views

PostGIS update statement returns wrong information

I have two tables in postgis with polygon data. Both are in wgs84. I want to update a column (column1) in the one table (table1) with information from a column (column2) in the other table (table2), ...
4
votes
1answer
67 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 ...
0
votes
0answers
43 views

Convert XY to Lat Long using SQL?

My organization is creating a 311 mobile app. The backend is all run through SQL and report emails are generated. We are grabbing the xy from the app and then want to translate it to Lat/Long to be ...
1
vote
0answers
28 views

How to transfer SQL variable back into ArcPy script?

I am trying to teach myself to access sql tables from an ArcPy script as part of a larger QC process. I am fairly certain that I have the sql statement correct (it works in SQL Server, albeit ...
18
votes
6answers
4k views

PostGIS: Select features that do NOT intersect

This seems to me like such a simple question (and it probably is) yet I cannot seem to find an example that gives me the answer. Using PostGIS, I just want to select points that fall outside of ...
0
votes
1answer
191 views

WMS layer connected to SQL database

It is possible to connect a WMS layer to a SQL database or other type of database? Example: I have created an application with Geoserver and OpenLayers. Now I can see the data from attribute table. ...
1
vote
3answers
179 views

ST spatial queries to select multi-level location

I'm trying to write a query in SQL Server using 1 set of points and 2 sets of polygons. The polygons overlap, and I only want to select the points that fall inside of 1 polygon but not the other. I ...
2
votes
2answers
3k views

Formatting SQL queries for use in Arcpy?

I have to make an SQL query on a column having not adequat name "type_borne_id", I couldn't make SQL queries using arcpy.Select_analysis neither selectbyattribute, but when I use select_analysis ...
6
votes
3answers
78 views

Select all polygons that are completely within a circular buffer

I made several buffers around some points. Now I want to select all polygons that are completely within this buffer. My problem is that I also get the polygons that are partially outside of the ...
4
votes
2answers
6k views

How to get the data type of each column from a postgis table

I need to get the column data types of all columns in a table, including the geometry types. What I wanted to know is if there is a function or SQL that gives something like this: column_name | ...
0
votes
0answers
4 views

SQL current timestamp [migrated]

I have made a featureclass for a utility company where they can register measures set up to mitigate problems with rats, called "mitigation measure". From this feature class it is possible to state if ...
0
votes
0answers
19 views

How to find Nearest point on line from a point cordinate in SQL server

I want to find out the nearest point on my road network which is a multiline string from a point with lat lon value. The below code I have tried for finding buffer distance line from a point. ...