New answers tagged linestring
I made progress on this last night thanks to the answer here Select the lines that form a ring in postgis WITH RECURSIVE merge_lines(ogc_fid, wkb_geometry, path, merged) AS ( SELECT ls.ogc_fid, ls.wkb_geometry, array[ls.ogc_fid],ST_LineMerge(ls.wkb_geometry) FROM TABLE.tll_lines_selected AS ls UNION ALL SELECT ls.ogc_fid, ls.wkb_geometry, path || ...
Would it be possible to define polygons containing islands? I've tried doing it that way and it looks like this: WITH points as ( SELECT points.the_geom FROM points, polygons WHERE ST_Within(points.the_geom, polygons.the_geom) AND polygons.gid = 1) select st_makeline(points.the_geom) into line FROM points; You select all points within the polygon with ...
Here's a query that should get you what you want: SELECT a.name, b.name, ST_LENGTH(ST_Intersection(a.geom, b.geom)) FROM polygons a, lines b WHERE ST_Intersects(a.geom, b.geom);
Skip the trig, create view mypoints as select id, st_makepoint( st_x(st_endpoint(geom)) + (st_x(st_endpoint(geom))-st_x(st_startpoint(geom)))/2, st_y(st_endpoint(geom)) + (st_y(st_endpoint(geom))-st_y(st_startpoint(geom)))/2 ) as geom from mytable; then select geom from mypoints where id = 1; should work fine, for all values of id
Maybe a little bit late. This should work for the first part of your answer: WITH objects AS (SELECT name, (ST_Dump(roads.geom)).geom AS geometries FROM roads), point AS (SELECT 'SRID=4326;POINT(long lat)'::geometry AS point ); SELECT DISTINCT ON (ST_Distance(point, geometries)), objects.name FROM objects, ...
St_Azimuth may be helpful. The help page shows how to generate the degrees from north. http://postgis.net/docs/ST_Azimuth.html
Am I misunderstanding? Isn't this just: SELECT ST_Asimuth(p.geom, ST_ClosestPoint(l.geom,p.geom)) AS azimuth FROM line l, point p If you have more than one item in the line and point tables, the question of what condition you join them on becomes important, but as you described it, it's just one item in each.
At first, have a look at the following PostGIS functions: ST_NumGeometries and ST_GeometryN. So, selecting your single objects and calculating the azimuth could be like this (I checked it with some sample data on my PC) WITH multiobject AS (SELECT lnumber, your_multilinestring_column AS geom, generate_series(1,100) AS n ...
Top 50 recent answers are included