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

learn more… | top users | synonyms

2
votes
1answer
414 views

How to convert Geometry type column to degree Minutes Second in SQL Server 2008 R2

I have shape column of type geometry and I want to convert X and Y coordinates into Degree Minutes Second format using SQL query and i am using sql server 2008 R2. Currently I got Lat and long using ...
2
votes
1answer
300 views

Trouble formatting SQL expression for where clause in “Search layer by attribute” arcpy function

I am trying to pass a variable into a where clause in the "Search Layer by Attribute" arcpy function. I cannot seem to figure out the correct format for the SQL expression so that the function reads ...
2
votes
2answers
397 views

Merge lines with the same 'name' attribute on QGIS?

I have a shapefile with a few thousand lines, each is a street segment. I'd like to merge all features with the same 'streetName' attribute into a single attribute. I only really care about the name ...
3
votes
2answers
251 views

Change polygon “handedness” for SQL 2008

I have a few hundred shapes (polygons and multipolygons) each consisting of tens of thousands of points that I am trying to get into SQL 2008. Unfortunately, the shapes I have tried to import are ...
0
votes
1answer
198 views

Linked point geometries to linestrings in Spatialite

I have been parsing Canada's radio system frequency open data. It's a single large table per province, containing point geometries for each station callsign. Where a point-to-point link is defined, ...
3
votes
2answers
460 views

Execute SQL in File Geodatabase

Is there a way to execute SQL queries on file geodatabase from Python? I'm looking for the same functionality provided by arcpy.ArcSDESQLExecute for SDE databases. Thanks,
0
votes
1answer
781 views

Building SQL statement in javascript and casting variables as strings

I'm working with Postgres 8.3/PostGIS which is storing some polygons. I'm writing a javascript function which will take in a parameter of a watershed id from another function. The javascript will ...
0
votes
2answers
143 views

oracle search against intersect of a region that covers the whole world doesnt find any records

I am new to Oracle Spatial, I am trying to implement a service that will take coordinates from a map, and search our database to find any geometries that intersect with that map view. I works fine for ...
2
votes
2answers
219 views

Select by Attributes - If string has a letter

I'm running ArcMap 10.1. I'm using a File Geodatabase. I have a string coordinate field that I want to clean and some records have letters in it (mostly 'N' or 'E' or 'n' or 'e' e.g. '6213210N' or ...
1
vote
1answer
194 views

IQueryFilter where Clause quering two feature class at a time

I need to query two feature class at the same time using IQueryFIlter. For eg - FeatureClass -- A has field OBJECTID FeatureClass -- B has field OBJECTID what i am tring to do is -- IQueryFilter ...
1
vote
2answers
119 views

how to add a raw input to a SQL string?

I have this py script for selecting one point. # Within selected features, select only those points of a chosen value arcpy.SelectLayerByAttribute_management("Stations", "NEW_SELECTION", ' "OID" = ...
1
vote
2answers
57 views

Find the majority area within another area

I have a survey grid overlaid unto several administrative areas. Both are polygon features and I have performed a union on both features in order to determine the areal contribution of the segments ...
1
vote
0answers
48 views

IQueryDescription SQL Query Returning Limited Records

I created a SQL query that is working in SQL Management Studio, but as soon as I transfer the query into ArcMap's IQueryDescription to try and run it with a User Form, the results that I'm getting ...
1
vote
2answers
562 views

How to connect Dotspatial with PostGIS/PosgresSQL database and perform SQL function

I am currently doing a project that needs a GIS front-end interface to visualize geographical objects (road networks), and a back-end geo-spatial database to implement network analysis (SQL based). ...
0
votes
1answer
83 views

pgrouting shortest_path return longest_path

I've got troubles with shortest path function from pgrouting. I try to calculate the shortest path between an address and a bus stop. I first found the nearest road points for the address and the bus ...
1
vote
1answer
300 views

How do I use the SearchCursor where_clause to get a max value from a column?

This is my first time asking a question on StackExchange. I hope I phrase my question and describe my attempts to understand my problem well enough! While working with SearchCursor, I'm trying to ...
1
vote
1answer
507 views

Why isn't my select by attributes query working?

I'm running ArcMap 10.1. I have a point feature class joined to a table and am trying to query a field. If I do [field] = 'TEST', it selects all the fields. But if I do [field] LIKE 'TES%', it ...
1
vote
1answer
536 views

Trigger a python script to run after a row is added to the feature class

I have a Python script which runs on a SDE feature class daily (as a scheduled task). I would actually like this script to run whenever a new row is added to the feature class (data is captured in the ...
3
votes
1answer
247 views

Why is Spatialite showing dates in MM-DD-YYYY format?

I have a table with a dates column that is formatted in MM-DD-YYYY format, as shown in SQL SELECT statements. I'm using Qspatilite (QGIS 1.8) and Spatialite GUI. When I ORDER BY the date column it ...
0
votes
1answer
571 views

query syntax to select every multiple of nn record (shapefile) [duplicate]

I have data like multiples of 40. 40 80 120 160 200 and so on. I would like to label every record that is a multiple of 100. I have tried a couple of methods and cant get them to work either as a ...
-2
votes
1answer
122 views

Qgis: Select multiple layers in sql-Filter [closed]

I have a Shape-File with lines of streets. Now I want qgis only to show the categories: Type: primary and Type: secondary and Type: motorway. How do I do this? This doesn't work: "type" = 'primary' ...
2
votes
1answer
240 views

How to merge connected lines with same direction (PostGis)

I am looking for a way to join all lines that are connected, have the same direction, i.e. start point of one is end point of the other, and share some common attributes. In fact, I want to connect ...
8
votes
1answer
802 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 ...
2
votes
1answer
257 views

PostgreSQL, find points near points

I'm going to have a database with a 'people' table and a 'shops' table. I'd like to find all people within 500m of a shop, and details from both tables. I'm used to working with mySQL, but I'm ...
6
votes
2answers
594 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 ...
2
votes
1answer
535 views

How to get polygons from PostGIS table to PHP array best?

Currently I fetch polygons from a database table using ST_AsText(). The results are in text format, like the following. POLYGON((84 104,212 48,321 122,243 179,275 238,131 240,84 104)) I am not ...
3
votes
0answers
200 views

Geoserver WMST Date Format

There is table in SLQ-Server 2008 R2. In this table i have date column with date format like this 2006-09-08 14:39:41.000. Now i make View from this table on Geoserver side but do nothing wiht date ...
0
votes
2answers
887 views

Cannot insert simple geometry data

I installed PostgreSQL 9.2.4 and PostGIS 2.0.3 on my Windows 8 machine. Then I created a table using phpPgAdmin and added a geometry column using the following statement. SELECT ...
3
votes
2answers
517 views

GDAL SQL syntax to add field an put values

I try to make a new field in my attribute table and put in values from another field after converting from character to integer but can't get the right syntax. I run this as shell-script in MSYS. cd ...
1
vote
1answer
150 views

arcpy: can I use SelectLayerByAttribute to compare fields from joined tables?

I can't figure out the syntax to select table records where one field's value exceeds that of another. The fields are from a pair of table views connected w/AddJoin(). One view is of a fgdb table and ...
2
votes
2answers
117 views

Trying to use an integer in a WHERE clause

I'm trying to use an integer value in a WHERE clause (looking at an integer field). expression = "'SERVICE' = 'Service' " expression = expression + 'AND ' expression = expression + "'GPS_TIME_TOTAL' ...
4
votes
1answer
600 views

Select by attribute expression invalid in python

I'm not sure how my expression is failing. Any ideas? inPoints = "points.shp" i = 0 arcpy.MakeFeatureLayer_management(inPoints, "pts") arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", ...
2
votes
1answer
265 views

Raster as Attribute Field Error

I'm using Arc 10.1. I am creating a parcel inventory where I would like to have a photo of the property attached as an attribute and view-able with an HTML popup. I have a polygon feature class built ...
3
votes
1answer
236 views

What formula does SQL Server 2008 use in STDistance?

I am analyzing the accuracy of the STDistance function for geographical objects in SQL Server 2008, in order to understand its behaviour better I need to find the underlying formula. Does anyone ...
0
votes
1answer
564 views

How to Export to PDF after zooming to extent of each feature that meets SQL where clause?

I realize that I've asked two similar questions recently, but following suggestions in the comment chain, I'll make this a separate question (separate as it is not the no output problem in ArcPy: ...
1
vote
1answer
163 views

Why does this SQL syntax produce empty feature class with ArcGIS Select_analysis?

I'm working on a script that involves an arcpy.select_analysis function. The problem I have is that when I run the script it produces an empty file. I've verified that the whole thing works when in ...
4
votes
1answer
292 views

How to populate SQL options for parameter in ArcGIS 10 tool?

I'm trying to create a tool where individuals can select a variety of records using a SQL expression that is then passed to a calculation. I can add a parameter under the tool, and select SQL ...
1
vote
2answers
456 views

Plotting large numbers of objects on a chart using R and WKT format

I am retrieving thousands of geometry lines in WKT format from a Microsoft SQL Server database. I would like to plot all of those lines in one map, but I am having some difficulty with the code. How ...
1
vote
0answers
372 views

PostGIS Better ST_Intersects Query

I am currently using the following queries to return all features that intersect a large and complex polygon. I initially tried to use a single ST_Intersect query but because the number of features it ...
4
votes
3answers
401 views

How to create Where Clause from user input via Python list?

I am trying to perform a query based on values in a Python list. The where clause will then be used in an Update Cursor, so that the rows NOT equal to the values in the list will be deleted. This is ...
1
vote
4answers
405 views

Get vector features inside a specific extent

The problem: I have a very large vector layer with many features and a much smaller raster layer in a defined region. I want to get only those vector features which are within the raster layers ...
2
votes
1answer
183 views

SQL Command to convert pgRouting result to GeoJSON

My goal is to produce a Web UI for pgRouting using this tutorial. I have already imported my data from an OSM pBF to PostGIS using osm2po. Using the pgRoutingLayer plugin for QGIS, I was able to ...
0
votes
1answer
511 views

Where Clause problems when all parts are user input variables

I have written some generic user ipnut code for a toolbox script (ArcGIS 10.0) but because everything is a variable I don't know how to write the SQL whereclause. Please can someone help and suggest ...
1
vote
1answer
129 views

How to share *.sql files between ArcGIS and MapInfo?

In Denmark many municipalities have the same provider of public data. These data are pushed to a local database – often a SQL Server. The DBMS layout is the same for all municipalities. When I create ...
9
votes
2answers
290 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 ...
2
votes
1answer
270 views

SQL Server UNion of geography feature returns FULLGLOBE result?

I have some trouble with sql server 2012. I store coordinates of french cities in my database as geography object (with ESRI 4326) and i want to make the UNION of some cities. I have in result ...
0
votes
1answer
331 views

ST_Box2D in PostGIS 2.0

I am getting an error trying to create a bounding box of a geometry using ST_Box2D(). Is the function deprecated? If so, what is the equivalent function? SELECT ST_Box2D(ST_GeomFromText('LINESTRING(1 ...
2
votes
0answers
113 views

Matching points in table to polygons

this is my first post to this forum. I hope to start participating actively. I have a table with several records (aprox 200.000), each with its own coordinates. And I need to identify the "Polygon" ...
4
votes
3answers
148 views

Sql syntax in Model builder

In ModelBuilder I am trying to perform the following query, using the select by attribute tool. I am having great difficulty with the sql syntax. What I am trying to do is Select Top 3 (Avg) Price, ...
0
votes
1answer
218 views

Defining SQL 2008 store within GeoServer 2.3

I want to define a SQL server 2008 store within Geoserver 2.3. I installed the sql Extension. After defining the different attributes, I get the following error message : Error creating data store, ...