Why not ask your question on the new OpenStreetMap Community Forum?

I have a query that give me the nearest roads to a point

SELECT osm_id, ref, name, way, ST_AsText(ST_Transform(way, 4326)), *
FROM planet_osm_roads
ST_DWithin(ST_Transform(ST_SetSrid(ST_Point(-1.28779, 51.78976), 4326), 3857), way, 20)
ORDER BY way <-> ST_Transform(ST_SetSrid(ST_Point(-1.28779, 51.78976), 4326), 3857) LIMIT 5;

Now I want in the same query to get for each road the nearest point(node) for my original point (-1.28779, 51.78976) I know how to do it in separate queries, but for less DB access I want it in the same query.

Tn;x for any help

asked 05 Dec '18, 08:48

altopalo's gravatar image

accept rate: 0%

Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 05 Dec '18, 08:48

question was seen: 1,189 times

last updated: 05 Dec '18, 08:48

powered by OSQA