Opened 14 years ago

Last modified 13 years ago

#3231 assigned defect

Allow shape queries by more than just polygons

Reported by: sdlime Owned by: sdlime
Priority: normal Milestone: 6.0 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: normal Keywords:
Cc: warmerdam

Description

Means two things:

  • update msQueryByShape to handle lines and points (multi too)
  • update the query writer to save lines and points

Steve

Change History (3)

comment:1 by sdlime, 14 years ago

Status: newassigned

Committed initial fix in r9613. Probably need to do this for rasters too or throw an error for non-polygon shapes in that case...

Steve

comment:2 by sdlime, 13 years ago

Cc: warmerdam added

comment:3 by warmerdam, 13 years ago

It would require some work to properly return query results from a raster under a point or line. I don't have any pressing need for this myself, and am inclined to leave it as a TODO until someone needs it bad enough to do or pay for it.

It might be nice to report an error for now.

Hmm, looking at the code I see:

            /* If we are doing QueryByShape, check against the shape now */
            if( rlinfo->searchshape != NULL )
            {
                if( rlinfo->shape_tolerance == 0.0 
                    && rlinfo->searchshape->type == MS_SHAPE_POLYGON )
                {
                    if( msIntersectPointPolygon( 
                            &sPixelLocation, rlinfo->searchshape ) == MS_FALSE )
                        continue;
                }
                else
                {
                    shapeObj  tempShape;
                    lineObj   tempLine;
                    
                    memset( &tempShape, 0, sizeof(shapeObj) );
                    tempShape.type = MS_SHAPE_POINT;
                    tempShape.numlines = 1;
                    tempShape.line = &tempLine;
                    tempLine.numpoints = 1;
                    tempLine.point = &sPixelLocation;
                    
                    if( msDistanceShapeToShape(rlinfo->searchshape, &tempShape)
                        > rlinfo->shape_tolerance )
                        continue;
                }
            }

It seems plausible that this already does a decent job of the desired operation. It seems it will return all raster pixels within "shape_tolerance" of points and lines which appears to default to 3 pixels if not set in the layer.

I'm going to try and construct a test case or two for the test suite using this approach, and leave it at that.

Note: See TracTickets for help on using tickets.