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

learn more… | top users | synonyms

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 ...
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.
4
votes
3answers
1k views

Automatically creating 2D-point features for ArcGIS Desktop from addresses in SQL database?

I currently have an SQL-Table which contains our buildings. I already added the table and now want to create features ( 2D-Points ) from that information. The biggest problem I have is that the ...
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
2answers
546 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 ...
7
votes
3answers
384 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 ...
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 ...
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, ...
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: ...
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 ...
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 ...
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.
2
votes
1answer
821 views

Select top 5 most items in a geodatabase

I'd like to know what is the best way to select the 5 most expensive items (in terms of actual monetary value) in my geodatabase where i have a price field. Prices are not necessarily ordered but can ...
2
votes
1answer
252 views

Connecting QGIS, SpatiaLite and Python?

I am trying to connect with python code, QGIS and Spatialite, to do SQL query. I have read some tips and I tried with this code, but no add anything. Any Idea? uri=QgsDataSourceURI() ...
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 ...
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 ...
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 ...
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 ...
11
votes
1answer
671 views

Nearest Neighbor Grouped Selection in QGIS

OK - so I have an interesting problem I am trying to solve. I have a list containing over 100,000 points in lat/long format which I have imported into qgis. Now, what I am trying to do here is group ...
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 ...
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 ...
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) ...
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
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 ...
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 ...
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 ...
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 ...
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), ...
5
votes
5answers
4k views

ExecutING SQL script in ArcGIS field calculator?

I am trying to transfer over row data from a table to columns in a shapefile table. There is a common "SA" variable between the two (i.e. the study area number) but there is more than one land use ...
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 ...
7
votes
1answer
1k views

Editing tables using SQL in ArcMap [duplicate]

We've recently started working with ArcMap, having used MapInfo previously. I've created a shapefile in ArcCatalog and want to update some columns using SQL. In MapInfo I'd write the following command ...
4
votes
3answers
2k views

Publish SQL Views from Postgres/Postgis to Geoserver

I've trying and reading how to publish a Postgres/Postgis View in Geoserver. I know that I can create an SQL View in Geoserver, but I'd like to define the View in Postgres, not in Geoserver. Does ...
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 ...
11
votes
3answers
4k views

Intersecting a raster with a polygon using PostGIS - artefact error

I'm using PostGIS2.0 to do some raster/polygon intersections. I'm having difficulty understanding which operation I should use, and what the quickest way of performing this is. My problem is as ...
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 ...
4
votes
3answers
779 views

How to select a number of rows based on current sort order

I would like to be able to select a certain number of rows from my attribute table based on their ordering and not their attributes. For example, if I sort by ObjectID, I then want to select the top ...
6
votes
4answers
1k views

Sqlite, Python 2.7 and Spatialite

I am trying to spatially enable my sqlite database: import sqlite3 db = r'c:\temp\mydata.sqlite' conn = sqlite3.connect(db) conn.enable_load_extension(True) cur = conn.cursor() cur.execute(r"SELECT ...
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, ...
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, ...
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 ...
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
2answers
193 views

APDM - error exporting database from Oracle

I have a fairly large database on a slow network and I am using a third party tool to update data which calculates other fields and so on. I have a guid string with an empty box (weird glyph - seen ...
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 ...