Skip to main content

Questions tagged [spatial-query]

A query for geometric features based on their spatial relationship.

Filter by
Sorted by
Tagged with
8 votes
3 answers
2k 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 ...
Nicolas Boisteault's user avatar
9 votes
3 answers
4k 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:\...
BritishSteel's user avatar
  • 6,657
8 votes
1 answer
4k views

Using 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 this Error: Wrong number of parameters. Here is my ...
BritishSteel's user avatar
  • 6,657
3 votes
3 answers
4k 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 ...
csandor's user avatar
  • 243
1 vote
1 answer
76 views

Query across layers of SHP files?

I would like to query features from a SHP vector that intersect with features from another vector. Pseudocode: "Name" IS intersects( countries) How would be the valid query composed?
DaCoEx's user avatar
  • 111
0 votes
1 answer
1k views

How to use intersection in spatial guery in postgresql?

I want to get id, time and point_metric columns from intersection between two geometry(geom_lines and gem_houses). I wrote following sql code, however it fore an error (argument of WHERE must be type ...
Arash m's user avatar
  • 55
2 votes
1 answer
832 views

Spatial Query: The query from "LayerName" using "FID" in field not possible

In QGIS Wien, I am performing a spatial query with two layers (points and buffer areas) and receive the following error when creating a new layer with intersecting features: The query from "LayerName" ...
John12's user avatar
  • 31
0 votes
1 answer
472 views

SQL and ArcGIS data querying: what's the difference?

I am wondering if the language used by ArcGIS for data querying (e.g., search by attribute) is part of the SQL language, or to what extent there is a connection between the two (and where does it come ...
NewAtGis's user avatar
  • 1,546
1 vote
1 answer
981 views

PostGIS 3D bounding box query that envolves all 3 axes (xyz)

I have some experience with PostgreSQL, but not with PostGIS, and for the life of me I can't make my bounding box take the Z axis into account. I have a points table with XYZ columns. I add another ...
José Luis's user avatar
1 vote
1 answer
524 views

Number of Neighbors Around a Point

I need to get a count of neighbors within 100m for each point in a set of 250 million points. The result would have the id of each point accompanied by the number of neighbors around them. Can this be ...
picmate's user avatar
  • 347
2 votes
1 answer
703 views

Running spatial query on huge table [duplicate]

I've got two tables conatining geometry: 1 containing big polygon's (regions, srid=4326) and another containing smaller polygon's (pand, srid=28992, containg ~9.9milion rows) By using one of the big ...
stUrb's user avatar
  • 2,329
1 vote
0 answers
30 views

Help with sub-queries PostgreSQL [closed]

I wish to ask for some advice when it comes to building nested spatial expressions in PostgreSQL. I end up with the same kind of problem many times when it comes to select more than one type of ...
geogrow's user avatar
  • 1,765
5 votes
2 answers
1k 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 ...
elrobis's user avatar
  • 6,486
1 vote
2 answers
965 views

ArcGIS Javascript Spatial Query with Lat Lng or X Y?

I am using Google Maps on the front end as all I need on this view is to show the points. When user clicks on the map in the view, it selects a point hence giving out lat and lng. I am trying to use ...
Taha Rehman Siddiqui's user avatar
0 votes
2 answers
497 views

Extracting data from four intersecting polygon layers in PostGIS?

I've been using the following code in PostgreSQL/PostGIS for the last year, as needed, which is about once a quarter. It works OK, it's just that it takes days to run. With over 25,000 parcels making ...
Nathan's user avatar
  • 76
2 votes
1 answer
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 ...
Qonfused's user avatar
7 votes
2 answers
22k 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 ...
freakyfreak's user avatar
2 votes
0 answers
81 views

Select a polygon which is just partly member of another polygon with its area of the other polygon

I need to generate random points within geometries, which works quite good, but there are some small errors. Take the picture below. There are some greenish and redish Polygons(?!) which do not have ...
Benjamin's user avatar
  • 591
7 votes
2 answers
857 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 ...
EDi's user avatar
  • 265
0 votes
1 answer
562 views

How to show a map with queries from a map file connected to postgres in browser using javascript?

So, the problem is how to show a map in browser using JavaScript. I have a map file with 2 layers in it: "peta" is a shp data from PostGIS and "korban" is a numeric data from PostgreSQL, and then I ...
gagas's user avatar
  • 11
12 votes
2 answers
448 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 ...
Leigh Bettenay's user avatar
2 votes
1 answer
219 views

Get feature data from lat long input QGIS

In QGIS, I have a polygon dataset with feature data. I would like to extract data from this dataset using a latitude and longitude. To be more clear, I have a list of 1000 coordinates. I would like ...
Agursel's user avatar
  • 21
0 votes
1 answer
292 views

How to run spatial query get fields value of 2 layers?

Last month I asked vb.net arcobjects spatial query get fields value of desired layer only. Now there is some change in the requirement, I need to get value of 2 layers after use "Select Features" ...
ppLily's user avatar
  • 933
2 votes
3 answers
3k 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 ...
Matt's user avatar
  • 584
1 vote
1 answer
86 views

Spatial queries to find co-occurrences of POIs

Given a POI database containing different types of points, e.g. hospital and pharmacy, how can I select the locations where a hospital and a pharmacy are closer than a certain threshold (e.g. 1000m)? ...
Mulone's user avatar
  • 111
5 votes
2 answers
394 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 ...
alexbhill's user avatar
2 votes
2 answers
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 ...
ppLily's user avatar
  • 933
0 votes
2 answers
792 views

Counting number of points/lines/polygons contained within polygon when feature to count is from server?

I'm currently running a study where I need to query the number of points/lines/polygons that are contained within a project boundary - intersecting lines and polygons need to be counted as well. The ...
Paul's user avatar
  • 1
2 votes
1 answer
599 views

How do you create a query that will result with the adjacent parcels?

I have a shapefile with parcel data, and I am trying to create a query that will render a list or something similar that will list adjacent parcels to a specific parcel. I want to be able to select ...
Matt's user avatar
  • 584
7 votes
1 answer
7k 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 ...
Vanni Zhang's user avatar
  • 1,073
5 votes
3 answers
2k 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 ...
standers's user avatar
  • 249
3 votes
2 answers
794 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 '...
HigherPurpose's user avatar
0 votes
1 answer
731 views

How can I find the segment of a line that lies within a polygon using Postgis?

Given a "road", represented by a line, that crosses a "state", represented by a polygon: What is the SQL query I can use to find the segment of the road that is within the state? A concrete example. ...
s01ipsist's user avatar
  • 171
1 vote
1 answer
833 views

ST_Within from centroid of geometry

I am looking at doing a spatial query where I can find when the center of one feature falls within another. For example, when the center (centroid) of a building falls within a grid tile. I know I can ...
Ryan Garnett's user avatar
  • 9,549
3 votes
1 answer
5k 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 ...
user29780's user avatar
1 vote
0 answers
76 views

Count gaps between polygon in spatialite

I have a database (.db) with a table that contains thousands of polygons containing id and geometry. I like a query that can get me the 'number of errors where there are gaps between polygons". How ...
Hardik's user avatar
  • 133
2 votes
2 answers
691 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 ...
ffinnm's user avatar
  • 450
1 vote
1 answer
349 views

Running loop in query in PostGIS

I am new to PostGIS. I have a table of buildings each having a value for number of people living in it. I would like to calculate the total value (sum of number of people) in all buildings which ...
Catlover's user avatar
  • 449
-6 votes
2 answers
642 views

Creating spatial queries in QGIS? [closed]

How can I create spatial queries in QGIS?
user27495's user avatar
1 vote
0 answers
172 views

PoI Range query

I have a dataset of 100,000 PoIs represented by (id, name, longitude, latitude).. I would like to perform a large number (around 10,000) search operations on this dataset. each search operation ...
Moustafa Alzantot's user avatar
-1 votes
1 answer
751 views

How to run Spatial Query using ArcGIS for Desktop?

I have a shapefile of a forest inventory of the uk. I want to find out the total area of woodland within a 60km radius of a specific point. I have added a layer for the point and added a 60 km buffer. ...
joshua burke's user avatar
1 vote
0 answers
824 views

Find area with highest relative density of one type of object

I'm using PostgreSQL/PostGIS and I have an advanced type of query. My database contains two types of object - let's say pubs and churches :) Is there a way that I can find the area with the densest ...
flossfan's user avatar
19 votes
1 answer
12k 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 ...
User's user avatar
  • 1,243
0 votes
0 answers
959 views

Adding MSSQL spatial layer using Python

I'm having difficulty adding a MSSQL spatial data layer using Python. The database is password protected, and I can add the layer without any problems using the built in feature, but I can't make it ...
John's user avatar
  • 9
4 votes
2 answers
6k 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 ...
opensas's user avatar
  • 275
3 votes
3 answers
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 ...
Guillermo's user avatar
  • 333
1 vote
2 answers
396 views

geoprocessing across multiple vector layers QGIS2

I have 6 layers of point data (each layer is one year), where data in each layer are distributed throughout a grid, and the grid is identical in each layer. I'd like to extract data from each layer, ...
Paul's user avatar
  • 47
1 vote
2 answers
949 views

Best way to figure out which regions a point is in a shapefile?

I'm trying to figure out the best way on Android to figure out if a point in region as defined in a shapefile. For instance, I might want to know what country I'm in using the Geo Common's Shapefile ...
PearsonArtPhoto's user avatar
0 votes
1 answer
1k views

PHP/MySQL, PostgreSQL spatial queries. Find a polygon that contains a coordinate? [closed]

I am building a non mapping javascript app and I am wanting to take a lat/long coordinate and query a MySQL table of polygons for the one that contains the point. I have looked into MySQL spatial ...
ezekielweb's user avatar
4 votes
1 answer
12k 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 ...
marty_c's user avatar
  • 197