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

learn more… | top users | synonyms

1
vote
2answers
157 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 ...
-1
votes
2answers
113 views

Sql Query in Postgresql

I am trying to execute a query but I am stuck. I have two tables A and B. The a table has columns gid, geometry(line-string) and value which cells is empty , the B table has got 3 columns gid, ...
0
votes
1answer
759 views

How can I show numbers as percentages in CartoDB?

I would like to format numbers as percentages in cartodb. What are the best functions to display numbers with decimals, comma separators or percenteges? Thanks
4
votes
1answer
17 views

Cartodb API Read Only

Is it possible to generate an API-key in Cartodb with read-only permission? Seems like the default API-key has full controll
0
votes
1answer
35 views

GDAL -SQL or -where options

ogr2ogr -overwrite -t_srs EPSG:3978 -f "ESRI Shapefile" -sql "SELECT * FROM 'Layer Name' WHERE FIELD_NAME = 'A CLASS'" dst.shp src.shp help me out here - looking to 1) reproject a shape and 2) ...
0
votes
1answer
25 views

Where clause in MapInfo Table Updates

Is it possible to add a where condition to an update query in MapInfo? At the moment I have to do a query to select the records I need and then do an update on that query. I believe this is ...
1
vote
2answers
35 views

Inputting integer values into SQL statement using ArcPy?

I am defining a function for use in a ArcGIS tool that will verify attributes, catch errors, and obtain user input to rectify those error. I want the tool to select and zoom to the segment that is ...
3
votes
1answer
420 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 ...
1
vote
1answer
144 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 = ...
0
votes
1answer
241 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 ...
0
votes
0answers
20 views

Selecting all cells not containing a number in SQL

I have a field containing some values. In edit mode, when I click on any one of these values it gets replaced by 1.#QNAN in the cell. I would like to query the table for all cells containing ...
3
votes
2answers
534 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. ...
2
votes
1answer
37 views

Show Log of the Sql statements that QGIS generates to retrieve Data from Postgis

Is there a ways to - make QGis log its generated SQL Statement or to - force POSTGIS to log all interaction with QGIS? There is something strange happening to the WFS layer I retrieve in QGIS, since ...
2
votes
1answer
187 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? ...
1
vote
1answer
24 views

How to select from geometry column in postgresql?

I've got a table which it has a geometry column filed by some point (ex. "POINT Z (116.309627 39.991285 148)"). now I want to select point's id from the table. I wrote follow sql Code but I force an ...
2
votes
1answer
765 views

is there any direct access to Mapbox data? (similar to CartoDB's sql api)

I've been asked to add a form to a map that will write data in the background (e.g., ajax to a magic file that does datawrites and some emailing, notifications etc) and a new marker will be added to ...
1
vote
1answer
158 views

connecting cartodb to existing mysql database

I'm trying to create a simple heat map based on longitudinal and latitudinal map coordinates that can be transferred from a database on mysql that I've created. I read that cartodb can be connected to ...
2
votes
2answers
277 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 ...
1
vote
3answers
102 views

How to use STUnion with GroupBy

I'm using SQL Server 2008 R2 to store Geometry data types. I have a bunch of lines as individual features, that share common names ('NAME' field). I would like to create a view that Groups By 'NAME' ...
2
votes
2answers
55 views

how to snap points to lines in QGIS/PostGIS?

I'm attempting to snap approximately 900 points to a line table. I've tried recreating what I have found from a couple of PostGIS answers but not having much luck. To test, I've created two ...
0
votes
1answer
583 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
1answer
28 views

How to store multi-valued attributes in PostGis using Postgresql [closed]

I have a with meterid,meterreading,reader and date read.I wish to store this data using Postgis database. I used this code via postgresql to create the table CREATE TABLE MeterRdg( meterid ...
0
votes
1answer
20 views

Updating static GTFS data android

I have an android application that takes a static GTFS data that I manually turned into a database. My question is how do I update this GTFS data automatically? Or is that not possible? Any ...
0
votes
1answer
26 views

Differences between columns in MapInfo

I have two columns in a nodes table, one column has the ground level of the node taken from the model and the other column has the ground level inferred from LiDAR. Is there a query that can be used ...
0
votes
0answers
24 views

PostGIS dijkstra routing - specifying source and target as bigint instead of int4?

I'm currently working on a problem where I have to use PostGIS's pgr_dijkstra to calculate the shortest route from a starting point to a destination, and then use ST_AsGeoJSON to convert the route to ...
5
votes
2answers
128 views

QGIS expression builder include relation attributes

I have a set of symbols based on a table in postgis such as this id|type|action_1|action_2|geom In QGIS I have this table symbolised using a rule expression which works effectively. However this ...
2
votes
1answer
2k 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 ...
1
vote
1answer
1k 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
159 views

Column 'SHAPE' cannot be null in mysql database even if the query string is correct

I am trying to write an POLYGON into an column named SHAPE which is a geometry type. And created query which looks $sql = "INSERT INTO rokka(zone,district,location,area,SHAPE) VALUES ...
1
vote
0answers
34 views

Running a custom function on each line of a PostGIS table

I am trying to run a custom function on each parcel in a PostGIS table, (in this case its a function that finds the standard deviation value of the pixels intersecting a raster) Here is the code for ...
2
votes
1answer
38 views

How can I do a subquery inside a subquery in PostGIS?

I need to add a subquery to a working function. Instead of select * from table, I'd like to select * from (select * from table where height>1500) as sub, something that works in other functions I ...
1
vote
2answers
219 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 ...
1
vote
1answer
413 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
536 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
337 views

Using sql SELECT DISTINCT in Fusion Tables API

How do I go about using sql SELECT DISTINCT in fusion tables API?
1
vote
1answer
392 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 | ...
0
votes
0answers
47 views

Database connection fails when using db authentication, succeeds using OS

When i attempt to make a connection to a database on my SQL Server 2014 sever via Database connections in ArcCatalog using with db authentication i get the lovely "Connection was attempted with an ...
1
vote
1answer
25 views

PgRouting: Target vertex error

I'm trying to make a matrix that shows the cost from a node to the rest of the nodes in a network. The final result I'm looking for is not the cost, but only know if a car can or can not reach each ...
2
votes
1answer
92 views

Trouble using ST_Difference to remove overlapping features

I am trying to use ST_Difference to create a set of polygons (processing.trimmedparcelsnew) that do not contain any of the area covered by another set of polygons (test.single_geometry_1) using ...
2
votes
1answer
40 views

ST_Union based on attribute

I have a road network of center lines of MultiLinestrings.They have nodes at every intersection. I try to understand how I can merge roads together that have the same category as attribute (There are ...
0
votes
1answer
31 views

Querying a raster per pixel using a secondary raster as a condition

So here's the problem. I have two rasters containing bathymetry data: one containing the bathymetry of the sea floor, we'll call this raster1, and another containing the difference between two ...
1
vote
1answer
35 views

CartoDB (PostGIS) near function (distance) points to polygons

I have a CartoDB map here: Link: https://dms2203.cartodb.com/viz/78db6c02-3148-11e5-a42f-0e018d66dc29/public_map I'm trying to find the distance of the points to the polygon. If the points are ...
0
votes
1answer
27 views

Using ST_LINE_INTERPOLATE_POINT in OGR and python

I'm interested in finding the midpoint on a linestring using OGR and python. This can be a line with more segments. Could I use the ST_LINE_INTERPOLATE_POINT in python using the ExecuteSQL() method? ...
1
vote
0answers
278 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
59 views

What command to use in PostGIS to get same result as ArcGIS?

I have two shapefiles and i'm trying to do simple spatial analysis. When I want to know which polygon belongs to other polygon in other shapefile I always use select by location and in Spatial ...
3
votes
1answer
303 views

How to query against time using ArcGIS Desktop?

I have a date-time field in a feature class which I want to query. The field has values like "2011-01-01 00:00:29". I want to query the data between the time 00:06:00 and 00:12:00. The date does not ...
2
votes
1answer
112 views

Selecting more than one feature from raster attribute table using ArcGIS Desktop?

How do I select more than one features from raster attribute table? For example: "lc_2001" = 21, 22, 23, 24 AND "lc_2006" = 11, 31, 41, 51
1
vote
1answer
62 views

nearest neighbor query in SpatiaLite

I am trying to find the nearest line to each point in a layer, and I have over 1 million points. I want to be able to associated the closest unique line ID with the point unique IDs. I have tried to ...
0
votes
1answer
34 views

I'm not able to add SQL file to postgresql database

I started with basics and did these steps: createdb -U postgres -E UTF8 -O Peete gis -OK createlang -U postgres plpgsql gis (was already installed) -OK psql -U postgres -d gis -f ...
0
votes
0answers
23 views

SQL query on field in Oracle does not return the same values that are seen in ArcMap/ArcCatalog

This is a very bizarre issue and I am at a loss as to why this is happening. A user running queries in SQL Developer brought this to our attention, and when we tried it we ran into the same problem: ...