Ticket #898 (closed defect: wontfix)

Opened 9 years ago

Last modified 9 years ago

check for layer queryability inside query functions

Reported by: sgillies@… Owned by: sgillies@…
Priority: high Milestone:
Component: MapScript-SWIG Version: 4.3
Severity: normal Keywords:
Cc:

Description

New users often get tripped up by the way that mapserver uses layer.template
to control the queryability of a layer.

When a user calls queryByPoint() for example, they expect to get results, and
we could save new users a lot of trouble by setting the template value for
them inside the function if NULL, and then setting it back to NULL.

The queryByPoint method, for example, would become:

    int queryByPoint(mapObj *map, pointObj *point, int mode, double buffer) 
    {
        int retval;
        if (self->template == NULL) {
            // make queryable
            self->template = strdup("query");
            retval = msQueryByPoint(map, self->index, mode, *point, buffer);
            free(self->template);
            self->template = NULL;
        }
        else if (strlen(self->template) < 1) {  // string like ""
            free(self->template);
            self->template = strdup("query");
            retval = msQueryByPoint(map, self->index, mode, *point, buffer);
            free(self->template);
            self->template = strdup("");
        }
        else {
            retval = msQueryByPoint(map, self->index, mode, *point, buffer);
        }
        return retval;            
    }

maybe some macros would be helpful to do this for all the query methods.

Change History

Changed 9 years ago by dmorissette

  • cc warmerdam@…, steve.lime@… added
(Adding Frank and Steve to the CC... I think we really need a bug email alias
that includes all developers.)

I'm not sure doing this automatically is a good idea. Normally, you set a
template only in the layers that have meanningful data to query, so a layer
without a template is a legitimate case that needs to be respected by the
application code.

Perhaps what we need is a layer.isQueryable() function that application code can
call before calling queryByPoint(), and if the layer is not queryable then
present an error to the user saying "this layer is not queryable", or just don't
offer this layer as queryable in the user interface.

Changed 9 years ago by sgillies@…

  • status changed from new to closed
  • resolution set to wontfix
OK, nevermind.

Note: See TracTickets for help on using tickets.