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

learn more… | top users | synonyms

2
votes
1answer
41 views

How to populate geography point using ST_MakePoint(long, lat)

I have a table called customer_campaign, and there is an empty column geom(geography) in it. So I want to fill it up by using ST_MakePoint(long, lat) in PostGIS, lat and long are two columns in the ...
0
votes
0answers
60 views

Error selecting geometry from Oracle DB

I'm trying to select a geometry column as well-known text from a feature class in an Oracle 11g/ArcSDE 10.1 geodatabase. (This is in a Python script using pypyodbc as a driver). This is my SQL: ...
1
vote
1answer
236 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 | ...
9
votes
5answers
310 views

GIS analysis to find duplicate geometries

I have a big shapefile that contains all the buildings and houses of the town that I work in (approx. 90,000 features). The data of the buildings/houses are saved by the town's surveying engineers and ...
6
votes
1answer
227 views

How to use ST_DelaunayTriangles to construct a Voronoi diagram?

With PostGIS 2.1+ we can use ST_DelaunayTriangles() to generate a Delaunay triangulation, that is a dual graph of its Voronoi diagram, and, in theory, they have an exact and reversible conversion. ...
2
votes
1answer
65 views

Model Builder Query by date

I've created a model that does several spatial joins based off of a lat/long in a table. In the table, I have a "Modified_date" which gives year, month, date, time. This model is set to run ...
3
votes
2answers
99 views

How can I extract all distinct values from a PostGIS Raster?

I am working with an integer raster in PostGIS 2.1 and I would like to extract all distinct values in that raster. I was hoping to be able to do something along the lines of the following query, but I ...
0
votes
1answer
78 views

dealing with geometry that should be geography (bad coordinates)

I'm working on a project with a few publicly available datasets. One of them is from the USGS, it's their prediction of peak ground acceleration in 50 years. Here's a link, and here's what it looks ...
1
vote
0answers
34 views

Tables from SQL Server to QGIS Layers

I'm a beginner SQL and GIS user and this my first time using stackexchange, so apologies if I'm asking the question properly. I'm trying to open some MSSQL tables in QGIS. I established a connection ...
2
votes
2answers
41 views

SQL 2012 code that spatially polyline fine (join file) to a point file (target) and provides Distance Field

I am currently working in ArcMap 10.2.2 but would like the SQL code to create the same output as that provided by the Spatial Join tool. Target feature = point, Join Feature = polyline, Option ...
4
votes
2answers
4k views

ArcGIS - Create a join based on multiple fields

I have two feature classes in a File Geodatabase that I would like to join based on multiple fields. I've searched this site and Google and all I have come up with was to use the Make Query Table ...
0
votes
0answers
8 views

PostGIS-Layer: sql query from style rules

I’m using PostGIS layers which are build from OSM-Data (osm2pgsql). Now I like to build a sql-query to filter the needed objects like "waterway" = 'river'. But in the layer-style I already have that ...
0
votes
0answers
21 views

Adding a column to several feature classes in a file gdb using ogr2ogr

I'm trying to add the same column to 25 feature classes in an ESRI FileGDB. I managed to do this for one feature class by using ogr2ogr: ogrinfo C:\temp\test.gdb -sql "ALTER TABLE table01 ADD COLUMN ...
3
votes
1answer
68 views

PostGIS: Get closest point between geometry and Multipoint

I think my question is not that difficult for GIS professionals, but i didn't found an answer to my problem (even not in other questions). Problem: I have given two tables (table1,table2) with Points ...
1
vote
1answer
111 views

Definition Query to exclude certain values and return remaining values

I have been trying to create a Definition query to symbolize a set of water features. I cannot edit the .shp file and I want to exclude a multiple values. I have tried using NOT but have had no luck. ...
2
votes
1answer
49 views

Perform a group by query on geodatabase in ArcMap

I have a geodatabase called predictions.gdb and a feature class called output_gis_120_Project in that database. I imported this feature class as a layer in ArcMap. The attribute table with columns ...
2
votes
3answers
76 views

Find point close to points from postgis table

I have a postgis point table with a large list of cities. I need to find duplicates in it, but only if they are 10km close each other, which means that is the same city. For example, I have 5 points ...
5
votes
2answers
64 views

How to select random adjacent census tract

I have set of census tracts spaced out across a city and I would like to randomly choose an adjacent census tract to explore nearby demographic data. I'm not sure if there is an easy process for ...
1
vote
1answer
165 views

In cartodb, how can I insert a new row in a table via API?

We've discovered cartodb and we want to use it in our project, but in the API documentation we've only seen the sql.execute() method (docs) in order to insert a now row in a table. Is this the way to ...
1
vote
1answer
53 views

How to perform SQL query using .STContains in MS SQL Server

I have a table that stores polygons and a table that stores points with a value field. Both sets of data are stored using the Geometry type in MS SQL Server. I have a simple requirement - I need to ...
0
votes
1answer
45 views

About the storage of GIS attributes

I'm quite new to the GIS world and I currently have some technical questions for which I have no answers yet. I'd like to know the good way to store the attributes for a feature using the PostgreSQL ...
1
vote
1answer
71 views

Can't select geometry from Oracle DB using SQL

I'm trying to select the geometry field from an ArcSDE feature class in an Oracle 11g database (inside of a Python script via PyODBC). This is my query: SELECT SHAPE FROM USR.FEAT_CLASS This is ...
2
votes
1answer
49 views

Find nearest distinct features to a point

I am trying to select a single distinct features closest to an XY point in PostGIS. So I can find a single record for each distinct code by using: Select Distinct ON (code) * FROM table; Which ...
2
votes
2answers
114 views

Definition Query / SQL problem in ArcGIS

I have been working on some Definition Queries for layers in ArcGIS (10.2.0.3348). The layers connect to data in a File Geodatabase. Now I have attempted to implement the following query (1), that ...
1
vote
2answers
71 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
vote
1answer
86 views

Invalid SQL-Statement error when querying file-geodatabase table date field with arcobjects

I want to query a DateTime Field in a table in a file-geodatabase and I keep on getting the error "invalid sql statement" (Error Code: -2147220985) while that sql statement does not give me an error ...
0
votes
1answer
72 views

Cannot load postgis layer from sql string in pyqgis

I'm trying to load a layer using the following code in qgis python console: sql = "(select the_geom, ID from mytable)" uri = QgsDataSourceURI() ...
3
votes
1answer
217 views

SQL query to have a complete geojson feature from PostGIS

I would like to get a geojson feature with properties from PostGIS. I have found an example to have a feature collection but I can't make it works for just a feature. so far I tryed to modify the ...
0
votes
1answer
58 views

geoserver fails to start with jdbcconfig community module

I have installed the geoserver JDBC config community module, but now geoserver fails to start. I have set the properties to connect to an oracle database like this: #Default GeoServer JDBC config ...
3
votes
2answers
72 views

Buffer multiple roads to find points within and compare?

What I am trying to do is buffer a main st and a side street and get all of the points that intersect that buffer, however they need to be mutually exclusive. In the example below, my results would ...
1
vote
0answers
73 views

Making Map with Color Ramp Using SQL Database Intergration?

This could be a trivial question, but I've been kind of stuck on it for awhile. I'm trying to construct multiple maps that reflect aggregated data showing overall risk by county in a SQL Database ...
2
votes
1answer
60 views

Spatial joining syntax

A standard PostGIS point-in-polygon query might look like this. (example tutorial) SELECT p.*,b.polyname FROM points p, shapes s WHERE ST_Within(p.the_geom,s.the_geom) Imagine this was not a ...
5
votes
2answers
203 views

Selecting maximum Value based on other field using ArcMap?

I have problems with a SQL query. The table looks like this, it is a point feature class both in postgres and file geodatabase, I am working in ArcMap. name: elev_p HEIGHT AREAid 100 1 200 1 ...
1
vote
1answer
45 views

Geoserver SQL Parameter View

I'm trying to use Geoserver Parameter SQL views, but I'm having trouble getting geoserver to recognize the parameters (and I'm not able to follow the documentation - it's not very clear to me). Here's ...
2
votes
2answers
43 views

PostGIS SQL NOT EXISTS Statements? [closed]

I'm trying to query my PostGIS database for ID of people who did X but did not do Y. I've attempted the query below, but it does not return any results. I'm very new to SQL so I may be overlooking ...
2
votes
1answer
72 views

Error at or near “select” PostGIS

I'm using node.js to connect to a PostGIS database to check if an input feature significantly intersects with an existing feature. The error seems to be with the nested SELECT statement - can anyone ...
2
votes
1answer
60 views

How to find a nearest line to a point

I have a table with many points that need to be associated with street segments to calculate an average value. should I do a relationship for all points to a street segment that is closest. I have ...
1
vote
0answers
43 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
0answers
15 views

Creating weighted list using Select tool in ModelBuilder?

I've done a raster to point conversion and have a column of the grid codes. Let's say it is composed of 10 numbers [9,5,7,1,7,3,7,2,8,1]. Right now I am doing a selection on those numbers based on ...
2
votes
2answers
84 views

Using MAX in SQL Expression of ArcGIS ModelBuilder?

I am trying to use a SQL expression in order to select values that are >= 25% of its max value in that column. For instance, VALUE >= MAX(VALUE)*0.25, and those will ultimately be the selected ...
1
vote
1answer
40 views

Alternative to Copy Features in ModelBuilder to display a result [closed]

I have created a model that takes in a raster, converts it to a point shapefile, then extracts a set of points based on location, then further selects a set of points based on a SQL expression. I ...
3
votes
0answers
80 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
1answer
62 views

Controlling page count increment of Data Driven Pages using ArcPy?

I was wondering if there is a way to add coding to Data Driven Pages with python. I would like to be able to take the "Data Driven Page with Count" and increment the count by one or in some cases ...
1
vote
0answers
46 views

How can I make PROC GMAP (SAS) run is less time?

I am trying to create a map of Australia, by Local Government Area (LGA), with shaded regions displaying the population for each LGA. The shape file can be downloaded from the Australian Bureau of ...
1
vote
1answer
154 views

Select By Attribute: Between Two Numbers [closed]

I am trying to select house numbers that are between 200 and 499. I've been using: "HOUSE_" >= '200' AND "HOUSE_" <= '499' ... and it's coming up with almost everything else. The numbers it ...
1
vote
0answers
62 views

How to export data from sql database in the decimal format in QGIS?

Currently I am working with QGIS and fetching data from SQL server and export it in the format of shapefile in QGIS. While importing the data from sql server attribute table showing data with ...
0
votes
0answers
52 views

PostGIS Spatial query taking a very long time

I'm trying to return a count of crimes (points) that occur in each police grid (polygons), as well as the geometry data, but the query takes ~22 seconds. This seems oddly high and will be problematic ...
1
vote
1answer
37 views

CartoDB/SQL Console?

Lacking much programming experience, I've spent a lot of time familiarizing myself with HTML, CSS, and SQL over the past couple of days so that I could make a layer selector for a CartoDB ...
1
vote
0answers
30 views

Hindi character support in MS SQL 2012

I have spatial MS SQL 2012 and i need to store hindi characters in a column. I tried using nvarchar datatype but I'm getting only "Question marks(????)". Is it possible to store non-english ...
1
vote
1answer
41 views

Remove inner polygons postgis

I'm trying to remove inner polygons with postgis. I've created a routine, that resumes in: From a polygon table, with a unique id: -Create a linestring table from polygon -Import to postgis -Get the ...