Skip to content

Instantly share code, notes, and snippets.

@trolleway
Last active August 29, 2015 14:23
Show Gist options
  • Save trolleway/67e3a8fe6b49f269ae0a to your computer and use it in GitHub Desktop.
Save trolleway/67e3a8fe6b49f269ae0a to your computer and use it in GitHub Desktop.
--Запрос выдаёт пикетные отметки по одиночной линии из таблицы trolleybus, на которых находятся магазины (из таблицы prodykty). Работает с EPSG:32637 (для Москвы)
SELаECT
row_number() OVER (ORDER BY 1) AS i, produkty."@id",
produkty.geom,
round((ST_line_locate_point(trolleybus.geom,produkty.geom) * ST_Length(trolleybus.geom)/1000)::numeric ,1) AS pk,
COALESCE(produkty.name,produkty.operator,produkty."@id") AS name
FROM produkty, trolleybus
WHERE ST_Intersects(produkty.geom , ST_Buffer(trolleybus.geom,500))
ORDER BY pk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment