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

learn more… | top users | synonyms

4
votes
3answers
1k views

How to join two tables using date, time, lat and lon as common field?

I am sorry if the question is elementary but I did not find any clear discussion or guide to understand how to run a query in postgresql. So that a pointer to another website would be also useful. ...
5
votes
3answers
501 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 ...
2
votes
1answer
102 views

Case sensitive query of shapefile in ArcMap 10

I am an IT guy, not a GIS guy. What I know about how to use ArcMap 10 I learned from Google. It has served me well so far. Apparently what I'm wanting to do worked in version 9, but no longer does in ...
3
votes
1answer
131 views

Editing and Deleting Query Tables in ArcMap

How do I edit the query for a Query Table after it has been created? How do I permanently delete a Query Table? Even after I do right-click -> remove, it still appears in dropdown lists.
1
vote
1answer
153 views

What are FLOOR and CEILIING in PostGIS designated for?

Just a short question to lighten up my understanding of some PostGIS-code: Regarding the creation of user-defined grids I often find the expressions CEILING and FLOOR. Like in this non-representative ...
1
vote
0answers
48 views

given sets of vehicle passing on each edge, how to get most used vehicle to avoid transition?

I have two tables: one, the resulting table from converting osm.xml via osm2po so I can use pgRouting, and another one that contains information on what edges each public vehicle passes through ...
5
votes
2answers
798 views

Does SQL Server need extensions to do spatial?

Does SQL Server need extensions to do spatial like Oracle does? Just wondering if there will be extra costs for implementing a SQL Server backend to SDE. Thanks
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 ...
4
votes
3answers
459 views

How to select a number of rows based on current sort order

I would like to be able to select a certain number of rows from my attribute table based on their ordering and not their attributes. For example, if I sort by ObjectID, I then want to select the top ...
4
votes
1answer
278 views

SQL Server data modelling + spatial data = what book?

What recommended book can you provide about data modelling for geographical spatial data (geometry) in SQL server?
3
votes
2answers
310 views

Get Spatial Table Information Oracle Spatial

How can I get the tablename, Srid and GeometryType of all spatial tables in Oracle(I use 11g)? In postgis, I can do something like select f_table_name,srid,type from public.geometry_columns order by ...
3
votes
2answers
2k views

Reading Coded Domains from ArcSDE 10 RDBMS using SQL/ADO.net

I need to read ArcGIS Domain Coded Value pairs (value/description) from SQL Server / Oracle in SQL (i.e. not using ArcObjects). This is an XML field. I can get the domain definition thus select ...
6
votes
3answers
177 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 ...
5
votes
1answer
336 views

How to Comment Out Definition Queries

I use Definition Queries a lot in my daily GIS life, but one of the many things I've found annoying about ArcMap is the inability to comment out Definition Queries. I'd like to have this option as ...
3
votes
1answer
419 views

Parameterizing SQL Views Geoserver

I must do a view in geoserver. I seen some example here: http://docs.geoserver.org/stable/en/user/data/database/sqlview.html. The example show the operator like for parameterizing view. Suppose, now ...
4
votes
1answer
246 views

Is it possible to run an arcpy execute SQL method without connecting to any database or server?

I want to simply process a layer by writing a tool script in a toolbox without having to connect any database, so I think I may have to set up a workspace environment in ArcMap, but I'm not sure if I ...
5
votes
1answer
399 views

How to run custom queries on vector layers and display results?

Is there a way to display the result of a query in QGIS? For instance : To get the total number of inhabitants : SELECT SUM( inhabitants ) FROM countries To get the total density : SELECT ...
4
votes
2answers
263 views

how to cast integer to float in an ogrinfo sql statement?

I have a shapefile for which I would like to add the values in a column. As the sum exceed the capacity of an integer, I need to cast values to a float. I tried the following: ogrinfo -sql "SELECT ...
0
votes
0answers
96 views

Can osm way records in SQL spatial be merged to one geographic record if they have same Id?

I've imported England shp file of roads to mssql using OSM2MSSQL and I've noticed that the same road has couple of records with same Id but different geographic (probably it was segmented). Is there ...
1
vote
0answers
369 views

How to handle postgresql/postgis geometry type errors in a function?

I have created the following function in PL/SQL to make a polygon from a set of linestrings: CREATE OR REPLACE FUNCTION _myfunction( _fid integer, _rid integer ) RETURNS VOID AS $$ ...
2
votes
1answer
145 views

How to create a network with all the track points

I have created a sample network through the use of gps visualizer. Than I used the ogr2ogr function to import this data in my database. Now I have a table which holds all the track points of these ...
2
votes
1answer
205 views

How to return nearest point to input lat/long with distance?

I am trying to write a query with PostGIS that returns one row where the geometry of that row is the closest to an input point. I would also like to include the distance between these points in the ...
2
votes
1answer
308 views

How do I select * rows of multiple columns in one query using Select by Attributes within ArcMap?

I am trying to convert a psql query string into arcpy formatting for an UpdateCursor where expression parameter: '''SELECT ...
3
votes
1answer
80 views

PostGIS - improving sql statement

I've managed to create the below statement that creates a table based on a point in polygon query. However it creates a column that gives a true/false value which I then delete out all the f values ...
2
votes
1answer
105 views

Join Zip Codes Table to Nearest City from Second Table

I have two tables, siteareas and ziplookup. The former contains large cities in the US; the latter all US zips with lat/lngs. I have a foreign key into the former table in the latter: sitearea_id. I ...
6
votes
1answer
268 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 ...
1
vote
1answer
221 views

Should I query the tab/shp file or SQL (mapserver or geoserver)?

I have tab files (or shp) with information like residents , buildings etc... I need to be able to click a point in web map and query all data that fall in certain radius. I didn't decide yet which WMS ...
7
votes
2answers
2k 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 ...
2
votes
2answers
885 views

Convert RT90 into WGS84

Goal: Gain WGS84 decimal to locate some cities in Google Map. Problem: I don't know how to convert the value of the RT90 coordinate system into WGS84 in SQL Server.
3
votes
1answer
592 views

Python script for constructing a WHERE clause from user input

I'm trying to construct a where clause from user input that will eventually be passed through as a SQL statement in the select tool or the select by attributes tool. I've started a script thats been ...
6
votes
0answers
407 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 ...
8
votes
3answers
736 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?
4
votes
3answers
544 views

Incorporating SQL Statements in Model Builder

I have a point data set where each point has a unique operator associated with it. I'd like to select by attribute = operator name and generate a new shapefile for each operator containing only the ...
7
votes
0answers
66 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 ...
1
vote
1answer
207 views

Why is my PostGIS transformation not working?

I am using a PostGIS query to find the intersection of two streets, and then transform the results into lat/lon. The street database's current SRID is 6856, a projection I added to PostGIS myself; and ...
6
votes
1answer
311 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 ...
5
votes
2answers
3k 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
96 views

how do I select more than one features from raster attribute table

for ex: "lc_2001" = 21, 22, 23, 24 AND "lc_2006" = 11, 31, 41, 51
3
votes
1answer
152 views

How to query against time

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 ...
0
votes
0answers
1k views

How to populate data from postgresql using dynamic php\html listing

In the form I created, I need two fields to be dynamically populated from the database while the other fields will be manually entered and push to the database. I have written a script that is able ...
1
vote
1answer
182 views

run sql on Qgis

I want to do simple demo to our manager with quantum gis. i have buildings from my city with wgs84 projection on postgre sql database and also have non gis table which have who leaves this buildings ...
2
votes
1answer
924 views

How do I format 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 ...
3
votes
1answer
199 views

Has anyone been successful using the CAST function in ArcMap 10 with ArcSDE 10

I would like to use the CAST function in the definition query property of a layer and/or in the label class sql query window. This was the most promising link that I've found, including the two links ...
1
vote
0answers
64 views

Database has duplicate values after running pgrouting

I am a newbie with postgresql and sql statements so maybe it is a trivial question, I'm sorry for that. I am working on a postgis database and try to use the pgrouting function. My goal is to store ...
3
votes
1answer
132 views

Proximity query approach

Let's say that I have two tables in PostGIS, tracks and cities, each table has two columns, in both cases the columns are called name and way, name is a string, way is a geometry. I want to retrieve ...
1
vote
1answer
248 views

Cordenadas 2d transformacion a postgis desde QGIS

This is a three-dimensional shape file, I checked in ARCGIS, where the shape attribute indicates POINT ZM, This is the table fid 0 shape* point ZM atribut1 A atribut2 B ESTE ...
1
vote
2answers
1k views

How to offset point perpendicular to line direction in PostGIS

I have a postgis table of points, that are sitting on road centerlines (I've linear referenced them). And the second table with road centerlines themselves. The point table also has a field roadid and ...
4
votes
2answers
1k views

Publish SQL Views from Postgres/Postgis to Geoserver

I've trying and reading how to publish a Postgres/Postgis View in Geoserver. I know that I can create an SQL View in Geoserver, but I'd like to define the View in Postgres, not in Geoserver. Does ...
3
votes
3answers
670 views

How to Calculate length of polyline geometry for several tables in PostGIS?

PostGIS database contains several geometry (polyline) tables (with names "D1_r", "D2_r", "D3_r"). I calculate length for one "postgis layer" use request: SELECT ...
2
votes
1answer
322 views

How to create a point table from a remote csv file?

The current approach that I am using to load a csv file into a PostGIS enabled database on a server is the following: -- create table CREATE TABLE points( id int, lat double precision, lng double ...