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

learn more… | top users | synonyms

1
vote
1answer
23 views

Does CartoDB support the SQL MERGE command?

I am developing a mechanism that uploads records to cartodb - first by importing the records to a new table, and then insert the records from the new table to an existing table. The problem is that ...
1
vote
1answer
23 views

SQLite db with FDO geometries: how to assign ID of point in layer A to closest point in Layer B with SpatiaLite?

How can I assign ID of point in layer A to closest point in Layer B with SpatiaLite (find nearest neighbors for each point in A)? For each point stored in table fdo_fc1 I would like to select one, ...
1
vote
1answer
22 views

POSTGIS query - extracting common point from polygon data

I have a polygon dataset and need to find the single common point where 3 polygons meet. I'm approaching this by creating duplicate tables and comparing them to the main one (polygon_table a). I've ...
0
votes
0answers
25 views

Get next point horizontally and vertically

I am working on a map application. We have to draw polygons for different sections. Each section is either a square or a rectangle. Data that I have has less than 4 coordinate points, insufficient to ...
4
votes
2answers
158 views

ArcGIS Model isn't accepting my SQL Query

I'm running a model that breaks a dataset into several dbf tables based on a query. However, only half of the query is being honored. The PopDenZone field is not being accepted and I am getting other ...
3
votes
1answer
37 views

ST_MakeLine within CartoDB.js

I'm building an interactive map using CartoDB.js in an HTML page. I have the user input an address that gets geocoded. I then use the user's lat/lon coordinates to perform SQL queries on CartoDB. The ...
0
votes
2answers
50 views

Feature class SQL Query combining ANDs and ORs

I want to create a query that returns any combination of specific values of two different attributes. I have a feature class that has first field with values A through E and a second one that goes ...
0
votes
0answers
9 views

Query search using variables to search for variables?

I am trying to see if part of any attributes in field 1 (PID) does not match part of field 2 (parcelnum). The PIDs are 16 digit, but the last 4 digits are used to create the parcelnums. So if my ...
0
votes
0answers
4 views

how to make shapefile in geometry column of ms sql? [migrated]

I was tried ogr2ogr command like this. ogr2ogr -f "ESRI Shapefile" "C:\temp\sqlexport.shp" "MSSQL:server=[RemoteServerIp];database=[dbname];User Id=[user];Password=[password];trust_connection=yes;" ...
0
votes
0answers
21 views

GDAL/OGR C++: How to connect to SQL

Using GDAL 1.11 it is possible to execute SQL commands against a OGRDataSource: But how do I connect the OGRDataSource to a SQL Database? In my case an Oracle XE 11g. I suppose the OCI drivers have to ...
3
votes
1answer
72 views

SQL Query in arcmap

I have a BUILDING.SHP and in the attribute table, it has several names and some of the attributes are "STOR" and "MULTIPLE-STOREY CAR PARK" like image below. In my map, I don't want label the ...
0
votes
2answers
36 views

How to use SQL within python in ArcGIS Labels

I'm trying to create labels across a one-to many relationship and have tried a simplified version of this method. My version looks like this: def FindLabel ( [NAME_V2] ): import arcpy ...
1
vote
2answers
80 views

Definition Query to hide attribute data

SQL help please! I've tried searching, but can't find the help I need. This is for ArcGIS Advanced 10.2. I have a parcel layer with all kinds of info that the general public shouldn't be able to ...
2
votes
1answer
21 views

TSQL Geometry Query Requires conversion to string

If I specifically define some polygons and check for containment, I get a correct result: DECLARE @g geometry; DECLARE @g2 geometry; SET @g = geometry::STGeomFromText('POLYGON((407305 100826.5, ...
0
votes
1answer
48 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
0answers
18 views

Update Statement in PostGIS ERROR

I am trying to update a column in PostGIS using information from a column in another table where they spatially intersect. I looked up how to do this on the PostgreSQL tutorial and I think that I ...
1
vote
1answer
32 views

Using a feature iterator Value variable in a SQL expression of select by attribute

I am using Iterate feature selection to select dealers one by one as input features to the Near tool. I'm using Select by Attributes to select sales points from that same dealer. How do I sync the ...
1
vote
0answers
24 views

How to Load SQL Geometry Data on OpenLayers3?

I am New in OpenLayers 3. I have to load Geometry data from sql to my OpenLayers map. This is my code : var tileLayer = new ol.layer.Tile({ source: new ol.source.MapQuest({ layer: 'osm' }) }) var ...
0
votes
1answer
22 views

Creating Shapefiles from MS SQL using ColdFusion/Java?

A client wants to export, from their MS SQL server, data into Shapefiles. I've looked around for a starting ground and have heard Ogr2Ogr mentioned and it seems intimidating. So I was wondering if ...
0
votes
0answers
16 views

How do I insert a Query Result into an existing Table?

I am attempting to create a map that displays the Service Area for Firestations within Toronto, In order to do this I need to identify the Length of all pathways. I tried using the calculate geometry ...
0
votes
0answers
12 views

How to select using ST_MakePolygon from a database using points of a polygon

I want to write a sql command that can select within a polygon that has many points of reference ie a boundary of an area. I was able to use this command SELECT * FROM testtable WHERE the_geom ...
1
vote
1answer
19 views

How do I query in natural=strait from OSM databse?

I'm trying to query in straits, fjords, and bays from a PostGIS Openstreemap database. The straits I'm looking for are tagged natural=bay, natural=strait, and natural=fjord. I used the following ...
0
votes
1answer
13 views

What is the best strategy to add a custom constraint to a geo-django table?

What is the best strategy to add a custom constraint to a geo-django table? This is the corresponding sql-statement: ALTER TABLE my_table ADD CONSTRAINT enforce_valid_geom CHECK ...
1
vote
0answers
15 views

Free tutorials for beginners in PostgreSQL, PostGIS and SQL? [duplicate]

I've been cruising youtube videos and various sites trying to pick up information on working with postgresql, postgis, and sql. I would love a few recommendations for quality tutorials and sites. ...
1
vote
2answers
133 views

Determine which points are contained inside a given polygon

I have these database tables defined: CREATE TABLE regions ( id SERIAL PRIMARY KEY, name VARCHAR(150) NOT NULL ) CREATE TABLE region_points ( id SERIAL PRIMARY KEY, region_id SERIAL ...
0
votes
1answer
27 views

UPDATE a value field for area of the geom and convert sq m to acres using cartodb

I'm trying to use the SQL commands in CartoDB to UPDATE a value field that shows total acres of the area of the_geom. My SQL is pretty poor/entry level and has some issues: UPDATE table_name SET ...
2
votes
2answers
85 views

Add a serial id column inside a view

Is it possible to create a new id serial column inside a view? I need it to be able to add my view in postgis I have made a full outer join on two tables I need a unique PK to load the view in ...
1
vote
0answers
31 views

ArcSDESQLExecute to query and update from multiple SDE Databases

I am trying to use ArcSDESQLExecute to return the results of a join and then write the return query into a Feature Class located in a different database. Using Microsoft SQL Server and Arc10.2.2 Is ...
0
votes
1answer
26 views

CartoDB table join error: Column reference is ambiguous

I've got a CartoDB question that seems dumb b/c the layer is correctly rendering. Anyway, I have two layers, named sampling_points sample_point I'm trying to inner join the sample_point data to ...
0
votes
0answers
26 views

How to Transform Many Projections Into One With SQL Server

I know very little SQL Server, but am quite familiar with Arc and Python. The data I want to transform is point data which is in a single table [ID], [X] [Y], [COORDSYS]. There are 5 possible ...
0
votes
1answer
26 views

Update the_geom field with polygons from a different table using one common field

Using CartoDB SQL API I'd like to: Update the_geom field in a table that has no spatial data by selecting the polygons from a table with spatial data and joining based on one common field.. In this ...
2
votes
2answers
87 views

PostgreSQL/PostGIS Geom to JSON with Inner Join to another table

I am currently producing JSON from a database successfully using the following query: SELECT row_to_json(fc) FROM ( SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM ...
1
vote
0answers
74 views

ESRI JavaScript API Web Application and SQL Queries in ASP.NET?

My workflow (and security restrictions) for a new html/javascript based web application is making me think that I could program an ASP.NET application, inside which I load the 'map' and the 'legends' ...
1
vote
2answers
57 views

Load multi CSV files from local disc to Postgres

I want to load a lot of CSV files from a local disc in an already created postgres database. Which is the easiest way to do that? By using SQL or Java? I suppose that I need a loop for doing that, but ...
3
votes
2answers
71 views

How to reproduce FME Change Detector results in PostGIS?

we would like to use the function change detector from FME in PostGIS. We had a try with the following SQL-Statements but the function doesn´t work. There are no results in the end. The single ...
0
votes
0answers
39 views

ArcGIS Workflow Manager Query - Find Duplicate Job_ID

We have a query in ArcGIS Workflow Manager 10.2 shown below that shows "All Assigned Jobs". Due to the nature of our workflows (parallel workflows), some jobs are duplicated more than once in the ...
1
vote
1answer
56 views

ogr2ogr command : chaining -clipsrc and -sql filters?

I'am currently doing a clip then SQL query to select the biggest cities out of Natural Earth data via 2 commands : ogr2ogr -clipsrc 1 52 7 49 ./tmp.shp ...
0
votes
1answer
53 views

Find nearest node function

I am trying to get work the next function but i don't know if it is incomplete because the query SELECT * FROM pgr_nearest_node1('jaen',-3.75,37.779); does not provide any results. Here is the ...
0
votes
1answer
78 views

pgr_drivingdistance wrapper

Pgr_drivingdistance function works as : SELECT seq, id1 AS node, cost FROM pgr_drivingDistance( 'SELECT id, source, target, cost FROM edge_table', id, distance, false, ...
0
votes
0answers
30 views

Syntax error drivingdistance

I am new in sql and i am trying to get that works a subquery with pgr_drivingdistance and pgr_pointsaspolygon but i get the next error: subqueries in FROM must to have an alias,for example, FROM ...
1
vote
1answer
86 views

Adding Nodes to Linestrings at Overlapping Points with Polygon Layer in Spatialite

I have two Spatialite tables. A table called 'lines' which contains a PK column called OGC_FID and a LINESTRING column called GEOM. A table called polys which contains a PK column called OGC_FID and ...
0
votes
1answer
81 views

PgRouting function wrapper

I'm trying to adapt the pgr_fromAtoB function to pgr_fromAtoMult replacing pgr_dijkstra function to pgr_drivingdistance.Here is the code: CREATE OR REPLACE FUNCTION pgr_fromAtoMult(IN tbl character ...
0
votes
0answers
59 views

GeoServer Style referencing SQL Server data store

I have a SQL server (2012) based data store in GeoServer (version 2.6) . For better readability I created a spatial layer with a whitespace in a column (attribute) name. Trying to use a style with ...
3
votes
1answer
103 views

PostGIS multiple conditional statement on spatial join

I want to make a multiple conditioned spatial query in PostGIS 2.0/PostgreSQL 9.3., OS Windows 7. There are 2 tables, cadastre (Polygon) and roads (Linestring). Query: Select the sum (one number) of ...
1
vote
1answer
33 views

Using MOD within a GROUP BY subquery on point dataset

I have a dataset of 200 points (in shp/f gdb/p gdb format) in ArcGIS. I am trying to use the MOD() function within a GROUP BY subquery as a definition query on the layer to thin out the data. What ...
0
votes
1answer
94 views

MapInfo Calculating the number of Points that Fall within a Boundary

I have two layers in MapInfo (points and polygons). I need to select points which fall within polygons where the income > 1500 I tryed this one but not working: ...
1
vote
1answer
88 views

Merging multiple tables using SQL in CartoDB

I have 5 separate tables in CartoDB each with a varying number of columns, but all containing these 4 columns (the_geom, name, type, unit_code). I want to merge them all into 1 new table and get rid ...
0
votes
0answers
24 views

SQL query syntax for NDVI grid in ArcGIS for Desktop?

I am trying to extract by attribute pixels with a Value >0 (i.e., the vegetation in an NDVI grid file) in ArcGIS. Every time I try to extract by attribute (spatial analyst tools/extraction), my SQL ...
1
vote
1answer
75 views

PostGis - BBox -vs- ST_intersects Queries

CartoDb Recommend here that the following query is faster than an St_intersects Query SELECT * FROM {table_name} WHERE the_geom && ST_SetSRID(ST_MakeBox2D(ST_Point(-73.9980, 40.726), ...
0
votes
1answer
28 views

Walking-Driving area with Leaflet,OpenLayers

Could be possible to get a walking or driving distance area using pgr_drivindistance,pgr_alphashape and/or pgr_pointsaspolygon when an user click any location on map with Leaflet or OpenLayers?. I ...