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

learn more… | top users | synonyms

1
vote
1answer
29 views

Parting lines based on intersection with polygons

I have two tables: roads containing one row (line) for each road with column road_code uniquely identifying the name of the road; districts containing one row (polygon) for each district with column ...
1
vote
1answer
80 views

Cartdodb change public map in real-time with SQL query

I'm a data science student working on my capstone project. I'm new to CartoDB and have been playing around with their API a bit but can't seem to find what I'm looking for. I have created a public ...
1
vote
1answer
38 views

Truncate a Shapefile field with SQL and ogr2ogr

I want to create a new attribute which is the first 8 characters of another, using ogr2ogr. To my surprise, this didn't work: ogr2ogr -f "ESRI Shapefile" a.shp b.shp -sql "select FID,left(FLOORKEY,8) ...
3
votes
1answer
76 views

Data Insertion from .CSV file to a Feature Class attribute Table in ArcGIS for Desktop?

I am working on water network in ArcGIS 10.2. I am trying to insert data from a data.csv file to an existing feature class House Meter in personal GDB. One method I know to use is the join data.csv ...
1
vote
0answers
44 views

CartoDB: how to let users update data from the map infowindow [closed]

In cartoDB, I have a map showing public lands in a German city. I want to integrate a form into the cartoDB infowindow to let the user update the data table. How can I pass the values from the form ...
0
votes
0answers
38 views

MAX value in SQL

I have used a variation of this sql statement successfully in the past but can't get it to work now. I have a table named "RS_Event_All_NE_25_Weekdays" in a personal geodatabase running on arcmap 10.2....
0
votes
1answer
65 views

CartoDB - PostgreSQL row_number() using PostGIS ST_Distance

I'm currently working on a query that should return a subset (i.e. "new") CartoDB table sorted by proximity to a given point. I want to display labels on the map corresponding to the closest, second ...
0
votes
0answers
47 views

SQL script for postgis column name with colon

I have an sql script that creates some tables from the default planet_osm_point, planet_osm_line, planet_osm_polygon tables which are created with the osm2pgsql command line tool. DROP TABLE IF ...
1
vote
1answer
40 views

Cartodb sql not executing

I am a beginner, learning the cartodb-API. below is my javascript code which is below my body tag in the HTML page. The map, together with the points are loading correctly but the SQL command is not ...
3
votes
1answer
59 views

SQL check if first value in line is number

In the layer definition query in ArcGIS 10.4 I want to only use objects that look like 1/12 Main Street 12-2 Side Street etc and not ones that have Main Street Side Street Is this possible? So ...
0
votes
1answer
53 views

PostGIS Query Geometry Field Truncated

Some of the geometry fields that are returned from my PostGIS queries are truncated. When I first found this error any geometry fields with more than a few thousand characters would not show up in the ...
4
votes
2answers
230 views

Correct SQL expression when looping different fields

I'm having trouble with the follow lines of code. Practically what I am doing is a 10 shapefile loop in which field represents the name of the field that I want to be calculated( the name differs by ...
1
vote
1answer
50 views

Loop through a list and concatenate a string in Arcpy

I'm making a program where the user enters some codes (GetParameterAsText) that are going to be used in a SQL expression to select by atributes. I tried to find similar topics but didn't find a ...
2
votes
1answer
56 views

Renaming a table in the QGIS DB Manager

When creating a PostGIS table (e.g. 'lakes') in the DB Manger a primary key ('lakes_pkey'), a index ('sidx_lakes_geom) and a sequence ('lakes_gid_seq') are also created. But when renaming the table ...
2
votes
2answers
45 views

How many query points fall within distance X to a set of LineString

I have a set of 10 query points and I want to know how many of them are with distance within at most 4 meters of any LineString in a given table. Note that if a point is within 4 meter distance to ...
0
votes
1answer
75 views

Select Layer By Attribute: SQL Expression using ArcGIS ModelBuilder?

I am currently using ArcMap 10.3's ModelBuilder. Having created a feature class of 300 zones, I would like to filter these to the 15 zones above 200 hectares in size, the model is shown below: I ...
1
vote
0answers
56 views

How do I create an attribute table in a web page from GeoServer using JavaScript?

I'm trying to create a custom web application using Leaflet and Geoserver. I've got my layers visible in a map viewer, but I'd also like to show an attribute table of the visible map layers. I can't ...
1
vote
2answers
97 views

Finding values that are different between two tables in MapInfo/MapBasic based on a unique ID

I am comparing 2 tables which are mostly the same but there have been some amendments, in effect comparing a new version to the old one and displaying all the records with changes in a selection table ...
2
votes
0answers
27 views

Write userID to field automatically every time an object is edited

Currently every user has to put his/her useriD in a field after every change made to an object in the database. This takes time and can be forgotten easily. Is there a SQL-Command giving back the ...
2
votes
1answer
55 views

How to update a timestamp in SQL?

I've explored this forum fairly extensively trying to get answers as to why my SQL isn't working. I need help with the timestamp on a torque map. I've used the following formula, obviously changing ...
2
votes
1answer
36 views

How to get Cartodb.js to use https?

I have a simple SQL query from my Cartodb account to populate a chart. Here is the link The chart works fine outside my company on a public network but I keep getting the following error when ...
2
votes
1answer
106 views

Grouping polygons by spatial attributes

I'm working with a dataset that contains millions of polygons representing leased properties. In many cases, there are multiple polygons that are drawn on top of one another (representing multiple ...
3
votes
2answers
43 views

replace records in layer with records form another layer by id and column name QGIS

I have a two polyline layers - one with 2800 rows, the other with 150 rows. Each row has a unique id column. I need to replace the records in one column of the the 2800-row layer with the records ...
-2
votes
1answer
44 views

How much RAM do I need per SDE DB [closed]

Estimating RAM required is never a fixed number. However, there are base figures to follow for example for arcgis server services. How much RAM do I need to plan per DB? I'm using SQL Server but ...
0
votes
0answers
30 views

Null output from Transform function of Spatialite

I am using Spatialite, an extension of SQlite and I have some problems running the transform function. According to the Spatialite functions page (http://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2....
4
votes
2answers
154 views

In terms of SQL, what exactly is Query Layer's “Unique Identifier” doing?

When you make a link with a database using Query Layer in ArcMap, you must select a Unique Identifier, which ensures that the resulting Layer only has unique records in the Attribute table. In some ...
7
votes
1answer
182 views

Join by attribute / spatialite with SQL / left outer join in QGIS

I have a layer with polygons (let's call it "woods") that is intersected by "n" line-objects ("roads"). Every road has an unique attribute roadid. I need to add ALL the roadid's (not only the first ...
3
votes
1answer
353 views

Running PostGIS ST_ClusterWithin on large dataset?

I am trying to use the new ST_ClusterWithin in PostGIS 2.2 to help me aggregate building polygons that are within 5 metres. The source data has > 13million polygons. I ran the following query on a ...
3
votes
1answer
42 views

How to replace a directory using QGIS Field calculator?

I have a column called Hotlink full of incorrect directories and I need to edit them. They currently read C:/ABCD/filename.pdf and I want them to read C:/Maps/ABCD/ABCD/filename.pdf The script I'm ...
2
votes
0answers
48 views

Using Make Query Table to join featureclass with table using 2 fields

I would like to join a forest density table to a forest ownership featureclass in a geodatabase based on two columns in each (TPO_Owner and County_Nm) so I can populate the Density column in the ...
1
vote
1answer
31 views

Selecting the minimum point in a polygon

I am attempting to find the minimum point value within a polygon using ArcGIS 10.3. I have two datasets: 1) A series of polygons & 2) A series of points scattered about. After selecting a given ...
1
vote
0answers
27 views

Subset of spatial data causes slow SQL Spatial STIntersects

I've been having an issue were a specific subset of data causes an SQL spatial intersect to run extremely slowly. I am running sets of 1000 points against a subset of polygon layer to be intersected. ...
1
vote
0answers
56 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
259 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
31 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
71 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
164 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
37 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
104 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 buffer....
0
votes
1answer
91 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
36 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 (ROUND((geometry::Point(73.0135494838,19....
0
votes
0answers
24 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
73 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
86 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
64 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
70 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, Point(markers....
0
votes
1answer
114 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
81 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: I'...
1
vote
0answers
19 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
40 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 ...