1
vote
1answer
97 views

Finding closest Intersection between line strings (PostGIS)

I want to find the distance between one point (excavation sites) and a line (rivers) for the cardinal directions. What I thought would be the easiest way is to draw lines between the excavation site ...
3
votes
1answer
147 views

Improve speed of PostGIS “nearest neighbor” query?

One of the features of the Python/Django/PostgreSQL web application I'm building is that a user will be able to see the 100 other users who are nearest to them, sorted by distance. I'm using PostGIS ...
4
votes
2answers
141 views

How to speed up a query for nearest linestring to point data

I have processed a Strahler stream order layer with a lot of river linestrings (type: Multilinestring) and their corresponding strahler number (see information here). Besides I have a point layer. I ...
1
vote
1answer
56 views

Spatial Join in CartoDB

I need to update a table of points with the FIP code of the nearest county polygon from a separate table. I've managed to update the column for those points that Intersect a county polygon with this: ...
3
votes
1answer
56 views

Use selected value in postgis function

How can I use the selected value from a SELECT statement in a PostGIS function. e.g. using the geom_way from SELECT geom_way FROM osm_2po_4pgr ORDER BY ST_Distance(ST_GeomFromText('POINT(21.323329 ...
1
vote
0answers
225 views

Loop though records in PostGIS (using PL/PYTHON or PGSQL)

I've seen many example of loops, but I can't get that one to work. I work for a regional transit agency and each year, we conduct several surveys. I geocode everything to the house level for internal ...
1
vote
1answer
189 views

nearest neighbor with postGIS and nodejs

I'm using postgreSQL 9.1 , postGIS 2.0, nodejs 0.10.12 and the latest version of node's pg module. I use websockets on the server side. I implemented a function that tries to find the 5 nearest ...
2
votes
1answer
279 views

Find nearest neighbours faster in PostGIS

I currently have a query that calculates the number of useful amenities within a certain radius of each town, using OSM data: create table places as select town.name, place, town.way, ( select ...
1
vote
1answer
366 views

Accurate and fast nearest neighbour, which distance function should I use and how to it speed up? [duplicate]

I am solving the following problem: I have a map with many points in it and I need to find the nearest point to given location. Each point carries information about it's latitude and longitude. This ...
2
votes
1answer
221 views

How to return nearest point to input lat/long with distance?

I am trying to write a query with PostGIS that returns one row where the geometry of that row is the closest to an input point. I would also like to include the distance between these points in the ...
10
votes
1answer
435 views

How to efficiently find the closest point over the dateline?

I have a PostgreSQL 9.1 table with hundreds of thousands of PostGIS POINTs. For each of these I'd like to find the closest point in another table of POINTs. The points in the second table represent a ...
11
votes
3answers
2k views

Optimizing a nearest neighbor calculation using PostGIS

I'm using PostGIS to calculate the nearest neighbors of polygons. What I want to calculate is the minimum distance from each polygon, to the nearest polygon. Thus far I have got great help from Mike ...
6
votes
1answer
966 views

Nearest Neighbor calculation in PostGIS

I'm learning how to use PostGIS and spatial databases for analysis. What I am trying to do is perform a calculation to get the distance for the nearest polygon in a file, using the edge calculation, ...
11
votes
6answers
605 views

PostGIS: Assign ID of point in layer A to closest point in Layer B

This should have been an obvious precursor (that I didn't ask) to my other question: PostGIS function to create spider diagrams? If I do not know the relationship between a point in layer A (stores) ...
17
votes
7answers
6k views

Nearest neighbor between a point layer and a line layer

I've asked this question several times on stackoverflow and irc between #qgis and #postgis and I also tried to code it or implement it my self in postgis with no real answer. Using programming (most ...