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

learn more… | top users | synonyms

1
vote
1answer
59 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 ...
1
vote
1answer
30 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 ...
1
vote
0answers
18 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 ...
4
votes
1answer
80 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 ...
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 ...
0
votes
0answers
36 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 ...
5
votes
3answers
91 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
31 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
104 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
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 ...
1
vote
1answer
43 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
35 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
84 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
0answers
31 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
71 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
25 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
27 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
60 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 ...
1
vote
1answer
33 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) ...
3
votes
1answer
55 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 ...
1
vote
0answers
38 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 ...
0
votes
0answers
37 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 ...
0
votes
1answer
58 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 ...
0
votes
0answers
41 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
35 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 ...
3
votes
1answer
53 views

SQL check if first value in line is number

In the layer definition query in ArcGIS 10.4 I want to only use objects that look like 1/12 Main Street 12-2 Side Street etc and not ones that have Main Street Side Street Is this possible? So ...
0
votes
1answer
45 views

PostGIS Query Geometry Field Truncated

Some of the geometry fields that are returned from my PostGIS queries are truncated. When I first found this error any geometry fields with more than a few thousand characters would not show up in the ...
4
votes
2answers
227 views

Correct SQL expression when looping different fields

I'm having trouble with the follow lines of code. Practically what I am doing is a 10 shapefile loop in which field represents the name of the field that I want to be calculated( the name differs by ...
1
vote
1answer
39 views

Loop through a list and concatenate a string in Arcpy

I'm making a program where the user enters some codes (GetParameterAsText) that are going to be used in a SQL expression to select by atributes. I tried to find similar topics but didn't find a ...
2
votes
1answer
48 views

Renaming a table in the QGIS DB Manager

When creating a PostGIS table (e.g. 'lakes') in the DB Manger a primary key ('lakes_pkey'), a index ('sidx_lakes_geom) and a sequence ('lakes_gid_seq') are also created. But when renaming the table ...
2
votes
2answers
43 views

How many query points fall within distance X to a set of LineString

I have a set of 10 query points and I want to know how many of them are with distance within at most 4 meters of any LineString in a given table. Note that if a point is within 4 meter distance to ...
0
votes
1answer
58 views

Select Layer By Attribute: SQL Expression using ArcGIS ModelBuilder?

I am currently using ArcMap 10.3's ModelBuilder. Having created a feature class of 300 zones, I would like to filter these to the 15 zones above 200 hectares in size, the model is shown below: I ...
1
vote
0answers
45 views

How do I create an attribute table in a web page from GeoServer using JavaScript?

I'm trying to create a custom web application using Leaflet and Geoserver. I've got my layers visible in a map viewer, but I'd also like to show an attribute table of the visible map layers. I can't ...
1
vote
2answers
76 views

Finding values that are different between two tables in MapInfo/MapBasic based on a unique ID

I am comparing 2 tables which are mostly the same but there have been some amendments, in effect comparing a new version to the old one and displaying all the records with changes in a selection table ...
2
votes
0answers
27 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 ...
2
votes
1answer
39 views

How to update a timestamp in SQL?

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
27 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 ...
2
votes
1answer
93 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 ...
3
votes
2answers
43 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 ...
-2
votes
1answer
42 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 ...
0
votes
0answers
20 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 ...
4
votes
2answers
141 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 ...
7
votes
1answer
151 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
1answer
248 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
37 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
42 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
1answer
29 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
0answers
47 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 ...
1
vote
0answers
23 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. ...
1
vote
0answers
44 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 ...