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

learn more… | top users | synonyms

5
votes
2answers
73 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), ...
1
vote
3answers
210 views

ST spatial queries to select multi-level location

I'm trying to write a query in SQL Server using 1 set of points and 2 sets of polygons. The polygons overlap, and I only want to select the points that fall inside of 1 polygon but not the other. I ...
0
votes
1answer
47 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
48 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 ...
3
votes
1answer
811 views

How to create a search box and SQL statement for searching an attribute field?

How can I add a HTML search bar that the user can use to search an attribute field for a polygon layer, and then tie that input into the SQL statement? So far I am able to hard code the query of ...
1
vote
2answers
173 views

Cartodb - Error: sql is read-only in NamedMaps

My map is not a named map. Map privacy is set to only people with the link. Why I I getting this error when trying to do queries? Has anyone else run into this?
5
votes
3answers
20k views

Using String Functions (LEFT, RIGHT, MID) in Select By Attributes against a File Geodatabase using ArcMap 10

I finally (albeit reluctantly) made the switch from a personal geodatabase (pGDB) to a file geodatabse (fGDB) not too long ago. The main reason it took so long to switch has to do with how Select by ...
3
votes
1answer
483 views

SQL Server UNion of geography feature returns FULLGLOBE result?

I have some trouble with sql server 2012. I store coordinates of french cities in my database as geography object (with ESRI 4326) and i want to make the UNION of some cities. I have in result ...
0
votes
1answer
509 views

CartoDB layer selector - selecting data from 2 layers

I used the CartoDB layer selector example (http://cartodb.github.io/cartodb.js/examples/layer_selector.html) with my data. Works fine. Now, what I really want to do is to select data from 2 layers at ...
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
2answers
38 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 ...
4
votes
2answers
1k views

Select by attribute expression invalid in python

I'm not sure how my expression is failing. Any ideas? inPoints = "points.shp" i = 0 arcpy.MakeFeatureLayer_management(inPoints, "pts") arcpy.SelectLayerByAttribute_management("pts", "NEW_SELECTION", ...
0
votes
1answer
36 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
12 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 ...
3
votes
2answers
46 views

Polygon another location

Using google maps I have located 4 points and have created a polygon with them in this way insert into dummy_zip values (4,'prueba_directa','2016-04-13 ...
2
votes
1answer
636 views

How do you create a CartoDB viz with a dynamic SQL statement?

I want to create a CartoDB viz where the where parameter in my SQL statement changes dynamically at runtime. When I share my CartoDB viz from the dashboard, I can't help but notice the the SQL ...
1
vote
1answer
35 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 ...
0
votes
0answers
48 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 ...
3
votes
1answer
54 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 ...
3
votes
1answer
71 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
39 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 ...
0
votes
1answer
1k 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
1answer
41 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
1answer
23 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() ...
0
votes
2answers
20 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 ...
1
vote
1answer
17 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
39 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
276 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 = ...
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 ...
2
votes
1answer
36 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 ...
2
votes
0answers
27 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) ...
3
votes
1answer
65 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 ...
2
votes
1answer
398 views

How to make SQL definition query in ArcGIS to show only unique values (hide duplicates)?

I have a vector file with field of type LONG. Some values of this field are duplicates. Is it possible to make such SQL definition query in ArcGIS 10.3 to show only unique values without duplicates? ...
1
vote
1answer
24 views
1
vote
0answers
28 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
30 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 ...
2
votes
1answer
22 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 ...
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 ...
1
vote
1answer
41 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
2answers
176 views

Link to another table in CartoDB infowindow

I have two layers in CartoDB, one with spatial data, school_count, and one without, heisman_winners. I want to visualize my spatial layer but when a user clicks on a feature I want it to display data ...
2
votes
1answer
55 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 = ...
0
votes
1answer
240 views

WMS layer connected to SQL database

It is possible to connect a WMS layer to a SQL database or other type of database? Example: I have created an application with Geoserver and OpenLayers. Now I can see the data from attribute table. ...
22
votes
6answers
5k views

PostGIS: Select features that do NOT intersect

This seems to me like such a simple question (and it probably is) yet I cannot seem to find an example that gives me the answer. Using PostGIS, I just want to select points that fall outside of ...
7
votes
2answers
3k views

SQL query to have a complete geojson feature from PostGIS

I would like to get a geojson feature with properties from PostGIS. I have found an example to have a feature collection but I can't make it works for just a feature. so far I tryed to modify the ...
1
vote
1answer
36 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
1answer
660 views

What options are there for geolocation-aware SQL databses? [closed]

I need to implement an SQL database that can make queries using geo-location based logic. e.g. select rows within 500m of coordinate x, y What options are available to do this with sqlite, mySQL, ...
1
vote
1answer
44 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 ...
1
vote
0answers
74 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 ...
2
votes
1answer
32 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
39 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 ...