Questions tagged [st-dwithin]

A PostGIS function to determine if geometries are within a specified distance of one another.

Filter by
Sorted by
Tagged with
1
vote
1answer
40 views

ST_LineInterpolatePoint Error - Does not exist

I am having an issue 'snapping' a points layer (be - bristol education) onto a road network (br - bristol_roads). I have created the code below using the PostGIS in Action guidebook as a reference ...
0
votes
0answers
36 views

Run ST_DWithin on a subquery result from a different table

I have two tables "Customers", and "Providers" in my PostgreSQL DB. They both have a 'geom' column. Now, customer Table has a column called e.g. "profession". I want to ...
1
vote
1answer
41 views

Optimising PostGIS ST_DWithin across many tables for existence only

I have 13 tables containing MultiPolygons in the same projection (27700). I am trying to write an efficient query to get back a Boolean for: Is one polygon in table A within X meters of any polygon in ...
0
votes
0answers
25 views

Different results for GEOGRAPHY and ST_TRANSFORM query on geo_point field

I am finding properties that are within 20K distance using ST_DWithin. But when I try with ::GEOGRAPHY casting the result is different from ST_Transform. Note: SRID of geo_point field is 4326 Indexed ...
3
votes
1answer
113 views

PostgreSQL + PostGIS count with ST_DWithin multiple distance at once

I am using ST_DWithin to count rows that are within 5KM, What I want is count on multiple distance at once with single query i.e count for 5KM, 10KM, 20M Current Query SELECT count(*) AS cnt FROM ...
0
votes
0answers
17 views

Postgresql POSTGIS not using index field while having GIST index on geometry field [duplicate]

I have around 2M rows on my PostgreSQL table with GIST index on geo_point field but while I try to use ST_Distance or ST_DWithin it is not using the index instead it is doing Parallel Seq Indexed ...
1
vote
1answer
54 views

Find nearest polygons of a multi-line string

I am trying to find the nearerst (100-200 meters) parcels of the green line. Given The photo below, they database should return 12 records. I am using ST_DWithin postgis function. Is this the correct ...
2
votes
1answer
156 views

ST_DWithin exponentially slow. Cannot find what I am doing wrong

PostGIS version: 3.1 PostgreSQL version: 12.3 The machine I am working with has: 126G RAM, 48 CPU cores Info: I am getting started with PostGIS. My goal is to get all the matching data between two ...
3
votes
2answers
77 views

Postgres: Remove Duplicate Rows returned by ST_Dwithin query

I am having trouble finding a query that returns one row for every unique vehicle crash that is within 100 feet of a select group of road features. My query currently returns a row for every collision ...
2
votes
1answer
82 views

Extracting a Point from MuItipoint and use it for a ST_DWithin query

I have a MultiPoint geometry column which has only one point (DB is a live server which cannot be changed now). I need to find all points within a certain distance from a fixed point I provide to the ...
1
vote
1answer
187 views

Postgres ST_Distance_Sphere Runtime Improvements

I need to select all entries from a table, that are within a distance from a point. Each entry is a point geometry (I set a gist index on geom). Current runtime is anywhere between 3-15 seconds, ...
2
votes
1answer
174 views

PostGIS - Find the “median” distance between two group of geometries depending on polygon area

I want to evaluate land distribution and concentration regarding to road network. Specificly, I'm trying to calculate the median distance between a shape of roads (multilinestring) and a shape of ...
2
votes
0answers
54 views

How can I optimize this PostGIS query?

I am using this query in PostGIS to get the closests points around a trace. This query is taking a long time to run : 15 sec with only 800 records in the POIs table. The first query get a list of all ...
1
vote
2answers
190 views

Using table joins with ST_DWithin to optimise process?

I am trying to select all segments (among millions of them) that are less than X metres from a few thousands polygons obtained from a raster dataset (meaning they've got quite a complex geometry - ...
1
vote
1answer
114 views

Ways to speed up ST_DWithin between millions of segments and thousands of polygons?

I have 3 PostgreSQL tables with the following data: tab1 => It contains about 5.7 millions of segments (straight lines) tab2 => It contains 6673 polygons tab3 => It contains 19620 polygons ...
0
votes
1answer
127 views

Improve Performance of ST_DWithin - H2GIS

I have a table seg_point, that I create like this: CREATE TABLE seg_point (id INT AUTO_INCREMENT PRIMARY KEY, segmentid TEXT, geom GEOMETRY); And I'm trying to improve the performance of this query ...
1
vote
1answer
135 views

PostGIS: Running multiple intersections within a single SQL query?

PostgreSQL 11 + PostGIS, on Windows 10. I'm working with a PostGIS-enabled database. I want to UPDATE a large polygon table (100,000+ rows) WHERE the geometry of that host table intersects the ...
2
votes
1answer
232 views

PostgreSQL: Spatial join points to polygon, listing point attributes where multiple are joined

I have a large polygon table and a large point table in a postgis enabled PostgreSQL database. Each point has a unique reference number (double type). I want to spatial join the points to the polygons,...
2
votes
0answers
543 views

Improve the speed for ST_DWithin

I need to get the outer polygon of the LSOAs within 10 miles of each postcode centroid. There are 180k LSOA polygons in table1 and 2.6 million postcode centroid points in table2. I have created 2 ...
3
votes
1answer
398 views

Using use_spheroid=false in ST_DWithin of PostGIS

I have created 2 geography columns and indexed them using GIST. I am looking to use ST_DWithin for a larger dataset and to make it faster trying to use the use_spheroid=false. SELECT pois.objectid, ...
2
votes
0answers
163 views

PostGis st_dwithin super slow when inserting

I am trying to insert the newly obtained data from st_dwithin into a new table. However, it has been running since 1 day and I still can't get any data into the new table. Can i know what is the ...
0
votes
2answers
129 views

How to find all the geometries in a table which are at a particular distance from a given point in postgis?

I have a table called cartlocations:- Now I have point geometry of latitude and longitude value, say 23.4877191,86.6927571, I want to find all the geometries which are within a distance of 1000 ...
6
votes
1answer
262 views

ST_DWithin in PostGIS: Implicit index call

In PostGIS, the function ST_DWithin automatically includes a bounding box comparison that will make use of any indexes that are available on the geometries. This is done using the mechanism of ...
9
votes
1answer
246 views

Finding closest line given 2 points using PostGIS?

I have a table t that contains a column line_positions which is of type line. Given 2 points I want to find the closest line that is close enough (less than 10km) and that does not pass too close to a ...
3
votes
1answer
2k views

Postgis KNN vs ST_DWithin for nearest neighbour search with a radius

We are trying to get nearest neighbors within a user given radius. As far as I understand ST_DWithin degrades as distances are increased. The problem with using KNN is that it keeps on searching even ...
4
votes
1answer
236 views

Postgis can't find the optimum way, seems to be always using Btree index rather than spatial index

I am using the Postgis ST_DWithin function like this: SELECT *, ST_X(geometry) as longitude, ST_Y(geometry) as latitude, ST_Distance_Sphere( ST_SetSRID( ST_MakePoint(-...
4
votes
1answer
1k views

Does the performance of Postgis function ST_DWithin degrade with larger distances?

I am using the Postgis ST_DWithin function like this: SELECT *, ST_X(geometry) as longitude, ST_Y(geometry) as latitude, ST_Distance_Sphere( ST_SetSRID( ST_MakePoint(-...
9
votes
1answer
4k views

ST_DWithin Calc Meters - transform or cast?

I want to use ST_DWithin on data which is stored in SRID geometry of 4326 and use meters as the distance parameter. Is it more efficient to do a cast (e.g. data.geom::geography) or a transform to an ...
1
vote
1answer
619 views

ST_DWithin Optimization Postgis

I've got two datasets - 1) a set of buildings in LA and 2) fiber optic cable maps from a company called Zayo which covers the whole of the US. I'd like to find the buildings within a certain distance ...
4
votes
2answers
3k views

How can I optimize this ST_Distance query?

I am using ST_Distance in postgis to get the closest point in a table to each polygon in another table. This query is taking a long time to run (2 hours with 18,000 records in the polygon table and 7,...
2
votes
2answers
781 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 ...
2
votes
1answer
3k views

Improve performance on a st_dwithin query (in PostGIS)

At the momenent I am working on a query, as described in an earlier question. I have the two tables testme (tracked GPS-profile with Point Geometry) and roads (geometry roads shapefile) Besides ...
3
votes
1answer
3k views

How to use ST_DWithin to query features from one table within a distance of a specific feature or features in another table

I'm pretty new with PostGIS. I have a parcel layer and a census block layer in a postgres database, and I would like to be able to query out all census blocks within a specified distance of a specific ...
11
votes
2answers
4k views

ST_Distance doesn't use index for spatial query

I can't get PostGIS 2.1 running on PostgreSQL 9.3.5 to use a spatial index even for the simplest queries. The whole dataset is 8 million points (population count grid from here). The table is created ...