Opened 12 years ago

Closed 12 years ago

#1595 closed defect (fixed)

problem with geom from ST_Line_SubString

Reported by: worthlutz Owned by: pramsey
Priority: critical Milestone: PostGIS 1.5.4
Component: postgis Version: 1.5.X
Keywords: ST_Line_Substring Cc:

Description

Mapserver will not display in a Line layer the_geom returned from ST_Line_Substring(). In looking into this, I noticed that the geometry from ST_Line_Substring is different from the original geometry. This was 1st noticed in the text representations of the geometry. The text representations of the substring has "SRID=32019;" added before the points in the text after "MULTILINESTRING(".

The geometry representation is also different. See results from the SQL below. Note the substring is the entire string to be able to compare the two geometry results. I assume they should be the same.

SELECT 
    the_geom as orig_geom,
    ST_Line_Substring( the_geom, 0.0, 1.0 ) AS substring_geom,
    ST_AsText( the_geom ) AS original_text,
    ST_AsText(
      ST_Line_Substring( the_geom, 0.0, 1.0 )
   ) AS substring_text,
    ST_AsEWKT( the_geom ) AS original_EWKT,
    ST_AsEWKT(
      ST_Line_Substring( the_geom, 0.0, 1.0 )
    ) AS substring__EWKT
FROM (
  SELECT
    ST_SetSRID(
      ST_GeomFromText(
        'MULTILINESTRING((2108912.024 773324.5672,2109137.75 773640.25))'
      ),
      32019
    ) AS the_geom
) AS foo

I do not know if these items are why Mapserver will not display the geometry but they looked strange. Openjump will display the geometry which may point to a problem with Mapserver. Point me there is that is the case. Mapserver will display the endpoints of the substring geometry with ST_EndPoint(the_geom) in a Point layer.

I am working on a simple Mapserver example to attach.

Change History (4)

comment:1 by strk, 12 years ago

Confirmed on 1.5.

comment:2 by strk, 12 years ago

Interesting enough, changing ordinates to be "rounder" fixes the case.

comment:3 by strk, 12 years ago

I was wrong, this is enough to trigger: SELECT ST_AsEWKT(ST_Line_Substring('SRID=32019;MULTILINESTRING((0 0,0 1))', 0, 1));

comment:4 by strk, 12 years ago

Resolution: fixed
Status: newclosed

ok, the issue is indeed in the line_substring call, only isn't revealed by 2.0 because there we don't care about SRID of inner geometries when it comes to output.

It's fixed in 1.5 branch as of r9250 — not sure how to test it with 2.0, it would take a smarter ST_Summary to figure.

Note: See TracTickets for help on using tickets.