[mapserver-dev] Querymap fails for polygon layers with labels only (no styles)

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu Mar 11 14:52:35 PST 2021


Hi Tamas,

Good catch, I don't think I've ever tried that case with a polygon, 
querymap with STYLE HILITE, and layer with only label.  I think that 
would be a good enhancement.  Would you mind also creating a test 
mapfile for this in msautotest as well?

thanks,

-jeff




On 2021-03-11 5:41 p.m., Tamas Szekeres wrote:
> Hi Devs,
> 
> Currenly msDrawQueryLayer fails with error if the layer type is polygon, 
> the querymap style is MS_HILITE, and the layer class contains only label 
> elements.
> 
> Is this intentional?
> 
> The same setting works with the point layers (where the labels are being 
> highlighted) so I guess it should also work with the polygon layers.
> 
> The corresponding code looks like this:
> 
> /if(layer->type == MS_LAYER_POLYGON) { /* alter BOTTOM style since 
> that's almost always the fill */
>          if (layer->class[i]->styles == NULL) {
>            msSetError(MS_MISCERR, "Don't know how to draw class %s of 
> layer %s without a style definition.", "msDrawQueryLayer()", 
> layer->class[i]->name, layer->name);
>            msFree(colorbuffer);
>            msFree(mindistancebuffer);
>            return(MS_FAILURE);
>          }/
> 
> however the classes with no styles can surely be handled later in the code:
> 
> } else if (layer->class[i]->numlabels > 0) {
>            colorbuffer[i] = layer->class[i]->labels[0]->color;
>            layer->class[i]->labels[0]->color = map->querymap.color;
>        }
> 
> Should I prepare a fix for this problem?
> 
> Best regards,
> 
> Tamas
> 
> 
-- 
Jeff McKenna
GatewayGeo: Developers of MS4W, MapServer Consulting and Training
co-founder of FOSS4G
http://gatewaygeo.com/


More information about the mapserver-dev mailing list