Questions tagged [spatial-query]
A query for geometric features based on their spatial relationship.
202 questions
3
votes
0
answers
65
views
PostGIS calculate grid from bounding box Mapbox
I'm working on a web map using Mapbox where users draw a bounding box. For accurate distance and area calculations, I transform the bounding box into a projected coordinate system like EPSG:5072, ...
2
votes
0
answers
30
views
Geometry search by frustum using PostGIS 3.3.4
I have a table, that represents model elements:
create table bim_geometry (
id SERIAL PRIMARY KEY,
name VARCHAR(64),
geom geometry(POLYHEDRALSURFACEZ, 0)
)
I want to get elements that fit ...
0
votes
0
answers
42
views
Is SRID not preserved in MySQL export/imports?
I have a database with spatial data stored as Polygons that I run queries such as ST_Intersects against. However if I export this database and import it the SRID appears to be lost, queries that ...
0
votes
0
answers
49
views
Finding closest road segment to GPS points in SpatiaLite
I am using the following query in SpatiaLite to find the closest road segment to a given GPS location:
SELECT id, Distance(segment, GeomFromText('POINT(-79.406166 43.666075)'),1) AS Distance
FROM rs
...
2
votes
1
answer
226
views
QGIS Field Calculator - Aggregating and Calculating Ratios Based on Y-coordinate
I am trying to use the QGIS Field Calculator to calculate the sum of a specific attribute ('demo_field') for features in a layer to the sum of the same attribute for features that share the same y-...
2
votes
1
answer
179
views
Trying to get accurate results using ST_DWithin with srid -1
I have a table where each row has a point Geometry(POINT(...)) [long lat]. These geometries don't specify an srid. Which means we're using a cartesian plane to do the calculations. All of this data is ...
3
votes
1
answer
57
views
Get spatial endpoints grouped by attribute via virtual layer
I have a set of lines consisting of several single object LineStrings.
These line can be collected to routes by attribute, e.g. a street consisting of multiple lines from crossing to crossing, but ...
4
votes
1
answer
208
views
PostgreSQL query not working in QGIS Graphical Modeler
Edit: For further context, my table does have a unique id in the form of an integer. Through the database manager, the query executes successfully and I am able to load the query layer into QGIS. This ...
2
votes
1
answer
144
views
How to fix 'BOOM! Could not generate outside point' error when using ST_Distance_Spheroid with different SRS in PostGIS
I am trying to calculate the nearest feature distance from a point using PostGIS ST_Distance_Spheroid function.
Case 1:
The point and the feature collection are in the same SRS and I am expecting the ...
1
vote
1
answer
716
views
Performance of PostGIS Query
Here's my query
SELECT "building"."id",
"building"."details",
"building"."status",
ST_AsGeoJSON("building"."center")::...
5
votes
1
answer
156
views
Dynamically style polygons in a vector grid based on value of adjacent polygon in QGIS
I am trying to achieve a solution to display spatial relations in a vector grid using rule-based styling similar to the image below:
I create the grid with the Vector>Research Tools>Create grid....
10
votes
2
answers
445
views
Create virtual line layer based on points and connectivity list?
I have two layers:
myPoints: a spatial point layer with an attribute field "ID" (entries are unique).
connectivityList: a non-spatial attribute table with two fields (idFrom, idTo). Here, ...
4
votes
2
answers
338
views
How can I use spatially filtered PostGIS layers in QGIS without losing the ability to edit them in QGIS?
I have some vector layers for a whole country stored in a PostGIS database. I want to use that data in different QGIS projects that stand for different regions of the country. In the regional QGIS ...
0
votes
0
answers
95
views
QGIS select one by one feature in a layer
I'm trying to select features one by one on a layer.
I have a line layer, I've created a buffer layer from this, and then what I want to do is to select one by one feature on the buffer layer, do what ...
3
votes
1
answer
682
views
How do I optimize a spatial query in PostGIS
I'm trying to speed up my query which should return only these polygons that are not completly overlapped by polygons above them.
My tables looks like this:
Map -> Layer -> Object
The object ...
0
votes
1
answer
211
views
Sample Multiple Raster Layers Python QGIS 3.26.1
I would like to Identify the value of 15 tiff files at the same coordinates. I am currently using an external python script which iterates through each file. How would I do this with the QGIS Python ...
2
votes
2
answers
1k
views
PostGIS query with ST_Intersects/ST_Contains is incredibly slow
I want to run a PostGIS query that selects roads (total dataset: 103 mio.) that are inside a buffer polygon. The subqueries as standalone are very fast, but when I add the ST_Contains or similar ...
1
vote
1
answer
723
views
How to add a PostgreSQL query table to QGIS
I have queried my database with the following:
SELECT tlblocation.id, tlblocation.geom
FROM "Municipalities_NL", tlblocation, tlbvenueactiveperiod
WHERE st_within(tlblocation.geom, "...
2
votes
0
answers
536
views
Use spatial query to load WFS data into QGIS
I tried to load a WFS into my QGIS project but the number and complexity of the polygon features are to high to handle for QGIS so that it throws an error. So I tried to add a spatial query to the ...
1
vote
2
answers
1k
views
Using Spatial Contains in PostGIS
When performing Spatial Contains query I am not getting expected results.
I have below use case where I want only those small polygons as shown in first image namely (1,2,3,4,5,6,7,8,9) whose geometry ...
2
votes
0
answers
45
views
Can I build a QGIS query based on the boundaries of a clipping polygon?
Several times a year I download a very large shape file which contains details of the road network of my home state. That shapefile (I'll call it the master file) is regularly updated by the provider,...
2
votes
1
answer
202
views
st_intersects with ST_Dump throws PostGIS exception
I have a query in my lines and points table.
My lines table includes MULTILINESTRING, MULTILINESTRING Z, LINESTRING geometry type data.
select *
from sde.line h2
left join sde.points b
on ...
2
votes
0
answers
175
views
Virtual layers w/ spatial query not working as before (3.18.1 vs 3.20.3)
I have a set of maps that intensively utilizes virtual layers, but last week our boss updated from QGis 3.10/3.18 to 3.20.3 in all PCs, and now the layers are not loading.
Normally they would refresh ...
2
votes
1
answer
221
views
Searching shapefile for zone containing coordinates in lat/lon format using GeoTools
I'm new to GeoTools and GIS generally. I have a shapefile containing feature polygons representing NY City taxi zones. I also have the coordinates in latitude and longitude for the pickup and drop-off ...
2
votes
1
answer
174
views
Fast AOI polygon query for matching mosaic dataset footprints
Is there any more efficient/faster way to query a mosaic dataset raster catalog (footprints) for records matching an AOI polygon?
This implementation gets slower the larger the AOI polygon is.
import ...
1
vote
0
answers
218
views
ArcGIS Server spatial query returns geometries only if they intersect all sub-polygon in multipart polygon
Single-part polygon as an input is a common use case of spatial query, it works fine.
However, I am encountering a case that I need to take a multipart polygon as an input to query some point features....
0
votes
0
answers
328
views
What is the syntax to query a raster layer in ArcGIS Server?
I'm familiar with querying a feature layer in the ArcGIS Server REST API, for example including a where clause, specifying the desired output fields, choosing whether or not to return the geometry:
...
0
votes
0
answers
288
views
Missing PostGIS functions in QGIS?
I would need to use PostGIS functions like ST_Subdivide or ST_SquareGrid; these seem however not to be available on my QGIS 3.20 installation.
Most other ST_* functions are there and work as expected.
...
2
votes
1
answer
76
views
Constructing spatial queries that include data from non-spatial tables in PostGIS
I've got a database with the following tables
CREATE TABLE survey (
id_s integer primary key,
eventdate timestamp without time zone,
locality character varying(100)
geom geometry(Point,25830))
CREATE ...
1
vote
0
answers
47
views
ArcGIS spatial query returned wrong count and ID list
I am currently encountering a very perplexing issue:
I have an ArcGIS feature layer of polygons
I am trying to query if any polygons in the feature contains a specific point
When I call the API to ...
2
votes
0
answers
46
views
Calculating how many points are in each polygon, grouping that polygon by a field in PostGIS
I have two shapefiles: One point file (occ_master) and 1 polygon file (geol_1m). The point file represents mineral occurrences. The polygon file represents geology, which can be subcategorized by ...
4
votes
1
answer
171
views
Splitting Multipart geometries using Virtual Layer in QGIS
I have a Virtual layer already set up and working, the only thing that could make it better is getting rid of multipart geometries. The query is:
SELECT
ejido, circ, radio, mzna, cc, ten, ...
5
votes
1
answer
644
views
Determine whether a polygon is completely surrounded using QGIS [closed]
I have a shapefile dataset of polygons. I would like to find those polygons that are completely surrounded/enclosed. Mathematically, this means that the perimeter of Polygon A should equal the sum of ...
2
votes
1
answer
571
views
How can I get values from a array (which is evaluated by spatial query) as default-values in other fields
In QGIS 3.16.0 I have a postgis-polygon-layer with a field "array_polygon" which contains an array.
When digitizing a postgis-point-layer-point I would like to use the different array-values ...
1
vote
1
answer
134
views
ArcMap 10.1 Slow Performance with VB.NET Code (Spatial Query) [closed]
We have just installed ArcGIS 10.1 and MS Visual Studio 10 (Dot Net Framework 3.5) to develop automation tools for Select by Attribute and Select by Location using VB.Net.
We developed a new add-in ...
2
votes
1
answer
189
views
PostGIS: Creating Polygon from lots of other geometries and then returning list of ID's in the same query
I am fairly new to all of this but in simplistic terms I have the following problem:
I need to create lines from points, and from said points group all of those within n distance of one another. From ...
0
votes
1
answer
292
views
How to build a GET request from a CSW POST request
For accessing some data in a GeoNetwork metadata catalogue using CSW, I would need the URL for a GET request that would include also a geospatial filter (bounding box) and a time of interest (start ...
0
votes
2
answers
648
views
How to "Select By Location" in ArcGIS Server JavaScript API
Is it possible to perform the equivalent of "select by location" in the ArcGIS Server JavaScript API v4.x? The use-case is "find features in Layer 1 which are within x kilometres of ...
0
votes
0
answers
714
views
Spatial Index warning from Spatial Query
I'm trying a spatial query using QGIS version 3.10 using a buffer layer and a set of species records. I wish to know how many species records fall within the buffer. When I perform the spatial query ...
3
votes
1
answer
509
views
Does ArcGIS Server support querying multiple layers of service in single request?
I am using ArcGIS REST services from a server-side app and parsing the JSON response. I need information from several different layers on the same service, and my queries are always for points.
Is ...
3
votes
0
answers
82
views
Symbolize thousands of polygons to identify similar geometries
I would like to categorize polygons with a similar enough geometry so such similarities can identified at a city-wide scale.
I'm trying to identify if street layout is a useful spatial characteristic ...
3
votes
1
answer
2k
views
How do I precisely select lines within a polygon in QGIS?
I want to select lines (bahnstrecken) within a polygon (bundesland). My goal is a selection shown in the following screenshot, which I did manually. Before I used two tools: I converted the polygons ...
2
votes
3
answers
216
views
Spatial query to return multiple values
I have a woodland scheme advice layer that has a polygon for each area of advice (brown layer in the picture). I also have a polygon layer of UK local authorities (red boundary layer in the picture).
...
1
vote
1
answer
87
views
How to find features from edge_id in PostGIS topology?
I have created topology for a set of tables with PostGIS topology extension.
Now, I want to get all linear features (which could be in different tables) connected to a particular line using a non-...
2
votes
1
answer
310
views
Change GeoPandas column value from PostGIS query
I have some QGIS layers and I am performing some spatial queries with them using GeoPandas. I'm using psycopg2 to make a connection to a local PostgreSQL/PostGIS database. Then I use the read_postgis()...
0
votes
2
answers
432
views
QGIS Modeler: Extract by location, multiple predicates
I'm creating a processing model and would like to use the 'extract by location' tool,
The problem is that when I choose this tool from the 'Algorithms' in the model creator, I cant find the double ...
3
votes
1
answer
407
views
How to do nearest neighbor search more quickly?
I am currently using geopandas and scipy.spatial to do a nearest neighbor query. I have a data set of close to a million points and I need to find all of the closest points from another data set that ...
1
vote
0
answers
95
views
Populating linestring column based on other table values (OSM nodes/ways)
I'm trying to populate a linestring column using points from another table.
After reading a lot in this site and many experiments I'm still stuck.
This is the table which I want to fill the road ...
0
votes
0
answers
321
views
WFS request using layer extent or spatial query QGIS3
I'm trying to request features from wfs-service by using a virtual layer. Is it possible to load features by using a layer extent from a virtual layer?
I know how to add dimension for a request with ...
1
vote
1
answer
164
views
How do I perform a spatial query on this area? [closed]
I am in the process of trying to perform spatial analysis bike on bicycle trip data publicly found on Citibike's website. I want to extract data for each square in the rectangle (the boundary-lines ...