Opened 18 years ago

Closed 18 years ago

#1699 closed defect (fixed)

Point query of polygons using SDE throws an error.

Reported by: sdlime Owned by: hobu
Priority: high Milestone:
Component: Input - Native SDE Support Version: 4.8
Severity: normal Keywords:
Cc:

Description

I believe this is a new problem with ESRI 9.x client libraries since it used to 
work. A point-based query of an SDE fails with an error about not enough points 
to create shape. What's happening is that MapServer rectangles can have zero 
area (minx=maxx, miny=maxy) and this is the case with calls to 
msLayerWhichShapes in certain cases. The query extent (which becomes the 
selection extent for msLayerWhichShapes) is computed by building a rectObj from 
the point and either a user supplied buffer value of the layer tolerance. In 
the case of a polygon layer that tolerance is 0 so you get the zero area rect.

Steve

Change History (4)

comment:1 by hobu, 18 years ago

This is a very hackish approach.

  if( envelope.minx == envelope.maxx && envelope.miny == envelope.maxy){
        /* fudge a rectangle so we have a valid one for generate_rectangle */
        envelope.minx = envelope.minx - 0.001;
        envelope.maxx = envelope.maxx + 0.001;
        envelope.miny = envelope.miny - 0.001;
        envelope.maxy = envelope.maxy + 0.001;
    }

  status = SE_shape_generate_rectangle(&envelope, shape);
  if(status != SE_SUCCESS) {
    sde_error(status, 
              "msSDELayerWhichShapes()", 
              "SE_shape_generate_rectangle()");
    return(MS_FAILURE);
. 
.
.

Otherwise, you would have to change the shape being generated to a point and
change the constraint method.

comment:2 by sdlime, 18 years ago

I thought about fudging the rect too. It'll definitely work. The other method sounds like the 'right" way 
to do it and might provide a template for expanding the functionality of msWhichShapes in the future 
(as a means of doing single pass queries). For example, we could pass in a shapeObj to use as a 
constraint for queryByShape and/or queryByFeature queries. You're call...

Steve

comment:3 by hobu, 18 years ago

I took the cheap and easy way out, with a FIXME that states what we should
really do.

comment:4 by sdlime, 18 years ago

Resolution: fixed
Status: newclosed
Fair enough and certainly appropriate for the 4 series... Thanks for fixing! (I assume you ported to 4.8)

Steve
Note: See TracTickets for help on using tickets.