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

learn more… | top users | synonyms

1
vote
0answers
44 views

How to access a feature by specific field value using python ogr in an efficient way?

I have one point layer and one polygon layer with a common identifier attribute field called "N", same objects amounts but Feature IDs (FID) are different. I have to iterate on the first one and what ...
6
votes
2answers
193 views

How can I cluster all points in a postgis table together based on their distance from each other?

I have a PostGIS (in postgres 9.3) table which has Points. I want to figure out the "clusters" in the data. If 2 points are < X distance apart, they should be added to a cluster, and this should be ...
1
vote
1answer
30 views

PostGIS update statement returns wrong information

I have two tables in postgis with polygon data. Both are in wgs84. I want to update a column (column1) in the one table (table1) with information from a column (column2) in the other table (table2), ...
2
votes
1answer
67 views

Creating SpatiaLite View in QGIS?

Using these instructions (there are several other examples to find, all look the same and all of them seem to work) http://www.gaia-gis.it/gaia-sins/spatialite-cookbook/html/sp-view.html "Hand-writing ...
0
votes
0answers
120 views

Convert XY to Lat Long using SQL?

My organization is creating a 311 mobile app. The backend is all run through SQL and report emails are generated. We are grabbing the xy from the app and then want to translate it to Lat/Long to be ...
1
vote
0answers
36 views

How to transfer SQL variable back into ArcPy script?

I am trying to teach myself to access sql tables from an ArcPy script as part of a larger QC process. I am fairly certain that I have the sql statement correct (it works in SQL Server, albeit ...
6
votes
3answers
98 views

Select all polygons that are completely within a circular buffer

I made several buffers around some points. Now I want to select all polygons that are completely within this buffer. My problem is that I also get the polygons that are partially outside of the ...
0
votes
1answer
48 views

How to find Nearest point on line from a point cordinate in SQL server

I want to find out the nearest point on my road network which is a multiline string from a point with lat lon value. The below code I have tried for finding buffer distance line from a point. ...
0
votes
0answers
23 views

How to Find Source and target using STBuffer And STIntersects in SQL Server?

I am using this query to find the source and target from Routes table, but it's not getting the correct result SELECT TOP 1 a.target FROM Routes a WHERE ...
0
votes
0answers
22 views

Is there a way you can see the spatial query that vector uses?

I am using geoprocessing-tools --> intersections to calculate which points are within my circular buffer. It works fine but I want to know what query(/code) vector is using so I can add some ...
4
votes
0answers
62 views

SQL SERVER 2012, Python subprocess, OGR

Need help with uploading shapefile with srid 102008 to SQL server 2012. I ran the ogr2ogr script in the ogr shell and it uploaded the shapefile within seconds but when I try using python subprocess to ...
2
votes
1answer
59 views

Use Postgis to convert wkb_geometry data type to geom datatype

How would I write an ALTER statement or otherwise to convert an existing imported data column from " wkb_geometry geometry(LineString,4326)" to a geom data type? I ask because I've moved to ...
2
votes
2answers
62 views

Is there a way to select all items within a circular buffer?

I want to select all the items within a circular buffer. Inside the buffer are multipolygons and multipoints. See the screenshot i have posted.
3
votes
0answers
53 views

How to use pythons' GeoAlchemy2 to filter on dynamically generated Points?

I'm trying to do something like this SQL query in Geoalchemy2: SELECT district_polygons.district FROM markers, district_polygons WHERE ST_Contains(district_polygons.multi_poly, ...
0
votes
1answer
86 views

Create a geoserver SQL view from Oracle SQL using a lat and lng column

I have a table in a Oracle SQL database in which I have a polygon geometry and two more columns of latitude and longitude. What I need is to show the points of lat and lng in a layer in geoserver. I ...
2
votes
1answer
67 views

Using “SELECT DISTINCT” in SQL Query for Labels?

Working with ArcGIS 10.2. I'm using GIS data downloaded from SHA and I'm using it to label roads. I have three different features I've selected to label (different kinds of roads). To keep it brief: ...
1
vote
0answers
18 views

deleting lines with smaller length and overlapping oracle spatial

I need to identifying polylines which are overlapping with each other and deleting them which is smaller in length in Oracle Spatial.
0
votes
1answer
37 views

ArcGIS Select largest N rows in group

I have feature class (Name: V1) in personal geodatabase with columns: Height [float] and Id [int] representing group number I need to do SQL query that will select eight highest 'Height' values in ...
0
votes
0answers
21 views

if then else statement in Exponare?

I am currently trying to rewrite an SQL statement for Exponare so that if the user is not the administrator only certain attribute table columns are displayed should a query or selection be performed. ...
0
votes
0answers
23 views

Selection Based on Range of Values from another table

I'll try to explain this is as simply as possible. I've figured out how to create this table in SQL, no problem. But I'd like to have this done in python as part of a larger model. I have a feature ...
4
votes
1answer
198 views

Merging multiple feature classes in file geodatabase with ogr2ogr?

Is there a way to merge multiple feature classes into one feature class in a geodatabase with ogr2ogr? If this isn't possible with ogr2ogr, is there another method? I'm using the ESRI File Geodatabase ...
3
votes
1answer
29 views

how to create a new row with a counted points in postgis

I have two tables in postgis (pgadmin). In one table there are points and in the other table there are polygons(provinces). The tables are both over the same location (Netherlands). I want to count ...
0
votes
0answers
32 views

Set alias for subfields when performing query

As mentioned within the ESRI-docs we can set an Alias for the subfields of an SQL-query performed onto a file-geodatabase as follows: IQueryDef2 filter = (IQueryDef2) ...
4
votes
0answers
91 views

Create polygon from lines in PostGIS

I'm trying to divide a polygon in smaller polygons from a line, but I think I can't use the st_split function. What I need is to create small polygons inside a big one, using linestring grid. I've ...
2
votes
2answers
106 views

Formatting SQL expression for calculate field (management) tool?

I am trying to take the population census tract and calculate the percentage of population by each census tract in the field (Populati_2). To do this I'm creating a new field with the total sum of the ...
1
vote
1answer
54 views

Possible CartoDB SQL add-on?

Is there a possible add-on that will simplify the user experience when creating a SQL statement? More specifically, is there a GUI that would allow the user to create a SQL statement similar to ...
1
vote
1answer
42 views

Get lat and long in two columns as floats for all points in MULTILINESTRING in PostGIS?

ST_DumpPoints(geom) gives me something like this: ("{1,1}",0101000020E61000002DEDD45CEEB362C0CE1951DA1BC24E40) ("{1,2}",0101000020E6100000C94AD826F1B362C09D4B7BC72CC24E40)... Where I want it to ...
2
votes
1answer
52 views

How to create lines from coordinates?

I have a data table about national bus lines, with timestamps, vehicle IDs, line IDs (which line the bus is moving on), and coordinates(geom). I can add my points to QGIS on show them on OSM, but I'd ...
1
vote
2answers
134 views

Checking if SQL where clause is valid with Make Feature Layer?

Unfortunately it's possible to apply an invalid SQL where clause when using arcpy.MakeFeatureLayer_management. This can cause issues later in a script. For example, I created a feature layer and ...
0
votes
1answer
61 views

Arc 10.2.2 crashes when adding query layer?

I'm trying to add a query layer from an Oracle database into a blank 10.2.2. map. I enter the query, validate, finish, and the software thinks for a second and then just winks out. No error ...
1
vote
3answers
67 views

Intersection of 2 Linestrings (not interpolated)

I am struggling with a query in POSTGIS I want to find linestring geometries where the geometries are containing the same point. I don't want to calculate the intersection points. I only want to ...
7
votes
3answers
383 views

Constructing Voronoi diagram in PostGIS

I'm trying to construct voronoi diagram from grid of points using modified code from here. This is SQL query after my modifications: DROP TABLE IF EXISTS example.voronoi; WITH -- Sample set of ...
1
vote
3answers
49 views

Is a SQL String Aggregate possible in arcgis?

I have created a feature class from the results of a 1:many join between a table and a polygon layer in ArcGIS 10.3. The polygon layer contains land parcels and the table contains names. Where a ...
0
votes
1answer
33 views

Parcel Owner to see only his parcel in map application

How can i create a map where user can only see his parcel. parcel are defined has one unique ID. I have Arcgis online Server and Desktop Advanced license. the map to be published in a web application ...
0
votes
1answer
37 views

Negative numeric values in Geoserver sql view params

I want make some query based in lon/lat values of a specific place. A simple example is this: SELECT C.tipo, C.geom FROM climas AS C WHERE ST_Contains(ST_SetSRID(C.geom, 4326), ...
1
vote
1answer
69 views

Postgis/SpatiaLite SQL query to connect MySQL, Access or Oracle database

In SpatiaLite or Postgis, how can one create a SQL query to read a table from a MySql or Oracle database? I don't know **the correct SQL syntax to connect to a table in a MySql or Oracle database ...
1
vote
2answers
44 views

Viewing results of ST_Difference

I've got an ST_Difference query runnning error free in PostGIS, and in PGAdmin I can see the output table but it's not viewable in QGIS - The table name appears in DB Manager but says "There is no ...
2
votes
0answers
36 views

QGIS - WHERE SQL within a processing.runalg statement for v.surf.rst in python console

I'm creating lots of raster files with grass:v.surf.rst so rather than using the graphical interface I wanted to use the python console (and potentially put in in a script at some point). However ...
1
vote
1answer
84 views

How to make a SQL query that would sum multiple records in ArcGIS?

I've got a large file geodatabase that contains a polyline feature class of water-pipes. The feature class have many fields, but the ones that I'm interested in is that of the water-pipe's Length and ...
1
vote
1answer
26 views

Polygons created for holes after running ST_Collect

I ran an ST_Collect query on a polygon dataset using ogr2gor -dialect sqlite -sql SELECT ST_Collect(geometry),id FROM wl_test GROUP BY id The result is a multipart polygon, which is what I want, ...
1
vote
1answer
23 views

postgis: union of faces of st_dump

I am trying to make a web application that renders 3D buildings (LoD1). I have a PostGIS (2.2.1dev) database which contains the 2D geometry of the buildings and the height. I used st_extrude to make a ...
0
votes
1answer
35 views

Using MapInfo SQL?

I am trying to create a map of U.S. counties that shows migration patterns. I have a table of all US counties and a table that has migration information. Some counties do not have migration, ...
2
votes
1answer
179 views

How to use ST_DWithin to query features from one table within a distance of a specific feature or features in another table

I'm pretty new with PostGIS. I have a parcel layer and a census block layer in a postgres database, and I would like to be able to query out all census blocks within a specified distance of a specific ...
0
votes
0answers
71 views

PHP, PostGIS & Geojson

I'm using Lumen to connect to postgis and I want to execute this query: WITH query AS (SELECT ST_GeomFromGeoJSON('{"type": "Polygon","coordinates": [[[366063.228612569917459, ...
1
vote
0answers
40 views

Inserting search box using dataset column using CartoDB?

I have got some problems to add a search box that can runs searching points from a column of my dataset. I've read this article: How can I link the search box to a dataset column in CartoDB? but ...
0
votes
1answer
88 views

Using function in SQL query with ArcPy?

I am trying to join points to polygons based on whether their addresses match as well as if the distance between them is less than 2500 feet. I defined a haversine function that computes the distance ...
2
votes
1answer
42 views

GRASS PyWPS Create a new vector map from user selected polygon

My goal is to select a specific polygon in which the user clicked and make a new vector map that contains only the selected polygon. I see two ways: Convert XY coordinate from literal input to a ...
0
votes
0answers
10 views

Using predefined variables in whereclause? [duplicate]

Can't seem to figure out how to use variables for an SQL whereclause in python. e.g. want to select_analysis(layer, "new sel", field = attribute) with field and attribute being predefined by user ...
2
votes
1answer
89 views

Esri ArcSDE 10.3.1 Query Inspire Metadata from Oracle (11g) Enterprise GeoDB via SQL

As the title says - I want to create a query in Oracle SQL which will read all dates from the geoprocessing history which can be found using ArcCatalog to show the "Description"-tab from a feature. ...
2
votes
0answers
28 views

Filter features based on attribute percentage threshold [duplicate]

I have a layer (vector layer imported from a Shapefile) in QGIS 2.8.3 with a bunch of features with a single numerical attribute, 'level'. I would like to filter the features with a threshold that is ...