Tagged Questions

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

learn more… | top users | synonyms

2
votes
1answer
54 views

Spatial joining syntax

A standard PostGIS point-in-polygon query might look like this. (example tutorial) SELECT p.*,b.polyname FROM points p, shapes s WHERE ST_Within(p.the_geom,s.the_geom) Imagine this was not a ...
1
vote
1answer
44 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 ...
2
votes
2answers
40 views

PostGIS SQL NOT EXISTS Statements? [closed]

I'm trying to query my PostGIS database for ID of people who did X but did not do Y. I've attempted the query below, but it does not return any results. I'm very new to SQL so I may be overlooking ...
5
votes
2answers
185 views

Selecting maximum Value based on other field using ArcMap?

I have problems with a SQL query. The table looks like this, it is a point feature class both in postgres and file geodatabase, I am working in ArcMap. name: elev_p HEIGHT AREAid 100 1 200 1 ...
2
votes
1answer
57 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 ...
1
vote
0answers
39 views

How to query the data using SQL in the infowindow of CartoDB

I want to use a SQL join to merge data from 2 tables and display it in the info-window. When I give my query Select table_2.hos_name,table_2.revenue from table_1,table_2 where table_1.area_name = ...
2
votes
2answers
97 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
1answer
51 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 ...
5
votes
2answers
61 views

How to select random adjacent census tract

I have set of census tracts spaced out across a city and I would like to randomly choose an adjacent census tract to explore nearby demographic data. I'm not sure if there is an easy process for ...
1
vote
0answers
15 views

Creating weighted list using Select tool in ModelBuilder?

I've done a raster to point conversion and have a column of the grid codes. Let's say it is composed of 10 numbers [9,5,7,1,7,3,7,2,8,1]. Right now I am doing a selection on those numbers based on ...
2
votes
2answers
73 views

Using MAX in SQL Expression of ArcGIS ModelBuilder?

I am trying to use a SQL expression in order to select values that are >= 25% of its max value in that column. For instance, VALUE >= MAX(VALUE)*0.25, and those will ultimately be the selected ...
1
vote
1answer
38 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 ...
3
votes
0answers
65 views

How to export data from sql server into shapefile in the decimal format in QGIS 2.4?

The last couple of days, I have been working on exporting data from SQL to a shapefile in QGIS 2.4. While converting into a shapefile, the data type changes automatically from Float to Integer in the ...
1
vote
1answer
134 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
0answers
52 views

How to export data from sql database in the decimal format in QGIS?

Currently I am working with QGIS and fetching data from SQL server and export it in the format of shapefile in QGIS. While importing the data from sql server attribute table showing data with ...
2
votes
1answer
70 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 ...
0
votes
0answers
49 views

PostGIS Spatial query taking a very long time

I'm trying to return a count of crimes (points) that occur in each police grid (polygons), as well as the geometry data, but the query takes ~22 seconds. This seems oddly high and will be problematic ...
1
vote
1answer
36 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
0answers
21 views

Hindi character support in MS SQL 2012

I have spatial MS SQL 2012 and i need to store hindi characters in a column. I tried using nvarchar datatype but I'm getting only "Question marks(????)". Is it possible to store non-english ...
1
vote
1answer
32 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
0answers
42 views

How can I make PROC GMAP (SAS) run is less time?

I am trying to create a map of Australia, by Local Government Area (LGA), with shaded regions displaying the population for each LGA. The shape file can be downloaded from the Australian Bureau of ...
0
votes
0answers
32 views

Neighbours list extracted out of polygon regions

I've got a SQL database which contains some coded polygon structures. Those can be extracted as follows poly <- data.frame(sqldf("SELECT ST_astext(geometry) FROM table")) The data.frame 'poly' ...
1
vote
1answer
33 views

Setting the Geometry with sql query

I am trying to merge data from a U.S. states shapefile with data on each state. I used this SQL query which is supposed to work: SELECT * FROM child_poverty_by_state UPDATE child_poverty_by_state ...
0
votes
0answers
20 views

How to get sql error from postgis when a plugin fail to load vector layer?

I am writing a plugin for qgis that load a sql layer from postgis database. I am disappointed that when the layer fails to load i can't find a way to get the sql error message from database server. ...
0
votes
1answer
60 views

How do I reformat numbers to only show a certain number of significant digits in CartoDB?

I need to round numbers that are in my table in CartoDB, so that in the Map visualization infowindows I only show results to two decimal digits rather than the long decimals that are currently ...
1
vote
0answers
49 views

connecting cartodb to existing mysql database

I'm trying to create a simple heat map based on longitudinal and latitudinal map coordinates that can be transferred from a database on mysql that I've created. I read that cartodb can be connected to ...
0
votes
1answer
61 views

Controlling page count increment of Data Driven Pages using ArcPy?

I was wondering if there is a way to add coding to Data Driven Pages with python. I would like to be able to take the "Data Driven Page with Count" and increment the count by one or in some cases ...
1
vote
1answer
75 views

Postgis create polygon extent/convex hull from spatial table

Please help, I have a polygon layer representing building footprints. I want to create new view in postgis that will contain rectangle representing bounding box and also another view that will have ...
0
votes
0answers
13 views

Uisng Directed force graphic to connect terminals in CartoDB?

I am starting using SQL for my internship, we are creating a map for terminals (points representating a port, train station or logistic centre) and what I would like to do is use the Directed force ...
0
votes
1answer
34 views

Arcpad 10…using sql with VBScript

I am trying to get a count of related records (Tableform) in order to validate Editform entry (using VBS). Any help getting myCount? I Know there are some syntax issues here, but is this even ...
1
vote
2answers
77 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 ...
2
votes
1answer
105 views

Query to select MIN and MAX values by groups

In ArcMap 10 i'm working in a Personal Geodatabase where the points (see screenshot below) represent the number of each house in the street. Each point has an ObjectID. This ObjectID is an unique ...
1
vote
1answer
81 views

SQL-query should return GeoJSON FeatureCollection

I'm trying to return a GeoJSON FeatureCollection object from a SQL-query with PostgreSQL 9.3 and PostGIS 2.1. This is my query so far: SELECT row_to_json(fc) AS p FROM (SELECT 'FeatureCollection' ...
1
vote
1answer
210 views

How to import .csv file to CartoDB using SQL?

How to import .csv file to CartoDB using SQL, the data given below : POINT | TOP_dm | BOTTOM_dm | X_RD | Y_RD 35AP7600 | 4418 | 4368 | 262053 | 467223 35AP7601 | ...
0
votes
0answers
28 views

time complexity of selected algorithm - SQL

I use PostGIS - SQL 1) I need know time complexity of algorithm which in I use these functions: ST_Equals, ST_Overlaps, ST_Distance_Spheroid and ST_Dwithin Is a time complexity diferent when I use ...
1
vote
1answer
161 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
149 views

How to connect to ArcSDE for using the ArcObjects Erase tool in C#?

I want to make use of geoprocessing via .NET ArcObjects, in this case of the "Erase" tool. This is easy once dealing with a local gdb file what I did for feasibility study. The issue occurs when I ...
2
votes
2answers
100 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 ...
1
vote
1answer
94 views

Trying to use SQL API from Oracle PL/SQL to CartoDB

I am trying to make an http call from within an Oracle server to CartoDB. To do so I have developed a custom PL/SQL package that will generate the SQL and make the calls. A sample API call is below. ...
0
votes
1answer
34 views

I need to test a condition within the sql in postgis.

I need to test a condition within the sql in postgis. My sql: SELECT (zoneamento3_32722.zt3), logradouros32722."NMIDEABR", logradouros32722."OBJECTID", ...
0
votes
2answers
52 views

How to join data in postgis tables to form layer with subset of attributes

In QGIS I am trying to join data from two postgis tables. I can not figure out how to do this at sql because add layer tools seem to allow one to select just one table to filter on. Instead I ...
2
votes
3answers
287 views

SQL expression error for Select Layer By Attribute

arcpy.MakeFeatureLayer_management("N05-12_Station2_JGD.shp","station_12") year=2012 arcpy.SelectLayerByAttribute_management("station_12","#",'"closing">=%d AND "opening"<=%d' % year) ...
0
votes
1answer
35 views

managing postgresql database table using the pgadminIII sql tool

i have created a database using postgresql 9.1 and a table containing parcel information for a town council database on a windows 7 OS. i created the geometry column using the SELECT ...
0
votes
1answer
86 views

SQL Make Table (from .mdb) to Point Shapefile

For my school assignment, I must compose an SQL statement which retrieves data from a database in .mdb format. I have no problem developing the SQL statement. It is a requirement that we have an ...
1
vote
2answers
107 views

Help needed with incorporating SQL query into ArcGIS python script

I'm new to python and have been trying to learn how to use it within ArcGIS. I have primarily been using the free Penn State courseware available here - http://open.ems.psu.edu/courseware I have ...
0
votes
1answer
70 views

MYSQL 5.6 Cluster / chain points by distance to any other point without millions of calculations?

I have a table of approx 10,000 - 20,000 dynamic points across the globe stored as lon/lat points. I want to cluster any point within (roughly) 3km of any other point into one point (and return the ...
0
votes
1answer
247 views

SQL Geometry Query similar to Select by Centroid

Does anyone know if it's possible to query SQL geometry by something like 'centroid of polygon'...similar to ArcMap's select by location? I'm using SQL Server 2008 R2 as the DBMS. I have two polygon ...
0
votes
0answers
37 views

Postgresql (soln would be basic SQL I think): ORDER by distance to a point and return those distances in array pairs w/ the full records

so I know there have been some questions asked about how to calculate distance using postgis and how to order results by their distance from a respective point. I'm not very talented at SQL (at all) ...
0
votes
0answers
10 views

Epoch Time Incorrectly Auto-formatted As Int

I'm accessing seismic data from a USGS geojson (set to sync in CartoDB). When the data is brought into CartoDB the column is set as an int when it should be a long int. What is the best way to ...
0
votes
3answers
57 views

AVG and GROUP BY in ArcMap

I have a Road Network shp file.(attributes include Names and Volumes ) Each road in my network consists of many links with the same name and different volumes. I want to display Road Names and ...