1

I tried to add more than three rules of CSS styles, whenever I tried to add fourth rule, I can't submit the style in Geoserver 2.8.1.

Please find the CSS styles I used below.

/* Default Style less than a scale*/
*[@scale < 50000] {
   fill: #FFD9B3;
   fill-opacity: 50%;
   stroke: #D9D8D8;
   stroke-width: 0.5;
}

/* Default Style 2 */
[@scale >= 50000] [@scale < 250000]{
   fill: #FFCC99;
   fill-opacity: 50%;
   stroke: #E2E0DD;
   stroke-width: 0.5;
}

/* Filter police */
[name LIKE '%police%'] [@scale < 250000]{
   fill: #CDCDFE; 
   stroke: #CCCCCC;
   stroke-width: 0.5;
}

/* Filter hospital/clinic */
[name LIKE '%hospital%' or name LIKE '%clinic%'] [@scale < 250000]{
   fill: #FFCCCC;
   stroke: #DCA3A3;
   stroke-width: 0.5;
}

/* Filter Educational Institutes */
[name LIKE '%school%' or name LIKE '%college%' or name LIKE '%vidya%' or name LIKE '%university%'] [@scale < 250000]{
   fill: #FFD9B3;
   stroke: #c6b29F;
   stroke-width: 0.5;
}

/* Filter Stadium/Ground */
[name LIKE '%stadium%' or name LIKE '%ground%'] [@scale < 250000]{
   fill: #DFDF9F;
   stroke: #D4D4AA;
   stroke-width: 0.5;
}


/* Name Display */
[@scale < 35000]{
   label:[name];
   font-family: Arial;
   font-size: 12;
   font-weight: bold;
   font-fill: #9C9A9A;
   font-opacity: 0.8;

   label-anchor: 0.5 0.5;

   halo-radius: 1.5;
   halo-color: white;
   halo-opacity: 0.8;

   -gt-label-auto-wrap: 80;
}

Is there any code missing? and How can I solve this Issue?

1

It looks as if you are overwhelming the translation engine with choices, please read this for full details but the short answer is to add

@mode "Simple"; 

at the top of your styles to reduce the amount of simplification the translation engine tries to apply. You could also try the Exclusive mode but you will need to be patient (and probably increase the available memory in the JVM). If you upgrade to GeoServer 2.9 you can use the Flat option mentioned too.

1

I think the problem is use of 'or' inside the selector. You need to use ',' to imply OR in the sense you mean.

Whereas a space between indicators mean AND

See here for details about using selectors: https://tilemill-project.github.io/tilemill/docs/guides/selectors/

EDIT:
Also you can tidy up and not have so many LIKE statements by using regex in the selector. For Example, to find where name is like hospital or name is like clinic:

[name =~'\bhospital|\bclinic']


Try the following instead:

/* Default Style less than a scale*/
*[@scale < 50000] {
   fill: #FFD9B3;
   fill-opacity: 50%;
   stroke: #D9D8D8;
   stroke-width: 0.5;
}

/* Default Style 2 */
[@scale >= 50000][@scale < 250000]{
   fill: #FFCC99;
   fill-opacity: 50%;
   stroke: #E2E0DD;
   stroke-width: 0.5;
}

/* Filter police */
[name LIKE '%police%'][@scale < 250000]{
   fill: #CDCDFE; 
   stroke: #CCCCCC;
   stroke-width: 0.5;
}

/* Filter hospital/clinic */
[name LIKE '%hospital%'][@scale < 250000],
[name LIKE '%clinic%'][@scale < 250000]{
   fill: #FFCCCC;
   stroke: #DCA3A3;
   stroke-width: 0.5;
}

/* Filter Educational Institutes */
[name LIKE '%school%'][@scale < 250000],
[name LIKE '%college%'][@scale < 250000],
[name LIKE '%vidya%'][@scale < 250000],
[name LIKE '%university%'][@scale < 250000]{
   fill: #FFD9B3;
   stroke: #c6b29F;
   stroke-width: 0.5;
}

/* Filter Stadium/Ground */
[name LIKE '%stadium%'][@scale < 250000],
[name LIKE '%ground%'][@scale < 250000]{
   fill: #DFDF9F;
   stroke: #D4D4AA;
   stroke-width: 0.5;
}


/* Name Display */
[@scale < 35000]{
   label:[name];
   font-family: Arial;
   font-size: 12;
   font-weight: bold;
   font-fill: #9C9A9A;
   font-opacity: 0.8;

   label-anchor: 0.5 0.5;

   halo-radius: 1.5;
   halo-color: white;
   halo-opacity: 0.8;

   -gt-label-auto-wrap: 80;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.