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

learn more… | top users | synonyms

3
votes
1answer
2k views

ESRI File Geodatabase - Trying to use CURRENT TIME in Definition Query

Is it me, or are the date functions in the file geodatabase a total nightmare. Anyway, I am trying to set up a fairly simple definition query that contains a subquery with a date comparison. My ...
1
vote
0answers
334 views

Add building height from xyz points in PostGIS

I have been trying to get this query right and just can' seem to. I have a building polygon table with over 7 million polygons, indexed I then have a grided height XYZ table with attribute 'height' ...
6
votes
2answers
6k 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 ...
2
votes
1answer
181 views

SQL Plus error using sdeversion

I'm new to SQL Plus and I have a question. I've created several versions of a feature class located on a SDE database. I want to use ArcSDE Administration Commands found here but I'm getting an error ...
0
votes
1answer
138 views

Postgis reorder mixed up linestring chunks / max_segment_length(linestring)?

I imported ~1000 paths from somewhere into my postgis database to a linestring field. I had the problem that the paths were divided into chunks, and those chunks were mixed up in some cases. Suppose ...
1
vote
1answer
100 views

Read height data from Meridian 2

I'm having difficulties reading the Gridded height data (OS Meridian 2). I'm loading with OSGB 1936 reference system but have trouble finding the lat/lon data for each point. i.e.I open the attribute ...
4
votes
2answers
1k views

Changing Buffer table geometry dynamically in PostGIS using plain SQL

I have two tables in PostGIS, a point and a point_buffer table. The point table has a buffer_distance field, with a default value say 200. Now I want to change the buffer table geometry whenever I ...
1
vote
0answers
271 views

Manifold 'Link drawing to query' - can I do this in QGIS?

Manifold GIS allows the creation of dynamic drawings linked to queries. Unfortunately I do not have access to Manifold as my employer refuses to pay for it, so am currently investigating ...
1
vote
1answer
1k views

POSTGIS query of point feature. How to find nearest point to query location?

I am querying a point feature using a POSTGIS request fired in Javascript. The decoded URL looks like this and returns great results for polygon features. ...
1
vote
1answer
477 views

Creating SQL query in ArcGIS Explorer SDK?

I am using the ArcGIS Explorer SDK and have run into an issue surrounding a query I would like to perform with SQL. I believe my query is built wrong or perhaps I am looking at the wrong fields. Would ...
0
votes
1answer
221 views

Running database operations against a stored GIS geometry

I'm using Quantum GIS and Postgres with the GIS extensions to store shapefiles that I'd like to run point in geometry and point in union geometries against. While it's easy to save and load the vector ...
0
votes
0answers
60 views

postgis minimum distance among many points [duplicate]

Possible Duplicate: Nearest Neighbor calculation in PostGIS Is there a way to achieve the following: SELECT ST_AsText(a.geometry), min(ST_Distance(ST_GeomFromText('POINT(10 20)'), ...
7
votes
3answers
11k 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 ...
10
votes
2answers
3k 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 ...
0
votes
1answer
262 views

Vertex point is returning None

I have this multilinestring that has 48 NPoints. When I execute ST_PointN(line,5) it returns none. And to continue on, it returns None for everything after index:2 up to index:48. This is how my line ...
6
votes
1answer
2k views

Registering SQL Spatial View in ArcSDE and updating Row_ID?

I am having issues registering an inner join SQL view with a spatial column in ArcSDE. Any help would be much appreciated. Here is the background info: ArcSDE 10, SQL Server Enterprise 2008 R2, SQL ...
1
vote
1answer
523 views

Passing parameters to PostGIS SQL queries in Python: weird behaviour

The following code always goes to the except section and I do not understand why..Any help would be much appreciated. l = None c = conn.cursor() try: s = "SELECT ST_NPoints(ST_GeomFromText(%s))" ...
3
votes
2answers
983 views

Selecting points not snapped

I have a point layer and a polyline layer. I want to select all points in the point layer that are not snapped to a vertex in the polyline layer. How can I accomplish this? I'm using MapInfo and ...
1
vote
1answer
327 views

How to correctly use cursor.execute() with PostGIS?

I do not understand how the operator works some times... Here is an example that works, "SELECT ST_Distance(ST_GeomFromText('POINT(-3.16496271127842 ...
5
votes
2answers
975 views

How to fix pgRouting error “starting vertex not found”?

I've posted on here before about my battles with drivetime polygons and got some sensible suggestions back, so having Googled myself stupid over this I'm turning to you once again in the hope of a ...
4
votes
1answer
2k views

Good place to get Country, State, City, and Zipcode information?

I'd like to populate a database with common location information. I'm not entirely certain that addresses across the globe have similar or even the same entities as the Country, State, City, and ...
3
votes
1answer
701 views

ArcGIS Select Analysis using Unique Values from Field

I am trying to create separate shapefile using Select analysis with ArcPy by doing an SQL query to create them based on a unique value from the field. I want to create a list of the unique values in ...
5
votes
1answer
5k views

Arcpy cursors, WHERE clauses, and date/time fields

I'm having trouble making a selection of rows that meet certain date criteria using my arcpy.UpdateCursor(). I need to update records in a field in a geodatabase table with an ascending value based on ...
4
votes
2answers
1k views

What is the best approach to using IQueryFilter.WhereClause in ArcObjects?

What is your preferred / best approach to using IQueryFilter.WhereClause statements in ArcObjects (e.g. when selecting features by attributes)? You need to check the source type (shapefile / personal ...
6
votes
3answers
2k 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 ...
0
votes
1answer
97 views

How to query distict row with the same label from different linestring with multiple segment?

I have a multilinestring street table in postgis with two columns: label and prefix. This table has 2 different roads with the same name and each road contains multiple segments. Roads were splitted ...
11
votes
1answer
615 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 ...
0
votes
2answers
1k views

Correct SQL statement in FME?

I am trying to write SQL statement in WHERE Clause FME in Navigator but it does not work. WHERE Clause: NAME IN SELECT CONCAT(''$(',SELECT REPLACE ('Roman Ann Jack',' ',','),')'') This sql code ...
8
votes
3answers
4k 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. ...
3
votes
2answers
2k views

Adding rows of data to a non-spatial table in ArcMap with a SDE SQL Server for Metadata purposes

I'm attempting to use several non-spatial tables to better organize the large set of feature classes I continually add to a SDE Geodatabase (SQL Server Express). So I have several tables setup and ...
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 ...
3
votes
2answers
1k views

Check if an object is empty in mapbasic

I have mapbasic code that manipulates the obj-column in a point-table. Some rows doesn't have any geometry so the obj-column is empty. My question is how to check if there is no object? All the ...
7
votes
1answer
114 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
1answer
796 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 ...
4
votes
2answers
626 views

Merge reversed linestring in correct order in postGIS

I want to merge linestring in the correct order in postGIS, but sometime they are reversed so something like this : select astext(linemerge(ST_union( ST_GeomFromText('LINESTRING(3 3, 2 2)'), ...
3
votes
3answers
2k views

Inserting polygon centroids into an additional column in PostGIS

I'm trying to calculate the x and y centroids for a table using ST_Centroid. The documentation says that it returns the geometric center of a geometry. I first made a column X: ALTER TABLE ...
5
votes
2answers
2k views

How to export a PostGIS raster to PNG?

I have a raster which is split into 30 tiles and I want to dump them all into PNGs. I've read the documentation http://postgis.net/docs/RT_ST_AsPNG.html but still don't know how to dump it well. If ...
3
votes
1answer
1k views

How to delete records from multiple, similar feature classes by attribute values using an SQL statement?

I have several hundred geodatabase feature classes which all have the exact same fields. I need to go through each of those feature classes and delete any records which match an SQL query (the same ...
7
votes
3answers
5k views

Bounding box for PostGIS table

Is there an easy way to get the bounding box for an entire table in PostGIS? Thanks
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 ...
0
votes
2answers
1k views

Mysterious MapInfo query syntax errors

I'm struggling to get what seems like a perfectly normal query to execute in MapInfo v10. In SQLite Manager (an excellent firefox plugin), this works as expected: SELECT area_name, street_name, ...
2
votes
3answers
2k views

Trigger on SQL Server 2008 ArcSDE 10 and ArcGIS Server 10

I need to build a sql server db trigger to update a date field with the current date when a record is inserted or updated, I think. I will be using the date field as a way to recognize ...
2
votes
2answers
565 views

Parameterized insert query to PostGIS fails

I have a PostGIS database table that I need to insert data into. I'm using Python 3 and the pg8000 interface to Postgres. Somehow, parameterized inserts do not work. If I do iq="INSERT INTO ...
5
votes
1answer
385 views

How to filter points based on proximity while inserting into PostGIS?

I have a large amount of locations that need to be inserted to a PostGIS database. However, I'd like to aggregate these points so that if there's already a location, say nearer than a kilometer, then ...
1
vote
0answers
309 views

T-SQL with SDE and Web Map ArcGIS Server 10 MSSQL 2008

I need to build a system whereby the user of a web map (the standard web map that ArcGIS Server Manager builds) can edit a feature class's attributes. The attribute will be a 'Comments' field. The ...
2
votes
2answers
238 views

Is there a way to save manual QGIS changes to Postgis to SQL script?

I am manually editing a Postgis layar with QGIS and would like to export these manual changes in the form of an SQL script. This way: I can do it automatically next time i need to it is easier to ...
3
votes
2answers
1k views

How to write a SQL WHERE Clause using Multiple Choice values in FME?

I published a parameter which is of Choice Multiple type. I wish to use values from this parameter for WHERE Clause when Reading Inputed Data in the begin of Workbench. So there is no problem if I ...
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 ...
5
votes
5answers
3k views

How can one execute an SQL script in field calculator in ArcGIS 10?

I am trying to transfer over row data from a table to columns in a shapefile table. There is a common "SA" variable between the two (i.e. the study area number) but there is more than one land use ...
7
votes
1answer
402 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 ...