[mapserver-users] Changing map file parameters via a URL

till plewe till.plewe at gmail.com
Thu Oct 20 00:11:11 EDT 2011


I am trying to set COLORRANGE and DATARANGE via url. Using the url below


--------
http://xxx.yyy.zzz/cgi-bin/MapService?layers=mesh10m&mode=map&map_imagetype=png&map.layer[mesh10m].class[0].style[0]=DATARANGE+0+1000+COLORRANGE+255+100+0+0+100+255
--------


I get the errormessage:


--------
loadStyle(): Unknown identifier. Parsing error near (DATARANGE):(line 1)
--------


I am using mapserver 5.9.1 (unfortunately unknown build).
Looking at the source code for versions 5.6.7 and 6.0.1 at the definition of
loadStyle in mapfile.c
it seems that both DATARANGE and COLORRANGE are unknown although they are in
the switch
statement and also both defined (without special ifdefs) in mapfile.h. Other
keywords  e.g. COLOR
work fine using identical syntax.


Does anybody have a suggestion where the problem may be found? My goal is to
set DATARANGE
and COLORRANGE using OpenLayers. Any suggestions how to accomplish this
would of course be
also very welcome.

- Till

----- extract from mapfile.c (version 5.6.7) -----

int loadStyle(styleObj *style) {
  int symbol;

  for(;;) {
    switch(msyylex()) {
  /* New Color Range fields*/
    case (COLORRANGE):
      /*These are both in one line now*/
      if(loadColor(&(style->mincolor), NULL) != MS_SUCCESS)
return(MS_FAILURE);
      if(loadColor(&(style->maxcolor), NULL) != MS_SUCCESS)
return(MS_FAILURE);
      break;
    case(DATARANGE):
      /*These are both in one line now*/
      if(getDouble(&(style->minvalue)) == -1) return(-1);
      if(getDouble(&(style->maxvalue)) == -1) return(-1);
      break;
    case(RANGEITEM):
      if(getString(&style->rangeitem) == MS_FAILURE) return(-1);
      break;
  /* End Range fields*/
    case(ANGLE):
      if((symbol = getSymbol(3, MS_NUMBER,MS_BINDING,MS_AUTO)) == -1)
return(MS_FAILURE);

      if(symbol == MS_NUMBER)
        style->angle = (double) msyynumber;
      else if(symbol==MS_BINDING){
        if (style->bindings[MS_STYLE_BINDING_ANGLE].item != NULL)
          msFree(style->bindings[MS_STYLE_BINDING_ANGLE].item);
        style->bindings[MS_STYLE_BINDING_ANGLE].item = strdup(msyytext);
        style->numbindings++;
      } else {
        style->autoangle=MS_TRUE;
      }
      break;
...
    default:
      if(strlen(msyytext) > 0) {
        msSetError(MS_IDENTERR, "Parsing error near (%s):(line %d)",
"loadStyle()", msyytext, msyylineno);
        return(MS_FAILURE);
      } else {
        return(MS_SUCCESS); /* end of a string, not an error */
      }
    }
  }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20111020/5e0880fc/attachment.html


More information about the mapserver-users mailing list