Split / Divide linestring into parts / segments ?

View: New views
2 Messages — Rating Filter:   Alert me  

Split / Divide linestring into parts / segments ?

by Massan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thanks Regina ! Good case but it is not helping me in my case. So if I can make this more clear to everybody I need to divide/split one linestring to 30 different pieces. So I can see where other linestrings has intersected this one linestring. Like how many linestrings has crossed the "door" in section 1 or 3 and so on...

                               linestring "door"

<----1------><-----2-----><------3------><-------5-----><-----6-------> and
so on ...


_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users

Re: Split / Divide linestring into parts / segments ?

by Simon Greener-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Grant,

Are you after something like this:

SELECT ST_AsText(ST_Line_SubString(the_geom,
                                    ((g::float-1.0) / 30.0),
                                    (g::float/30::float) )) as segment,
        ST_Length(ST_Line_SubString(the_geom,
                                    ((g::float-1.0) / 30.0),
                                    (g::float/30::float) )) as length,
        g as segment_number,
        ((g::float-1.0) / 30.0) as start,
        (g::float/30::float)    as end
   FROM (select ST_GeomFromText('LINESTRING(748130 2919491,747979 2919630,747895 2919705)') as the_geom) as l,
         generate_series(1,30,1) as g;

regards
Simon
On Wed, 14 Oct 2009 17:18:53 +1100, Grant Masan <grant.massan@...> wrote:

> Hi,
>
> Thanks Regina ! Good case but it is not helping me in my case. So if I can
> make this more clear to everybody I need to divide/split one linestring to
> 30 different pieces. So I can see where other linestrings has intersected
> this one linestring. Like how many linestrings has crossed the "door" in
> section 1 or 3 and so on...
>
>                                linestring "door"
>
> <----1------><-----2-----><------3------><-------5-----><-----6-------> and
> so on ...
>


--
SpatialDB Advice and Design, Solutions Architecture and Programming,
Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional
Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist.
39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia.
Website: www.spatialdbadvisor.com
   Email: simon@...
   Voice: +61 362 396397
Mobile: +61 418 396391
Skype: sggreener
Longitude: 147.20515 (147° 12' 18" E)
Latitude: -43.01530 (43° 00' 55" S)
GeoHash: r22em9r98wg
NAC:W80CK 7SWP3
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users