Questions tagged [spatial-query]

A query for geometric features based on their spatial relationship.

Filter by
Sorted by
Tagged with
13
votes
1answer
7k views

What is difference between ST_DWithin and ST_Distance for proximity search in PostGIS?

I have records stored in a table with latitude/longitude coordinates stored in a geometry field. I want to find all records nearby a user supplied reference point. Note "nearby" probably means less ...
11
votes
2answers
337 views

Identify points in a shapefile that have no other point within x km with QGIS

This is probably a naive question but I am struggling as a new user to QGIS. I have a very large shapefile (275,000 points, but can break this into about 10 subregions if necessary for faster ...
10
votes
3answers
9k views

Where is Spatial query in QGIS3?

I just installed QGIS 3.0 EA. I wonder where the Spatial query is? There is a ”count points in polygon” in the toolbox but it can’t count point within a polygon.
9
votes
3answers
3k views

Performing a Spatial Query in a loop in PyQGIS

What I am trying to do: loop through a point shapefile and select each point that falls into a polygon. The following code is inspired by a spatial query example I found in a book: mitte_path = r"D:\...
7
votes
1answer
1k views

How to build a query/expression to select specific points within a buffer? (in QGIS)

I have a point layer in QGIS. Each point represents a tree and each tree has information about its height as an attribute. I would like to build a query/expression to select all those trees that have ...
7
votes
1answer
2k views

How to use qgis:selectbylocation in PyQGIS?

I am trying to use the processing toolbox to perform a spatial query (points in polygon). I am not sure how to use the tool and I keep getting Error: Wrong number of parameters. Here is my script: ...
6
votes
4answers
894 views

Is there a way to use a spatial query to invert X and Y coordinates in QGIS?

Original problem : I tend to often invert X & Y in WGS84 lat/long CSV import. I'm wondering now if there is a way not to reimport the original file (as this is the basic solution for points) and ...
6
votes
2answers
12k views

PostGIS ST within does not exist

I'm quite new to postgresql and postgis so this error will probably due to some rookie mistake. I want to run the spatial query ST_within. When I describe the query like this SELECT nw.entity_id AS ...
6
votes
2answers
729 views

Find start of river

Edit: Follow-up question here (= Find headwater polygons). How can I determine the start of a river in PostGIS? I have a river network (Multiline) and want to find the startpoints of the rivers. I ...
5
votes
2answers
747 views

PostGIS: Strategy for fastest select by BBox with an ORDER BY polygon area clause. Cluster?

Update 2 (below) suggests 14% of the table geometries are stored out-of-line with the rest of the table records. This may be a useful clue. The Problem: We've got a table with appx 170,000 WGS84 ...
5
votes
2answers
217 views

How to select random adjacent census tract

I have set of census tracts spaced out across a city and I would like to randomly choose an adjacent census tract to explore nearby demographic data. I'm not sure if there is an easy process for ...
4
votes
2answers
3k views

Update field based on spatial query (QGIS)

I was an intermediate user of MapInfo and have recently converted to QGIS. I would often use MapInfo to add a column in boundary file A saying which zone in boundary file B it is contained in. However,...
4
votes
2answers
4k views

Postgis, get the points that are x meters near another point, in meters

I'm trying to find the points within a certain distance, in meters, from another point. I'm using the function ST_Buffer, but I don't get how to express the distance in meters. I'm trying with ...
4
votes
3answers
1k views

Selecting Counties within Region via Spatial Query using QGIS/PostGIS?

I'm using GQIS 2.2 and PostGIS on Postgresql 9.3. I have 5 regions in the contiguous United States. Each region has states, and each state has counties. I would like to think that the data I'm given ...
4
votes
1answer
254 views

Is it possible to have R write out .sbn and .sbx files?

I'm working on an situation where a client wants, in addition to the .shp & .prj files that I can produce with e.g. rgdal::writeOGR, the .sbn & .sbx files as well. My understanding is this is ...
4
votes
1answer
2k views

Finding State, County, Place, and Census Block FIPS codes from a coordinate (latitude and longitude)

I am looking for a way to gather the political areas (ie FIPS codes) from a latitude and longitude coordinate. For example, if I were to input the coordinates: 47.66955, -122.31259 (Downtown Seattle),...
4
votes
1answer
157 views

Calculating mileage from linestring

I'm looking to calculate the approximate distance in miles from a linestring. This post recommends using ST_Transform in conjunction with the State Plane coordinate system for my area. In my case, I ...
4
votes
3answers
814 views

Quickly make server side spatial filters for WFS layers based on other layer's selected geometries in QGIS

In QGIS 2.12.1, I have a WFS layer which is huge so I don't want my users to load it entirely but only parts of it based on intersections with geometries. Today, I'm using the query builder and ...
4
votes
1answer
196 views

Find Co-located points in single layer

I have a layer (currently the source is a csv file) with 130,000 points. Many of these points are co-located in a building room. How can I identify points that are within a small distance of another ...
4
votes
1answer
162 views

PyQGIS spatial operators(contains,equals,etc.) w.r.t. layer geometries(polygon,point,line,etc.)

I am trying to implement QGIS spatial query functionality in my plugin. I want to eliminate spatial operators which are not suitable for certain geometries. For eg. when I select layer with point ...
3
votes
1answer
7k views

spatial query st_contains postgis

This seems too simple to be asking this but I am really new to PostGIS/Postgres have been going around in circles with this. I am performing a really simple spatial query where I would like to make a ...
3
votes
3answers
657 views

List IDs of polygons within another polygon in the attribute table

I have two polygon shapefiles in QGIS I would like to have the polygon IDs of B listed in the attribute table of A for the case that they overlap. As a demonstration: I tried combinations of ...
3
votes
2answers
173 views

Test if a spatial query contains another

I have two tables : country and regions. Country contains all the Europeans countries and regions contains some subdivisions of those countries. I created a small Union of some countries and regions. ...
3
votes
2answers
272 views

QGIS Spatial query error

I have a layer of a csv file with around 700k rows and a polygon layer, both are in wgs84. I'm trying with the spatial query to calculate what point are in the polygons. The problem is that the ...
3
votes
2answers
67 views

Locating where different polygons (buffer rings) from different layers are intersected based on same attribute value (QGIS)

I need to locate where different polygons (buffer rings) from different layers are intersected based on a same attribute value. As shown in the figure, there are different buffer rings from different ...
3
votes
1answer
3k views

Get the width and height of a rectangular polygon in PostGIS

I have a table with point features saved in the my PostgreSQL database, and I can run the following query to get the extent of the point features and I turned the extent back into a geometry: SELECT ...
3
votes
3answers
3k views

QGIS spatial join, calculating distance from polygon to point layer

I am trying to perform a kind of 'spatial join' in Arcgis, joining to a polygon layer atributes of the closest feature of a point layer, as well as distance. But 'spatial query' doesn't offer an ...
3
votes
1answer
51 views

One Record Two Point Geometries - Point-in-polygon

The trip data contains the origin-destination of each trip, and both origin and destination are stored as geometries. How could I retrieve the origin and destination polygons that the points are ...
3
votes
3answers
2k views

Remove islands and completely surrounded polygons after polygonization with QGIS

I have a line map of buildings in a city. I was able to correctly polygonize the buildings in QGIS with the Polygonize processing algorithm. All the holes/islands became features as expected. Now I ...
3
votes
1answer
38 views

Making UPDATE for coordinate does not return the same value

Being totally new with PostGIS, I am trying to UPDATE one of my column on my table. The column itself is called 'center_point' with type of GEOGRAPHY(Point,4326) UPDATE cities SET center_point = ...
3
votes
1answer
187 views

Spatial query, embed in layer or project

I have 2 vector layers: 1) Polygons with parcel-boundaries 2) Polygon with project-boundaries I want to query all the parcels that are within the project-area, using spatial query 'select parcels ...
3
votes
2answers
722 views

Spatial query that doesn't seem to work

I have QGIS 2.8.2 Wien on windows 7 and quite new to QGIS. I have two shapefiles - 1 with rivers and 2 with sites located on some of those rivers. I want to carry out a spatial query to find the river ...
3
votes
1answer
2k views

Performing Boundary Select and Sum Attributes in QGIS? [closed]

I´m a MapInfo user, I´ve gone over to QGIS and it´s got a lot going for it, except for some "missing" simple features from MapInfo I just can´t do without. MapInfo Boundary Select - spatial query on ...
3
votes
1answer
138 views

Addresses within radius of vector layer in QGIS

I want a CSV file of all addresses that intersect with historical stream features. Currently, I have 3 datasets (see my blog) for this in QGIS 2.16.3 (MacOSX): a layer (.gdb) of historical stream ...
3
votes
1answer
3k views

Problem PostGIS Spatial Query ST_Contains ST_Disjoint ST_Intersects

I'm working on a project with two different tables inside a database. One contains points in a column geometry(Point,4326) type and the second one has a column geometry(MultiPolygon,4326). Now I would ...
3
votes
1answer
988 views

Finding polygons inside polygons from a shapefile in QGIS

I have a parcels shapefile that contains polygons. Condos are also drawn, but inside the master lot. I want to be able to grab all the condos inside the master lot. I saw this question/answer: ...
3
votes
0answers
43 views

QGIS Spatial Query Providers Issue

During the tutorial : http://www.qgistutorials.com/en/docs/performing_spatial_queries.html I have a error message like below. [ What is the providers mean? I really try to figure it out but ...
2
votes
3answers
2k views

drawing concentric circles in arcmap 10.1

I am using ArcMap 10.1 and I would like to know if there is a way to draw circles at a specific distance from a georeferenced coordinate. I have a property and I would like to know how far you can ...
2
votes
2answers
139 views

Comparing and find out which feature has highest shape area in QGIS?

I need to find out which polygon is having more area by filtering unique ID. the problem is I have 1000 of features which I need to find out highest occupied area for every unique value... since I ...
2
votes
2answers
60 views

Selecting lines where start and end points within polygon using Virtual Layer

In QGIS 2.18 project there are several layers, lines and polygons respectively My task is to select all lines when their start and end points are laying within polygons using Virtual Layer, see image ...
2
votes
2answers
1k views

vb.net arcobjects spatial query get fields value of desired layer only

Currently I am using ArcObjects (10.2.1) in vb.net (vs 2012). What I intent to develop is a spatial query tool. There are 2 steps in the function: (1) Use "Select Features" tool in ArcMap to select ...
2
votes
1answer
198 views

query with buffer

I have 2 points layers. One contains old address points and the second has new address points. They don't have any unique attribute with which I could join them. So, I've made a 10 metre buffer ...
2
votes
2answers
67 views

ArcGIS - Selecting features depending on 2 attributes

Ok, I guess this should be not too hard, but I can't figure it out: I have a layer "A" resulting from a layer "0" which was intersected with itself. So layer "A" contains all intersects. The ...
2
votes
2answers
101 views

Detect the point that lies inside line containing area

I have Two layers one is point another is line as indicated in picture. I want to know they way that i can detect that point is contains/intersect/near to the line so that I can add it's attribute ...
2
votes
1answer
498 views

Find nearest point given coordinates from another table [duplicate]

So I have two tables, one table is called stores which has the name of the store as well as the geom column that contains the coordinates for the stores. The other table is customers which has the ...
2
votes
2answers
448 views

How to do simple self join and touches function in postgis?

I am having trouble with this query and neighbor calculation in PostGIS. I want to find out which are the neighbors of Sweden in the table COUNTRIES which has column 'the_geom' for geometry and '...
2
votes
2answers
576 views

Is it possible to run a spatial query in QGIS 2.0 across multiple layers using a user-specified radius from a point?

I would like to be able to click on a point on a map to select all vector features (from multiple layers) within a specified radius of the point. Can anyone point me in the direction of how to do this ...
2
votes
1answer
266 views

Count points not in polygon in QGIS (difference between points and layers give unexpected result)

I have a layer of 130 points and another layer of driving distances as 6 polygon features When I use the count points in polygons I get a running total of the number of points in each polygon feature (...
2
votes
2answers
104 views

Generate a list of intersected layers QGIS

Apologies, im very new to QGIS and theres a chance what im asking isnt actually what i require, let me explain Im working with a project with multiple layers, I have a layer (lets call it layer 1) ...
2
votes
1answer
283 views

Fastest matching on nearest point

I am a total GIS noob and am trying to read weather data from a PostGIS database. The tables contain data points consisting of a geometry, a timestamp and the actual observed variable. The tables are ...