1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- -- The closed_linestring table is created with a single linestring column.
- CREATE TABLE closed_linestring (ln1 ST_LineString);
- -- The INSERT statements insert two records into the closed_linestring table.
- -- The first record is not a closed linestring, while the second is.
- INSERT INTO closed_linestring VALUES(
- ST_LineFromText('linestring (10.02 20.01,10.32 23.98,11.92 25.64)', 1000)
- );
- INSERT INTO closed_linestring VALUES(
- ST_LineFromText('linestring (10.02 20.01,11.92 35.64,25.02 34.15,19.15 33.94,10.02 20.01)',1000)
- );
- -- The query returns the results of the ST_IsClosed function.
- -- The first row returns t (FALSE) because the linestring is not closed,
- -- while the second row returns t (TRUE) because the linestring is closed.
- SELECT ST_IsClosed(ln1) Is_it_closed
- FROM closed_linestring;
- -- The closed_mlinestring table is created with a single
- -- ST_MultiLineString column.
- CREATE TABLE closed_mlinestring (mln1 ST_MultiLineString);
- -- The INSERT statements insert a ST_MultiLineString record that is
- -- not closed and another that is.
- INSERT INTO closed_mlinestring VALUES(
- ST_MLineFromText('multilinestring ((10.02 20.01,10.32 23.98,11.92 25.64),(9.55 23.75,15.36 30.11))',1000)
- );
- INSERT INTO closed_mlinestring VALUES(
- ST_MLineFromText('multilinestring ((10.02 20.01,11.92 35.64,25.02 34.15,19.15 33.94,10.02 20.01),(51.71 21.73,73.36 27.04,71.52 32.87,52.43 31.90,51.71 21.73))',1000)
- );
- -- The query lists the results of the ST_IsClosed function.
- -- The first row returns f (FALSE) because the multilinestring is not closed.
- -- The second row returns t (TRUE) because the multilinestring stored in the
- -- mln1 column is closed. A multilinestring is closed if all of its
- -- linestring elements are closed.
- SELECT ST_IsClosed(mln1) Is_it_closed
- FROM closed_mlinestring;
|