Tag Info

New answers tagged


Something like this would work SELECT ST_Transform( ST_SetSRID( ST_GeomFromGeoJSON('{ "type": "LineString","coordinates": [ [27.456667,5.065], [30.456667,-1.088] ] }') ,4326) ,3857) AS the_geom_webmercator


There are a couple of options. Option 1 You could do the query exactly like you have it, then add your linestring using GeoJSON on the client. You'd use CartoDB.js to draw you polygon layer and then use Leaflet to add the GeoJSON layer on top. Option 2 Use a multilayer visualization. The bottom layer you could have as you polygons (styled accordingly. ...


It's on both sides. I suppose you want the one the majority of the distance is on. Assuming only a single point of intersection, you'd first need to split the line at the intersection and take the length of both sides. Once you know which side is longer, take any point on that side. Next, you need to determine what segment of the main line the ...


Easy, use ST_LineMerge with the MultiLineString geometry. SELECT ST_LineMerge(geom) FROM ... Returns a LineString if it is possible, such is the example in the question.


There is few resolutions of this issue, maybe there are few better ones but this two should do also: 'By hand' (in steps) Cut every line with another line which intersects it Create table road_1 as Select row_number() over() as ID, input.name, (st_dump(st_split(input.geom, blade.geom))).geom as geom from roads input join roads blade ...


You can use PostGIS ST_NODE function or if you have PostGIS > 2.0 and want to do a cleaner job considering topology, you can follow instructions in this blog


The ST_Envelope() function operates on single geometries, therefore you are right, you need aggregate your MULTILINESTRINGs before you pass them by St_Envelope(). St_Collect() is a good aggregation function for that job. SELECT ST_Envelope(st_Collects(foo.geom)) FROM line_table as foo WHERE foo.type='a'; If you want to retrieve the bounding box for each ...

Top 50 recent answers are included