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

learn more… | top users | synonyms

1
vote
2answers
41 views

Counting points within range using CartoDB?

I have a dataset of users location and want to assign per user how many other users they have within a given range, and updating this value into a table.The dataset name is "users_20160410" and the ...
3
votes
1answer
97 views

What exactly does “enable geodatabase” perform on a SQL database

This is for those extra technical folks out there. What does "enable geodatabase" do to the structure and capabilities of a Microsoft 2012 SQL database. Since I'm a GIS guy and not a SQL guy, I need ...
0
votes
0answers
12 views

Date Query 10.3 SQL SDE vs FGDC

I have a date field "FIRE_DSCR_DT" that I want to query for a specific month(s). For example,I want to get all of the records where the month = January. This query did not work in SDE, but it did ...
2
votes
1answer
30 views

Is there a way to avoid the re-calculation of the same centroid without creating a new column?

All tables contain polygon geometries. SELECT * FROM table1, table2, table3, table4 WHERE st_contains(table2.geom, st_centroid(table1.geom)) AND st_contains(table3.geom, st_centroid(table1....
0
votes
0answers
36 views

Insert UTF-8 characters to CartoDB database

I'm using Cartodb.js and API to insert strings from jquery variables to my dataset table in Cartodb. //Store variable data.location = $('#location').val(); //Insert to SQL var SQL = 'INSERT INTO {{...
4
votes
1answer
1k views

PostGIS intersection function

I have a problem with intersection function. I built my query following http://manual.linfiniti.com/en/postgis/geometry.html, 5.7 section. I made my clip object, a red linestring frame: But after ...
0
votes
2answers
36 views

How to avoid manually typing coordinate information in CreateCircle function to select points in Mapinfo

I have a bunch of data points, each of them have a coordinate information (longitude, latitude). I am using CreateCircle( x, y, radius) function to select points within a distance to the chosen point....
0
votes
1answer
57 views

ogr2ogr - Clipping postgis and creating geojson

I'm trying to create a geojson file data based on data from my local postgis database using ogr2ogr. I'm trying to clip to a specific area and when I start to run the command, everything starts fine, ...
3
votes
1answer
1k views

calculate value using maximum value from different feature class

I'm trying to get the maximum numeric value from one feature class and use that value in an expression to calculate values of a different feature class. fc2.bldg_id = max(fc1.bldg_id)+1 Can this ...
1
vote
0answers
34 views

How to upload data from QGIS to a SQL Server?

I'm new at QGIS. I'm wondering if there's a native way or plugin to allow me to upload a shapefile into my SQL Server directly from QGIS. So far the only solution that I could find is the Shape2SQL ...
1
vote
0answers
20 views

Configure new SQL view doesn't appear for different DB's in the same PostGIS Database

I have PostGIS Database with different DB's. Each one of them has different workspace:store in Geoserver. When I'm opening Create new layer page and picking different workspace:store for some of them ...
0
votes
2answers
111 views

MapBasic - Updating blank rows in column with the value above

I am writing a MapBasic tool to correct some incorrect values in a set of tables. So far I have managed to pull out the values I need in a new column: What I need is to update any blank rows in the ...
1
vote
2answers
53 views

Conditional “On the Fly” Column with PostGIS

I have two tables I am working with; tl_2015_us_county which consists of county polygons, and tl_2015_48_puma10 which consists of PUMA polygons. I am currently using the below SQL in order to achieve ...
4
votes
1answer
111 views

Using Not Equal to Wildcard in ArcMap Definition Query?

I'm attempting to use a definition query in order to display only a subset of data. I have a large CAD drawing that I have imported into my map. I do not need many of the lines from the .dwg file to ...
1
vote
0answers
82 views

Cursor help on large spatial query in PostgreSQL

I have two very large tables on which I want to perform a spatial query. UPDATE table_a SET att_1 = b.att_1, att_2 = b.att_2 FROM table_a AS a JOIN table_b AS b ON ...
4
votes
1answer
98 views

Selection by attribute string in ArcGIS 10 with wildcard as part of the name

I have an attribute field in my file geodatabase (GDB) where I'm trying to select all records that contain an underbar in the string field. The issue is that the underbar is considered a SQL wildcard ...
1
vote
1answer
80 views

Change SRID of geometry column

I have in my table column geom with geometry, data type of this column is geometry(Point,102067). I want to change SRID from 102067 to 5514, but if I use this command select UpdateGeometrySRID('...
1
vote
1answer
31 views

Points to polygons transform, inserting columns

In this task I'am transforming points to polygons. I have table POINTStbl with four columns: ID, YEAR, CODE, POINT and i need to create table POLYGONStbl, where will be three same columns(with same ...
3
votes
1answer
31 views

Assigning the modal average based on points within a polygon

I have two layers: Survey Points Habitat Multi polygon The Survey points contain the field sensitivity I want to assign a number to each polygon based on the modal average sensitivity. This ...
1
vote
0answers
20 views

CartoDB geom (coordinates) join: without exact match

Trying to join two datasets (layers) on CartoDB based on their geographical fields (in CartoDB's the_geom created field). However, the basic ST_Intersection function does not work since its tolerance ...
0
votes
0answers
40 views

Updating attribute table by CSV in ArcGIS for Desktop?

I have a File Geodatabase in ArcGis that contains shapefiles and tables. The tables must be updated using CSV or Excel files. The structure of the existing tables and the update csv will be exactly ...
6
votes
1answer
2k views

ogr2ogr selecting features by attributes

I am writing a shapefile after some processing; however, in the final step I need to do some selection by attributes from the the shapefile. I am using the command in a shell with the aim of using it ...
5
votes
3answers
100 views

Limit to number of items using 'IN' SQL syntax in arcmap/arcpy?

I'm writing a python script that uses 'NOT IN ('a', 'b', ...)' statements on very large lists (like comparing 500 items in one feature class against >10k items in another) and am getting weird ...
0
votes
1answer
49 views

Deleting from a view. Mapbasic

I'm using MapBasic and have used a query to get the rowids (populated in a column) of minimum values Select SUBSECT_ID, Row, Min(MaxLV)from LVQuery group by SUBSECT_ID into MinLV Now, I want to ...
1
vote
1answer
106 views

SQL statement to find differences between two fields

I am trying to find the difference of 11 feet or more between two fields (Both are Double types). For example, I have a field called shape_length and another field called station_length and I want to ...
0
votes
1answer
91 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. ...
1
vote
1answer
46 views

Using output feature class field values in SQL query in model builder

I have two processes in model builder: Iterate over a "ID_SPATIAL" field values = creating a subset of original feature class (and agregating using Frequency tool) Creating a different subset using ...
0
votes
0answers
37 views

Storing Select Statements for ArcGIS Query Layers: LYR Files vs Views vs Application Code

I've inherited maintenance of an extension to ArcGIS Desktop (ArcObjects, C#) that allows users to view spatial data and related attributes from our databases (SQL 2008 R2). This is of course ...
0
votes
0answers
76 views

Geoserver slow when using sql server and cql_filter

Im using geoserver 2.7.2. with layers in postgis and sql server. Postgis layers is fast and have no problem at all. Layers in sql server is okay until I use a cql_filer - it goes from quick to ...
2
votes
1answer
103 views

SQL / Select by Attributes query for “does not include text found in another specified field”

I'm using ArcMap 10.2 and I'd like to write a query to select features where Field A does not include text found in Field B. Specifically, Field A contains street numbers and street names. Field B ...
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 ...
2
votes
0answers
35 views

Where do field aliases reside in an SDE database?

If I want to get field aliases for an SDE table through pure SQL, what table do I query? My geodatabase was created with ArcGIS 10.1 in an Oracle database.
5
votes
1answer
83 views

Creating ArcPy scripting tool with dropdown box for sql expression choice

I am creating an ArcPy scripting tool to allow users to select a feature from a feature layer and then zoom to that selection. I have successfully created this tool and now am working on creating the ...
0
votes
1answer
31 views

ST_Union returning Null with Spatialite, even after ST_MakeValid

I am attempting to run ST_Union on some features in a GROUP BY Spatialite query, with the aim of counting the number of features, and the total area of those features, which may overlap so should not ...
1
vote
1answer
29 views

Parting lines based on intersection with polygons

I have two tables: roads containing one row (line) for each road with column road_code uniquely identifying the name of the road; districts containing one row (polygon) for each district with column ...
1
vote
1answer
81 views

Cartdodb change public map in real-time with SQL query

I'm a data science student working on my capstone project. I'm new to CartoDB and have been playing around with their API a bit but can't seem to find what I'm looking for. I have created a public ...
10
votes
2answers
15k views

Converting MultiLinestring to Linestring with PostGIS?

I have a multiline string and want to convert it to a linestring in order to use some functions that only work with linestrings. I used ST_Dump() and got a collection of my geometries. If I merge them ...
2
votes
1answer
106 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
38 views

Truncate a Shapefile field with SQL and ogr2ogr

I want to create a new attribute which is the first 8 characters of another, using ogr2ogr. To my surprise, this didn't work: ogr2ogr -f "ESRI Shapefile" a.shp b.shp -sql "select FID,left(FLOORKEY,8) ...
0
votes
1answer
81 views

Storing metadata of various services according to ISO 19119?

I need to store the metadata of web services according to ISO 19119 standard. Hence I am looking for some guidelines for designing the database for storage. Can any one suggest any document to help ...
3
votes
0answers
542 views

How to export data from sql server into shapefile in the decimal format in QGIS 2.4?

The last couple of days, I have been working on exporting data from SQL to a shapefile in QGIS 2.4. While converting into a shapefile, the data type changes automatically from Float to Integer in the ...
0
votes
0answers
75 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 ...
1
vote
0answers
44 views

CartoDB: how to let users update data from the map infowindow [closed]

In cartoDB, I have a map showing public lands in a German city. I want to integrate a form into the cartoDB infowindow to let the user update the data table. How can I pass the values from the form ...
3
votes
1answer
77 views

Data Insertion from .CSV file to a Feature Class attribute Table in ArcGIS for Desktop?

I am working on water network in ArcGIS 10.2. I am trying to insert data from a data.csv file to an existing feature class House Meter in personal GDB. One method I know to use is the join data.csv ...
0
votes
0answers
38 views

MAX value in SQL

I have used a variation of this sql statement successfully in the past but can't get it to work now. I have a table named "RS_Event_All_NE_25_Weekdays" in a personal geodatabase running on arcmap 10.2....
2
votes
1answer
233 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 ...
0
votes
1answer
65 views

CartoDB - PostgreSQL row_number() using PostGIS ST_Distance

I'm currently working on a query that should return a subset (i.e. "new") CartoDB table sorted by proximity to a given point. I want to display labels on the map corresponding to the closest, second ...
2
votes
2answers
302 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 VARCHAR2(32)...
0
votes
0answers
49 views

SQL script for postgis column name with colon

I have an sql script that creates some tables from the default planet_osm_point, planet_osm_line, planet_osm_polygon tables which are created with the osm2pgsql command line tool. DROP TABLE IF ...
1
vote
1answer
40 views

Cartodb sql not executing

I am a beginner, learning the cartodb-API. below is my javascript code which is below my body tag in the HTML page. The map, together with the points are loading correctly but the SQL command is not ...