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

learn more… | top users | synonyms

4
votes
1answer
498 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 (...
3
votes
1answer
23 views

Is there a SQL Server package similar to Oracle's SDO_CS?

I see that Oracle's SDO_CS package is able to do datum transformations. I'd like to do datum transformations in SQL Server. I searched, but have not found something like this for SQL Server. Is ...
0
votes
0answers
25 views

Selecting only time in datetime field

I have a 'date' field (is a date field) in ArcGIS that contains both date and time: 'mm/dd/yyyy HH:mm:ss' and need to query only the time portion regardless of the date. I need times between >= 09:00:...
1
vote
2answers
186 views

Cartodb - Error: sql is read-only in NamedMaps

My map is not a named map. Map privacy is set to only people with the link. Why I I getting this error when trying to do queries? Has anyone else run into this?
3
votes
1answer
843 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
19 views

Error on join in ogr2ogr

I am doing an ogr2ogr process where i will be making a join between two tables, imported as shapefiles and .csv to join on a column with idential attributes. The code i've made so far looks like ...
1
vote
1answer
30 views

Random Selection using Select By Attributes tool in ArcMap?

How I can make a SQL syntax to generate "RANDOM SELECTION" in Select by attributes tool in ArcMap?. E.g. We have two kind of sample: Quantitative an Qualitative data. Quantitative (seven cases): 1,...
1
vote
1answer
101 views

Updating static GTFS data android

I have an android application that takes a static GTFS data that I manually turned into a database. How do I update this GTFS data automatically, or is that not possible?
0
votes
0answers
7 views

How to filter two layers from drop down menu cartodb.js?

I am very inexperienced with Javascript. I already have a script to query a table column to auto populate a drop down menu and query the polylines based on multiple selections as attached below. I ...
1
vote
2answers
90 views

SQL query new feature with loop

I'm trying to create an individual buffer feature class for each column of an input feature class, where there is a field that contains the buffer distance. I think there is a problem with my SQL ...
0
votes
1answer
524 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
661 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
1k 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 ...
0
votes
2answers
27 views

How to obtain Census block data in SQL format?

I am trying to create a web app where users can query a certain type of data that is offered by the Government. Unfortunately, the government prefers "Census Tract/Blocks" as opposed to Zip codes (it ...
1
vote
1answer
192 views

Select ID by most recent date

I have a personal GDB table that has a non-unique SLID field and a date field. Basically there are multiple records with the same SLID numbers but different dates. I want to select only the most ...
9
votes
3answers
3k views

Getting list of distinct values from shapefile field using QGIS?

I have a shapefile whose features I can filter by specifying a where clause in the query dialogue. F.x. I have a field named 'city_name' and by stating 'city_name = "London"' in the where clause only ...
5
votes
2answers
9k 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
1answer
18 views

How find Nearest points using STBuffer and STContains in SQLServer using given point from point table?

This is the Query I am using now.. SELECT top 1 coloumname FROM tablename WHERE ROUND ((geometry::Point(74.8427116215336,12.852857058953,4326).STDistance(the_geom))*111.325,2) <2 ORDER BY ...
1
vote
1answer
289 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 = ...
1
vote
1answer
19 views

How to update a line attribute in PostGIS using an attribute from the polygon in which it is contained?

I have a road dataset which I want to update using the speed information from the state polygon in which it's contained. for all roads (line) within a state (polygon) if the road speed is null road ...
2
votes
1answer
53 views

Query over all layers in a mxd Arcpy

A newbie to python here. Ive been trying to query all layers on a mxd and have sucessfully implemented a script by advice on here. What I need to do now is to firstly make the query a parameter that ...
4
votes
2answers
210 views

Sql syntax in Model builder

In ModelBuilder I am trying to perform the following query, using the select by attribute tool. I am having great difficulty with the sql syntax. What I am trying to do is Select Top 3 (Avg) Price, ...
0
votes
0answers
29 views

Creating Database View using ST_Buffer

I am trying to understand how to create a database view that shows a 150 foot buffer around each point in a table. The table of points changes pretty frequently and I would like to use a view instead ...
2
votes
0answers
20 views

SOL help in QGIS: rule based styling to show timestamp increase via gradient

I have some polygon data from a tractor that shows it's route among other things. It has a timestamp column which I'd like to use to show the route in which the tractor drove through the field via a ...
1
vote
0answers
47 views

Getting H2GIS functions to work in Spherical Space?

I've been playing around with H2GIS (http://www.h2gis.org/) for a project at work and am struggling to get the H2 functions to operate in spherical space (lat/ lon), rather than cartesian space. The ...
1
vote
0answers
27 views

PostGIS Nearest Neighbor query performance - can it be quicker?

I want to canvas the community to see if my nearest neighbor query can be optimized at all. I am happy with my current results, but I'm always up for improving. I have 2 tables, lakes and towns. I ...
2
votes
1answer
418 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
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 ...
0
votes
0answers
28 views

Define points within multiple lines

I have points set in certain radius. I want to define points within certain lines which represent natural and structural borders (streets(red), rail road tracks(green), water barriers(light blue), ...
1
vote
3answers
37 views

ArcGIS Dissolve/SQL group by

I have a GIS layer that has thousands of Facility IDs. For each Facility ID there can be multiple Chemical ID's. For each chemical ID there is a maximum of 3 zone types. Zone A, B, C. But there is not ...
0
votes
1answer
254 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. ...
0
votes
1answer
39 views

How to create a line into a table in Postgis?

I need to draw a line and create a new entry on an existing table in Postgis. Say I have a table called myTable and two points with coordinates 528115,181037 and 528115,181037 using the EPSG:27700 (...
1
vote
2answers
181 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 ...
0
votes
2answers
34 views

Arcpy Select by attributes IN operator with Tuple

I have two layers 1. Buffer zones with a string ID 2. the same buffer zones with the String ID plus an extra field call it zone B *this process is taking place within a loop already, just to give ...
5
votes
2answers
88 views

SQL MAX Subquery in arcpy.MakeFeatureLayer_management

I am having an issue with subsequent subqueries in making a feature layer in arcpy. My table has fields: OBJECTID, pointid (long), grid_code (double) I can successfully extract MAX(grid_code), ...
1
vote
3answers
214 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 ...
1
vote
1answer
63 views

In Postgres how to create columns with geometry?

I have point data stored in the postgis server and I need to create a new table with their geometry values. How can I extract their coordinates and translate them into a table. Something like: ...
3
votes
1answer
50 views

Creating one layer through use of SQL queries for land use categories

I have a map with about 63 grids and trying to determine the land cover user category of the greatest area size in each grid. The land cover categories have been converted to polygons and I already ...
5
votes
3answers
21k views

Using String Functions (LEFT, RIGHT, MID) in Select By Attributes against a File Geodatabase using ArcMap 10

I finally (albeit reluctantly) made the switch from a personal geodatabase (pGDB) to a file geodatabse (fGDB) not too long ago. The main reason it took so long to switch has to do with how Select by ...
3
votes
1answer
35 views

Performing selection on Attribute and Location of two different feature classes using ArcGIS for Desktop?

I have a point FC and a Polygon FC. Both FC have the attribute VILLAGE. The point with Village = 1500 should be completely within the Polygon with Village = 1500. How can I make a selection not only ...
1
vote
2answers
42 views

Convert colum type in PostGiS via DB Manager/ SQL in QGIS

I have a csv file that I want to bring into a PostGIS database through DB Manager in QGIS. I have a column/ field called "Location" that contains geometry (e.g. (40.789423 -75.628493 232....
4
votes
2answers
1k views

Select by attribute expression invalid in python

I'm not sure how my expression is failing. Any ideas? inPoints = "points.shp" i = 0 arcpy.MakeFeatureLayer_management(inPoints, "pts") arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", '...
0
votes
1answer
45 views

select neighbour polygons in sql

I have a database of few milion records (all houses in my country). Now I want to select all records who have a neighbouring record (a house next to it) and give this a status 'T'. Each record has a ...
1
vote
0answers
13 views

Append object from another layer to the new layer through form (drop-down list)

I'm trying to get to know is it possible to append object from another layer to the new layer through form (drop-down list)? Do I need to create an application? If yes please tell me what language ...
3
votes
2answers
46 views

Polygon another location

Using google maps I have located 4 points and have created a polygon with them in this way insert into dummy_zip values (4,'prueba_directa','2016-04-13 08:08:15.973731','prueba_directa',1,1,100,'2016-...
1
vote
1answer
51 views

Recurring SQL Expression Parsing Error on Query Builder

I am using Query Builder in QGIS 2.14.2-Essen to select one country (Peru) among 237 for which to show two layers (states_provinces, boundary lines) from the Natural Earth database. I am paying close ...
0
votes
0answers
55 views

Why does ST_Area in SQL give a different value to $area in QGIS?

The area value I'm getting using the SQL term 'ST_Area' is markedly different from that gained from QGIS functions like $area, the area measure tool and area as a derived feature (all of which agree ...
3
votes
1answer
60 views

How to use a polygon as a reverse cookie cutter on features in a Postgresql database

I want to be able to use a polygon in a database to remove all features and parts of features that falls within the polygon. Not as part of a query transferring the database to another database. I ...
3
votes
1answer
88 views

How to loop in PostGIS to add the next lat long to a route

I want to loop over the results of a query and then pass row(n)'s longitude, latitude and row(n+1)'s longitude and latitude to another function. I have a query which returns a set of coordinates from ...
1
vote
1answer
43 views

Postgres st_intersection points/polygon

I am trying to use the ST_Intersection function to intersect points by county and find the counts by county, but I am having no luck. SELECT counties.name, FROM counties INNER JOIN routes ON ...