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

learn more… | top users | synonyms

1
vote
1answer
16 views

Error on join in ogr2ogr

I am doing an ogr2ogr process where i will be making a join between two tables, imported as shapefiles and .csv to join on a column with idential attributes. The code i've made so far looks like ...
0
votes
0answers
5 views

How to filter two layers from drop down menu cartodb.js?

I am very inexperienced with Javascript. I already have a script to query a table column to auto populate a drop down menu and query the polylines based on multiple selections as attached below. I ...
1
vote
1answer
29 views

Random Selection using Select By Attributes tool in ArcMap?

How I can make a SQL syntax to generate "RANDOM SELECTION" in Select by attributes tool in ArcMap?. E.g. We have two kind of sample: Quantitative an Qualitative data. Quantitative (seven cases): 1,...
0
votes
2answers
27 views

How to obtain Census block data in SQL format?

I am trying to create a web app where users can query a certain type of data that is offered by the Government. Unfortunately, the government prefers "Census Tract/Blocks" as opposed to Zip codes (it ...
0
votes
1answer
17 views

How find Nearest points using STBuffer and STContains in SQLServer using given point from point table?

This is the Query I am using now.. SELECT top 1 coloumname FROM tablename WHERE ROUND ((geometry::Point(74.8427116215336,12.852857058953,4326).STDistance(the_geom))*111.325,2) <2 ORDER BY ...
1
vote
1answer
19 views

How to update a line attribute in PostGIS using an attribute from the polygon in which it is contained?

I have a road dataset which I want to update using the speed information from the state polygon in which it's contained. for all roads (line) within a state (polygon) if the road speed is null road ...
0
votes
0answers
29 views

Creating Database View using ST_Buffer

I am trying to understand how to create a database view that shows a 150 foot buffer around each point in a table. The table of points changes pretty frequently and I would like to use a view instead ...
2
votes
0answers
19 views

SOL help in QGIS: rule based styling to show timestamp increase via gradient

I have some polygon data from a tractor that shows it's route among other things. It has a timestamp column which I'd like to use to show the route in which the tractor drove through the field via a ...
2
votes
1answer
51 views

Query over all layers in a mxd Arcpy

A newbie to python here. Ive been trying to query all layers on a mxd and have sucessfully implemented a script by advice on here. What I need to do now is to firstly make the query a parameter that ...
1
vote
0answers
27 views

PostGIS Nearest Neighbor query performance - can it be quicker?

I want to canvas the community to see if my nearest neighbor query can be optimized at all. I am happy with my current results, but I'm always up for improving. I have 2 tables, lakes and towns. I ...
1
vote
0answers
45 views

Getting H2GIS functions to work in Spherical Space?

I've been playing around with H2GIS (http://www.h2gis.org/) for a project at work and am struggling to get the H2 functions to operate in spherical space (lat/ lon), rather than cartesian space. The ...
1
vote
3answers
37 views

ArcGIS Dissolve/SQL group by

I have a GIS layer that has thousands of Facility IDs. For each Facility ID there can be multiple Chemical ID's. For each chemical ID there is a maximum of 3 zone types. Zone A, B, C. But there is not ...
0
votes
1answer
36 views

How to create a line into a table in Postgis?

I need to draw a line and create a new entry on an existing table in Postgis. Say I have a table called myTable and two points with coordinates 528115,181037 and 528115,181037 using the EPSG:27700 (...
0
votes
0answers
28 views

Define points within multiple lines

I have points set in certain radius. I want to define points within certain lines which represent natural and structural borders (streets(red), rail road tracks(green), water barriers(light blue), ...
0
votes
2answers
34 views

Arcpy Select by attributes IN operator with Tuple

I have two layers 1. Buffer zones with a string ID 2. the same buffer zones with the String ID plus an extra field call it zone B *this process is taking place within a loop already, just to give ...
1
vote
1answer
62 views

In Postgres how to create columns with geometry?

I have point data stored in the postgis server and I need to create a new table with their geometry values. How can I extract their coordinates and translate them into a table. Something like: ...
3
votes
1answer
50 views

Creating one layer through use of SQL queries for land use categories

I have a map with about 63 grids and trying to determine the land cover user category of the greatest area size in each grid. The land cover categories have been converted to polygons and I already ...
5
votes
2answers
87 views

SQL MAX Subquery in arcpy.MakeFeatureLayer_management

I am having an issue with subsequent subqueries in making a feature layer in arcpy. My table has fields: OBJECTID, pointid (long), grid_code (double) I can successfully extract MAX(grid_code), ...
0
votes
1answer
45 views

select neighbour polygons in sql

I have a database of few milion records (all houses in my country). Now I want to select all records who have a neighbouring record (a house next to it) and give this a status 'T'. Each record has a ...
1
vote
0answers
13 views

Append object from another layer to the new layer through form (drop-down list)

I'm trying to get to know is it possible to append object from another layer to the new layer through form (drop-down list)? Do I need to create an application? If yes please tell me what language ...
0
votes
0answers
53 views

Why does ST_Area in SQL give a different value to $area in QGIS?

The area value I'm getting using the SQL term 'ST_Area' is markedly different from that gained from QGIS functions like $area, the area measure tool and area as a derived feature (all of which agree ...
1
vote
1answer
50 views

Recurring SQL Expression Parsing Error on Query Builder

I am using Query Builder in QGIS 2.14.2-Essen to select one country (Peru) among 237 for which to show two layers (states_provinces, boundary lines) from the Natural Earth database. I am paying close ...
3
votes
1answer
58 views

How to use a polygon as a reverse cookie cutter on features in a Postgresql database

I want to be able to use a polygon in a database to remove all features and parts of features that falls within the polygon. Not as part of a query transferring the database to another database. I ...
1
vote
1answer
43 views

Postgres st_intersection points/polygon

I am trying to use the ST_Intersection function to intersect points by county and find the counts by county, but I am having no luck. SELECT counties.name, FROM counties INNER JOIN routes ON ...
1
vote
1answer
32 views

Postgres/postgis st_makepoint

I am looping through a csv, taking latlng values and trying to add there geometry to postgis enabled postgres table. xy values are int's conn = psycopg2.connect("connected") cur = conn.cursor() cur....
0
votes
1answer
57 views

Python to Postgres insert Geometry syntax

Having trouble creating geom columns and inserting geometry lat lng values into postgres table Is my syntax correct in creating the point geometry fields? st_makepoint is the point constructor. ...
1
vote
2answers
41 views

Convert colum type in PostGiS via DB Manager/ SQL in QGIS

I have a csv file that I want to bring into a PostGIS database through DB Manager in QGIS. I have a column/ field called "Location" that contains geometry (e.g. (40.789423 -75.628493 232....
0
votes
2answers
22 views

Wildcard on Geoserver SQL View

I have made the following SQL view on Geoserver: SELECT * FROM areas WHERE landuse = '%landuse%' This works perfectly fine when I specify the landuse in the URL, for example 'grass'. However when I ...
3
votes
1answer
83 views

How to loop in PostGIS to add the next lat long to a route

I want to loop over the results of a query and then pass row(n)'s longitude, latitude and row(n+1)'s longitude and latitude to another function. I have a query which returns a set of coordinates from ...
1
vote
1answer
21 views

How to determine if all polygons are contiguous by single point in SQL Server

I've been looking for some function that will consider geometries from a table. The selection would look something like this: SELECT geom FROM mytable WHERE geoid IN (1, 10, 15, 30, 2) How can I ...
2
votes
0answers
45 views

Between operator QGIS

I am using QGIS Essen version (2.14.1). I am trying to filter my data based on dates. I am wondering if the "between" operator exists like in SQL? I'm trying the following query but the results are ...
1
vote
1answer
24 views

How to get the geometry of all tables in a postgresql database?

How can I return all tables geom?
3
votes
1answer
35 views

Performing selection on Attribute and Location of two different feature classes using ArcGIS for Desktop?

I have a point FC and a Polygon FC. Both FC have the attribute VILLAGE. The point with Village = 1500 should be completely within the Polygon with Village = 1500. How can I make a selection not only ...
1
vote
0answers
35 views

Unexpected token in a sql query (Hibernate)

I have no more idea in how to run this query: SELECT row_to_json(fc)::text FROM (SELECT 'FeatureCollection' As type, array_to_json(array_agg(f)) As features FROM (SELECT 'Feature' As type, ...
0
votes
0answers
38 views

Converting polylines coordinates stored in PostGIS in column type text, in another column type geometry(MultiLineString,2154)?

I want to draw a polyline on a leaflet map and then send it to PostGis with php. I’m drawing my polylines using the Leaflet draw plugin and send the coordinates in a column “coords” in PostGIS with ...
1
vote
0answers
37 views

Compare two columns in QGIS attribute table [closed]

I have two columns in QGIS attribute table: column A = street name column B = Building type [Residential or Commercial] what I am trying to do is get "street name" with the highest number of "...
2
votes
1answer
63 views

Changing Query Layer's SQL Expression with Python

I use query layers in ArcMap 10.4. The maps need to be done/repeated periodically. The easiest way is to copy the map, change the source's SQL expression (e.g. from select * from TABLE where Period = '...
1
vote
1answer
47 views

How do I get arcpy.Select_analysis to skip conditions that don't exist

I have data from 2007 to 2015 of various animals that I'm trying to break up by year and name. I wrote a little for loop that goes through all the items in my attribute table (gps_points). The ...
1
vote
1answer
38 views

Area of influence with CartoDB

I am working on a city transport map, and for fun (and practice) I try to make an area of influence of transport station. But, whatever I try, something gets wrong. So two questions. 1 - How can I ...
1
vote
0answers
77 views

Career after GIS Analyst [closed]

I am 23 years old. BSC.IT Graduate, and currently working as a GIS Analyst in Mumbai for last 1.5 years. I am planning to do SQL Certification followed by Oracle. Would it be helpful? I am interested ...
1
vote
1answer
51 views

St_ClosestPoint within St_MakeLine Query problem

I am currently trying to create the closest point (closest_ports_point_test) on the grid (lng_grid_test) from the original points (ports_point), and to create the line connecting the original and the ...
2
votes
1answer
33 views

Postgis query to sort geometries by latitude

I am looking for an efficient way to get geometries sorted by their latitude (northmost in case of polygons) when querying a postGis database Something that could work in an order by clause which ...
4
votes
1answer
51 views

Change feature class from ESRI native geometry to SQL Server geography

Original question: I have found a lot of documentation on importing and using query layers from SQL Server into ArcCatalog/ArcMap/etc. However, when you change the projection of a feature class or use ...
2
votes
1answer
23 views

Qgis select distinct by default on Print Composer

I have a filter on Print Composer that selects "id_mov" and shows figures one by one into the map. This "id_mov" is not unique so different id can have the same "id_mov". Qgis select distinct by ...
0
votes
1answer
25 views

Spatialite union more than two layers / tables

Is there a way to union or collect any number of layer geometries with Spatialite (or another spatial database)? Two is simple enough, but more than that becomes convoluted. For example, if all I want ...
3
votes
1answer
71 views

Get domain descriptions for multiple fields using SQL (ArcSDE 10.3/Oracle back-end)

How can I get domain descriptions for multiple fields using SQL (ArcSDE 10.3/Oracle back-end)? I have successfully used the Oracle SQL in the ESRI document: Resolving domain codes to description ...
0
votes
0answers
13 views

How can I create a definition query to show the next 5 years of data, based on a text field with the year on a joined table in SDE?

I need to show the next 5 years of construction data, but I want it to automatically update what is shown based on a text field called ConYearStartNbr that shows when the construction is set to start ...
2
votes
0answers
29 views

Programatically populate field_4 after choosing values from other fields?

I'm working with QGis 2.8, editing the attribute table of a SHP file, named "myTable". I need to populate field_4 with the conditions listed below: For 1 to n (it runs across records of myTable) ...
2
votes
1answer
42 views

Export to DXF from PostgreSQL using ogr2ogr

I have a large dataset in a PostGIS database (OS MasterMap). My aim is to export specific areas of this dataset to DXF, while retaining the attributes of the data as layers in the DXF. My current ...
1
vote
1answer
67 views

Pass sql expression with GetParameterAsText to SelectLayerbyAttribute in .py script

With Arctoolbox and python scripting I'm creating long tool, but one of the steps is to select by attributes with SQL expression. Let's imagine that: featureCar = arcpy.GetParameterAsText(0) is Data ...