Opened 22 years ago

Closed 22 years ago

Last modified 22 years ago

#165 closed defect (fixed)

PostGIS Points don't work as Annotation Layers

Reported by: warmerdam Owned by: refractions
Priority: high Milestone:
Component: PostGIS Interface Version: 3.6
Severity: normal Keywords:
Cc:

Description

Folks,

I am trying to use the PostGIS support in MapServer to render annotation
associated with a point layer.  I wasn't getting anything and traced it
to dont_force() returning MS_FAILURE.

It looks like this:

// if there is any polygon in wkb, return force_polygon
// if there is any line in wkb, return force_line
// otherwise return force_point

int dont_force(char *wkb, shapeObj *shape)
{
    int offset =0;
    int ngeoms ;
    int    type,t;
    int        best_type;
    
//printf("dont force");
    
    best_type = MS_SHAPE_NULL;  //nothing in it
        
    memcpy( &ngeoms, &wkb[5], 4);
    offset = 9;  //were the first geometry is
    for (t=0; t<ngeoms; t++)
    {
        memcpy( &type, &wkb[offset+1], 4);  // type of this geometry

        if (type == 3) //polygon
        {
            best_type = MS_SHAPE_POLYGON;    
        }
        if ( (type ==2) && ( best_type != MS_SHAPE_POLYGON) )
        {
            best_type = MS_SHAPE_LINE;
        }
        if (   (type==1) && (best_type != MS_SHAPE_NULL) )
        {
            best_type = MS_SHAPE_POINT;    
        }
    }

    if (best_type == MS_SHAPE_POINT)
    {
        return force_to_points(wkb,shape);
    }
    if (best_type == MS_SHAPE_LINE)
    {
        return force_to_lines(wkb,shape);
    }
    if (best_type == MS_SHAPE_POLYGON)
    {
        return force_to_polygons(wkb,shape);
    }


    return(MS_FAILURE); //unknown type
}

By patching the "best_type != MS_SHAPE_NULL" to be "best_type == MS_SHAPE_NULL"
I was able to get things working, otherwise with only point geometries the
best_type remained MS_SHAPE_NULL.

Should I apply this patch?  I don't entirely understand what this function
is trying to accomplish.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

Change History (2)

comment:1 by fwarmerdam, 22 years ago

Resolution: fixed
Status: newclosed
With advice from Dave Blasby, I have applied the patch to CVS (development).

comment:2 by dmorissette, 22 years ago

I applied the patch to the 3.6 branch and it will be part of release 3.6.1
Note: See TracTickets for help on using tickets.