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

learn more… | top users | synonyms

33
votes
2answers
4k views

Acquiring ArcGIS-like speed in Postgis

I have been using Postgis 2.0 for 3/4 of a year now and while I really enjoy using it, excessive query processing time has rendered it basically unusable for my use case. I tend to do heavy ...
25
votes
9answers
13k views

How to connect to PostGIS database from ArcMap?

How can I connect to a PostGIS database from ArcMap? Solutions for ArcGIS 9.3, 10.0 and later are acceptable. Ideally, I would like to be able to perform spatially enabled queries and receive the ...
18
votes
4answers
6k views

What is the best way to join lots of small polygons to form a larger polygon?

I have the following layer using SRID 27700 in postgis: It's every administrative region in the UK, and (as you can see from the colour grouping) each of them has a text field specifying the county ...
16
votes
4answers
3k views

PostGIS: Select features that do NOT intersect

This seems to me like such a simple question (and it probably is) yet I cannot seem to find an example that gives me the answer. Using PostGIS, I just want to select points that fall outside of ...
14
votes
5answers
4k views

A SQL console in QGIS

I know QGIS comes with its field calculator, which is not bad. It also comes with ftools which permits several operations on geometry and attributes. But we often need more control and I haven't seen ...
13
votes
1answer
1k views

Identifying topological relationships using PostGIS

I'm trying to perform a basic typology analysis using PostGIS. My objective is to find any polygons that touch other polygons. To do this, I thought the ST_GetFaceEdges would work (reference). I want ...
11
votes
1answer
572 views

Nearest Neighbor Grouped Selection in QGIS

OK - so I have an interesting problem I am trying to solve. I have a list containing over 100,000 points in lat/long format which I have imported into qgis. Now, what I am trying to do here is group ...
10
votes
3answers
1k views

How to interpolate GPS Positions in PostGIS

I have a PostGIS table of GPS positions for every five seconds: 2011-01-01 00:00:05, POINT(x1,y1) 2011-01-01 00:00:10, POINT(x2,y2) 2011-01-01 00:00:15, POINT(x3,y3) ... I'm looking for a query ...
10
votes
2answers
6k views

Creating spatial tables with PostGIS

In the PostGIS documentation it says that there are two steps to creating a spatial table with SQL: Create a normal non-spatial table. Add a spatial column to the table using the OpenGIS ...
10
votes
2answers
2k views

Intersecting a raster with a polygon using PostGIS - artefact error

I'm using PostGIS2.0 to do some raster/polygon intersections. I'm having difficulty understanding which operation I should use, and what the quickest way of performing this is. My problem is as ...
9
votes
3answers
2k views

Beginner PostGIS question: getting geometry from multiple tables

I am very new to PostGIS, PostgreSQL, and SQL in general. I have 44 tables in my PostGIS database, and each one represents a different layer of vector data. Each was loaded from a separate shapefile, ...
9
votes
5answers
311 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 ...
9
votes
2answers
304 views

How do I perform a 3 parameter geotransformation and projection in Sql Server 2012?

I have a table with latitude longitude (NAD27) columns in it. I compute two other columns, X and Y, representing Web Mercator (WGS84) location. Currently I'm using a Arcmap to do this, by applying ...
8
votes
4answers
1k views

Queries returning very big datasets in PostGIS

I have a PostGIS query that will return several million rows: SELECT t1.id AS id1, t2.id AS id2, ABS(t1.mean_h - t2.mean_h) AS h_diff, ST_Distance(t1.the_geom, t2.the_geom) AS dist FROM ...
8
votes
4answers
2k views

To what extent is SQL's language accessible via ArcGIS tools?

That question just sounds so redundant... At any rate, I have been asked to explore the uses of SQL in ArcGIS. We use an SDE DB for all server-side storage and DB managing/large-scale editing. ...
8
votes
2answers
677 views

Splitting polylines using regions with PostGIS

I was wondering if it is possible to split a polyline on polygon boundaries (regions) in PostGIS, the picture below is of what we have at the moment and showing where I need the polylines split: ...
8
votes
3answers
944 views

How to get a list of distinct values from a 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 ...
8
votes
3answers
797 views

Are there any training resources in SQL and Python as applied to GIS database management?

I've taken ESRI database courses, which have been helpful to my work. But I also need training in SQL and Python as applied to GIS database management. Any suggestions?
8
votes
1answer
1k views

How to trace SQL queries sent by ArcGIS Server (ArcSDE) to Oracle database?

I'd like to generate a log file containing all SQL queries sent by ArcGIS Server (ArcSDE) to Oracle database. Is there a way to do so? I'm using Oracle 11g and ArcGIS Server 10.0 on Windows. ArcSDE is ...
7
votes
2answers
3k views

PostGIS: Find points that lie within a set of coordinates

I have a PostGIS db, and I want to find the points that lie within some region (a bounding box). I have two sets of coordinates, from which I can get all four rectangle points that form the box (if ...
7
votes
1answer
758 views

PostGIS Intersection and Summarise Attributes

I am usually an ArcGIS desktop user, but keen to start using PostGIS more and I have a really big bit of processing to do. Not sure what functions to use, hopefully someone can help. I have a polygon ...
7
votes
4answers
2k views

SQL expression for finding strings including letters in ArcGIS 9.3.1

I'm working on ArcGIS 9.3.1. I have a shapefile with a string field containing point names like these: 10 12 12/13 t/9 6577y 1234 12t9 124y67 u9 and so on (and yes, I know it looks like a colossal ...
7
votes
1answer
107 views

How to rectify the walls of buildings in PostGIS?

I need an operations in PostGIS to eliminate intermediate vertexes in a polygon to rectify the walls of a building. I was revising http://trac.osgeo.org/postgis/wiki/UsersWikiExamplesSpikeRemover but ...
7
votes
2answers
4k views

Select by Attributes based on SQL wildcard range

I want to select all the records from a geodatabase table where the string starts with a letter, so I tried SELECT * FROM tbl_names WHERE "name" LIKE '[A-Z]%' This returned no records. After some ...
7
votes
3answers
3k views

Label points at regular intervals using ArcGIS for Desktop?

I'm working with lines on roads represented by a large number of sequencial points. Since labeling all of them would make the points impossible to identify, I'd like to know if there is a way to label ...
7
votes
2answers
3k views

SELECT TOP query in ArcGIS

Is there a way to use a SELECT TOP (n) within ArcGIS desktop? Is appears that since the ArcGIS query builder is effectively building the SQL statement after the WHERE clause, that this may not be ...
7
votes
1answer
367 views

Get all Nodes from a List of adjacent LineStrings in PostGIS

I use PostGis and pgRouting. I have a table with geometries of the adjacent edges returned by a shortest path query. I want to concatenate these edges and retrieve a list of all nodes these edges ...
7
votes
1answer
347 views

Assign Z value to start & end of PostGIS line

I have a line table in my PostGIS database and a table with invert levels for the start and end of each line. My goal is to create create 3D lines in my table, from my invert data. I know I can use ...
7
votes
1answer
400 views

Is it possible to define a No SQL model for spatial data? [duplicate]

Possible Duplicate: Is there any way I can use a Key-Value store for geospatial data? I read somewhere about No SQL being a solution for large databases management, the kind that google ...
7
votes
0answers
67 views

How can I automatically split a spatial layer to a grid [duplicate]

Possible Duplicate: Divide vector in equal smaller parts in QGIS or similar I am a software engineer and the company I work for has a project that needs some spatial data manipulation in ...
6
votes
3answers
3k views

Bounding box for PostGIS table

Is there an easy way to get the bounding box for an entire table in PostGIS? Thanks
6
votes
1answer
9k views

How to use Select by Attributes query with semicolons?

I am trying to select multiple (50 or more) unique numeric records using ArcGIS 10's "Select by Attributes" using semicolons ';' after each record which it verifies as good to go. Please see screen ...
6
votes
1answer
1k views

Performance Gain Through GIST Index for Point in Polygon Query

I have two tables: locations(id,region_id,the_geom) and regions(id,the_geom). For each location point I want to determine the region it is located in: UPDATE locations SET region_id = (SELECT id ...
6
votes
1answer
895 views

Spatial joins in OGR SQL

I have seen that OGR supports it's own form of SQL, I was wondering if it's possible to do spatial joins. Something like select all objects where one intersects the other. I did have a look around ...
6
votes
3answers
3k views

How to find nearest neighbors between two tables with point locations in SpatiaLite?

I have started playing with SpatiaLite today and already stumbled upon a problem. For each point location stored in tableOne I would like to select one, nearest (linear distance) point from tableTwo. ...
6
votes
1answer
1k views

PostGIS and invalid SRIDs

I'm having difficulty with a PostGIS query. I am trying to query my database (world_countries) using a bounding box drawn on a google web map. The objective of this query is to find any countries that ...
6
votes
1answer
371 views

Clarification of Logical Operators in a PostGIS Database

The following query returns this result: select count(*) from a , b where a.geom && b.geom; count ------- 66514 On a postgis 2 database. What does the logical operator AND ...
6
votes
4answers
3k views

ST_Intersection slow query

I am trying to perform an intersection between two layers: Polyline layer representing some roads (~5500 rows) Polygon layer representing irregularly shaped buffers around various points of interest ...
6
votes
2answers
791 views

What are benefits of using ArcGIS with PostgreSQL over simply ArcSDE?

I understand that in order to benefit from ArcGIS spatial datatypes (ST_GEOMETRY, versioned geodatabases etc.) ArcSDE needs to be installed - and with the 10.1 client it is automatically installed ...
6
votes
3answers
1k views

Join intersecting lines with PostGIS

This is something that I'm almost ashamed to ask but I can't seem to get it to work for the life of me. I have a road layer with segments, each segment has a Road ID and a segment type. I would like ...
6
votes
1answer
386 views

Join based on maximum overlap in PostGIS/PostGresQL?

I have two sets of polygons in two tables. The sets overlap each other. For each polygon in set A, I would like to get the ID of the polygon in set B that it overlaps the most. I'm using PostgreSQL ...
6
votes
3answers
224 views

Are there any open source Python modules compatible with arcpy that will allow complex SQL queries?

I am trying to handle string (non-geometry) duplicates in a large attribute table of a shapefile without having to convert to gdb and back or connect to a postgres db. I need to be able to use a count ...
6
votes
1answer
885 views

Editing tables using SQL in ArcMap

We've recently started working with ArcMap, having used MapInfo previously. I've created a shapefile in ArcCatalog and want to update some columns using SQL. In MapInfo I'd write the following command ...
6
votes
2answers
4k views

ARCGIS 10 definition query to select the max value from a group

In ARCGIS 10 I am trying to do a Definition Query that will select the records that are the max values from a specific group. Here is what I have tried in the Query Builder but I am getting an "the ...
6
votes
1answer
238 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. ...
6
votes
2answers
1k views

PostGIS SQL query to find a polygon that intersects with a line

I need to build a PostGIS query that would select every polygon inside an area the river is flowing through. I'd better describe with an example below: There is a river (blue line) flowing through ...
6
votes
0answers
576 views

Getting ST_Difference between two different tables in postgis [closed]

One table has a series of grid squares in it, and the other has millions of voronoi polygons in it. I need to create a table that has the difference between the two of the them so that I effectively ...
5
votes
3answers
8k views

How to convert MultiLinestring to Linestring?

I have a multiline string and want to convert it to a linestring in order to use some functions that only work with linestrings. I used ST_Dump() and got a collection of my geometries. If I merge them ...
5
votes
3answers
3k views

Select features by attribute if in Python list

I believe this will amount to largely a sql syntax question. Essentially, I am trying to complete a select by attribute in Python but based on the query of whether an attribute is present in a list. ...
5
votes
2answers
7k views

'Select by attribute' using python in ArcMap 10

I need to select a feature using SQL before zooming to it in python. What I'm looking for are replacements for the commented lines in this code: import arcpy parcel_num = "123456" mxd = ...