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

learn more… | top users | synonyms

2
votes
1answer
123 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 ...
2
votes
1answer
249 views

Creating a model to run a complex query

I'm just a rookie when it comes to creating models in ArcGIS. I have two shapefiles from which I need to calculate an AVG and a MAX erosion rate for individual properties. The two shapefiles are: ...
2
votes
2answers
1k 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.
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
1answer
46 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 ...
2
votes
2answers
28 views

Selection subquery using another table in database ArcGIS

I need to 'extract' a list of variables based on the IDs from another table. Using a subquery seems to be the best method. I have a large list of variables and have outside calculated a second list. ...
2
votes
0answers
26 views

Showing Linestring from SQL statement with CartoDB

I have cartodb sql statement to return what polygons are intersected by a linestring, but I'd like to have the linestring visualized over the polygons on the results. Also not add the linestring to ...
2
votes
1answer
60 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
2answers
67 views

Finding Polygons which do not touch any other polygon in a single oracle database table

I currently have an oracle table of approximately 100,000 records - all of which are polygons. I want to find all the polygons which do not touch any other polygon within the same table. There are a ...
2
votes
1answer
70 views

Conditional SQL Query

I've been running a code that searches a desired field in a feature class and performs an specified SQL query based on whether the field is string or double. The variables are just temporary fillers ...
2
votes
0answers
33 views

Multiple Cursors

Below is the sql statement which I have explained below. Declare Cursor c1 is select store_number ,0 as total_area,0 as BG_ID ,0 as store_geom from table1 where CLIENT_ID= 1 and ORG_ID ...
2
votes
2answers
87 views

shp2pgsql mangles date field — quotes data as if it were char or varchar

I'm attempting to import a shapefile into postgis via shp2pgsql. Among the fields in the shapefile's .dbf file is a date field with format yyyymmdd, which is a valid date format for postgresql. ...
2
votes
0answers
55 views

What is the MS SQL Spatial syntax for counting points within polygons? [duplicate]

All, What I'm trying to do is this: Count points within polygons There are thousands of points and maybe 2 dozen polygons Get a list back of the 2 dozen polygons by name and the count of points ...
2
votes
1answer
279 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 ...
2
votes
1answer
294 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 ...
2
votes
0answers
117 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" ...
2
votes
0answers
160 views

Select a distinct attribute with maximum shape area

I am trying to manipulate a large dataset containing a lot of sliver polygons resulting from an overlay operations. (The eliminate tool is very time consuming to generalize them.) I identified the ...
1
vote
1answer
97 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
3answers
243 views

Differences between SQL dialects in QGIS vs ArcView vs Oracle

I'm kinda new with SQL queries and there is something I don't get: A SQL query in QGIS is written differently than the same query in ArcView and will probably also be written differently if I want to ...
1
vote
1answer
160 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
4answers
594 views

How to find the center point of MULTILINESTRING?

How to find the center point of MULTILINESTRING, which lies on the multiline?
1
vote
1answer
174 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 ...
1
vote
1answer
83 views

How to get routes in the database that intersects circle?

I have routes (linestrings) recorded in the database. I want to create a query which returns the routes that have some commonality with a circle whose center and radius are passed as parameter. I ...
1
vote
2answers
269 views

QGIS Select by Expression

A basic QGIS 2.2.0-Valmiera, Select By Expression - Field Calculator question. Introduction I am a geologist searching through a geological database (see attached figure). I have a shape file and ...
1
vote
2answers
128 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
1answer
564 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
2answers
42 views

STCentroid Question

Hi I'm not sure if I should ask in here or another SE site, however I was wondering if anyone knew if it is possible to configure the results from a STCentroid select statement? If I run a select ...
1
vote
3answers
179 views

How do I use SQL in the field calculator to populate a new column?

Courtesy of Geofabrik I have a "places" point shapefile which includes in the attribute table a column named "type". As can be seen in the attached image the column contains fields such as "city", ...
1
vote
1answer
298 views

Trouble with INSERT in PostgreSQL 9.1

I am trying to execute the following: INSERT INTO lithic (cp_east, cp_north, type, material, art_count, comment, field_no, gps_unit, initials, rec_date, cortex, geom) SELECT (cp_east, cp_north, ...
1
vote
2answers
948 views

Error adding data to Geodjango database: parse error… within geometry

I'm trying to insert some values into a Geodjango database, but getting errors. This is the table: class Place(models.Model): placeid = models.IntegerField(primary_key=True) structidx = ...
1
vote
1answer
36 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 ...
1
vote
2answers
142 views

Sql Query for percent of buffer filled with objects

Hi I am trying to write a query to find the percentage of a buffer polygon (Called 250_Buffer) that is filled with or contains other polygons in another layer (Called Development) any help that you ...
1
vote
1answer
34 views

Keep column titles when exporting SQL query in MapInfo

Is there a way to keep column titles when exporting a query in MapInfo as a csv or a new tab. This is my result: And my export looks like this: It's not a major issue, I jus like saving myself ...
1
vote
2answers
119 views

How to select objects by N:M join?

I have a layer with some geometries and a data layer that defines an M:N relation. Is there any way I could select (on the map) objects that are in relation with specific id? Basically I would like to ...
1
vote
1answer
70 views

SQL within Python Script to get only part of the expression by GetParameterAsText

I was wondering if anybody could help me. Im trying to create a tool within ArcMap using a python script. Within the script i've been trying figure out how to change it so that I only need to get ...
1
vote
2answers
99 views

How can I create a hexbin layer using the SQL and CartoCSS parameters in cartodb.js?

CartoDB has a great hexbin visualization wizard baked into the client dashboard: However, I like using cartodb.js to customize events and interactions; in particular, I'd like to make styles ...
1
vote
1answer
337 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
256 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 ...
1
vote
1answer
93 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 ...
1
vote
1answer
32 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 ...
1
vote
1answer
32 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
1answer
29 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 ...
1
vote
1answer
90 views

PostgreSQL/PostGIS: create spatial view

I have a polygon layer and a point layer. 1) I wrote a spatial query to count how many points fall in each polygon: SELECT polR.codeR, count(pntAZ.geom) as tot_pntAZ FROM boundaryR as polR LEFT ...
1
vote
1answer
35 views

How to refer to a variable from the conditional statement in the ExtractByAttributes function in ArcGIS 10?

Trying to use the ExtractByAttributes for rasters so that I have multiple attribute values that I want to extract. This works fine: myraster = arcpy.sa.ExtractByAttributes("source_raster", "VALUE IN ...
1
vote
1answer
64 views

MSSQL server 2008 dissolve sql query

I have a set of spatial objects in a MSSQL server 2008 R2 trying to dissolve adjoining objects where one of the attributes are equal. The table below is somewhat representative to my original table: ...
1
vote
2answers
101 views

How to form SQL Expressions with mix of integer/numeric and text/string fields/values in ArcPy?

I am trying to create a query for the select by attribute function within a Python script.This is my current code. lot = '96' dp = 756421 lotFile = ...
1
vote
1answer
599 views

What is ArcGIS 10 definition query to select max value from table? [duplicate]

I want to select max date from may layer by below query in my Web GIS but I cannot. (SELECT MAX( GregorianDate ) FROM DrillingProgress WHERE Crew = 'c-Chabock')
1
vote
2answers
910 views

How to select all points within a circle in PostGIS?

I have set of points in a PostGIS Table (Type Geometry). Now, I need to filter points that lie in a circle with a center (C) and radius (R)! I expect C to be of type Point or Coordinates.. R to be ...
1
vote
1answer
201 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
60 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 ...