[Geoserver-devel] [jira] Created: (GEOS-3843) KML output does not respect scale dependencies in SLD

Baskar, Dhanapal ha scritto:

Andrea,

I am looking into Geoserver KML subsystem and trying to find solution.
Just clarify few things.

1. What actually Geoserver has to do when scale denominator goes out of
scale dependency? Whether it has to show any exception by stopping the
execution or show any message to user.

Just don't execute it. The rendering code strips all the out of
scale rules before actually starting to work.

2. I assume that I have to compare calculated scale denominator value
(this is happening at KMLTransformer.java) at runtime with
<MaxScaleDenominator> value specified in SLD file. Is it right?

Right... and it does compute the scale denominator and passes it
down to the KMLVectorTransformer that in turn will use it in
the filterRules call to shave off the rules that are not valid
at the current scale range.

However I don't see an equivalent path for raster data... I guess
that's what you're trying to fix?

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hi all,

I am still facing this scale dependencies problem. I have been waiting for
long time to get help from anybody.Did anybody in developer list have time
to suggest on the patch that i pasted below to solve the problem.

Regards,
Baskar

Baskar Dhanapal wrote:

Hi,

I tried to fix this problem by adding the following code in
"KMLTransformer.java", exactly next to scaleDenominator calculation.

for(int i =0;i<layers.length;i++) {
                MapLayer layer = layers[i];
                FeatureSource <SimpleFeatureType, SimpleFeature>
featureSource;
                featureSource = (FeatureSource<SimpleFeatureType,
SimpleFeature>) layer.getFeatureSource();
                SimpleFeatureType featureType = featureSource.getSchema();
                FeatureTypeStyle featureTypeStyles =
KMLUtils.filterFeatureTypeStyles(layer.getStyle(),
                    featureType);
               if ((featureTypeStyles == null) ||
(featureTypeStyles.length == 0)) {
                       break;
                }
                for(int j=0;j<featureTypeStyles.length;j++){
                    FeatureTypeStyle featureTypeStyle =
featureTypeStyles[j];
                    Rule rules = featureTypeStyle.getRules();
                     if ((rules == null) || (rules.length == 0)) {
                         break;
                      }
                    for(int k=0;k<rules.length;k++){
                        Rule rule = rules[k];
                       
if(Math.round(scaleDenominator)>rule.getMaxScaleDenominator()){
                             LOGGER.log(Level.FINE, "Scale goes out of
Dependency");
                              return;
                        }
                    }
                }
            }

As per Andreas suggestion, I am checking the calculated value against
<maxScaleDenominator> value specified in SLD file and if it goes out, then
simply returning by ingnoring the rules.

Before adding this code the request hangs up. After adding above code the
execution completes.

I am not sure wheather the approach is correct or not, and also
"KMLTransformer.java" is a right place to keep the code.

I am dealing with vector data in Geoserver 2.0.0.

Any idea from anybody would be appreciated.

Regards
Baskar

--
View this message in context: http://old.nabble.com/-jira--Created%3A-(GEOS-3843)-KML-output-does-not-respect-scale-dependencies-in-SLD-tp27796644p29785874.html
Sent from the GeoServer - Dev mailing list archive at Nabble.com.