Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [st-dwithin]

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

1
vote
1answer
40 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
223 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 ...
2
votes
1answer
113 views

How to use use_spheroid=false in ST_DWithin?

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
92 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
68 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
141 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
204 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
818 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
151 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
949 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(-...
8
votes
1answer
2k 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
403 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 ...
2
votes
2answers
1k 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
400 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
2k 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 ...
2
votes
1answer
2k 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 ...
10
votes
2answers
3k 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 ...