Paul Austin
2017-06-28 17:42:13 UTC
It looks like if you do a request to return KML data in a WMS request where there are no styles within the scale range it is still calculating the feature collection. It would be nice if there were no valid styles at that scale range then the response would short circuit and return an empty document rather than calculating the feature collection.
For example the following takes a long time to process and return an document with no KML placemarks.
http://test.openmaps.gov.bc.ca/geo/pub/wms?service=wms&request=GetMap&version=1.1.1&format=application/vnd.google-earth.kml+xml&layers=pub%3AWHSE_IMAGERY_AND_BASE_MAPS.AIMG_PHOTO_CENTROIDS_SP&styles=Airborne_Imagery_Air_Photo_Centres_2016&transparent=true&srs=EPSG%3A4326&format_options=AUTOFIT:true;KMATTR:true;KMPLACEMARK:true;KMSCORE:100;MODE:refresh;SUPEROVERLAY:false&BBOX=-130,49,-110,60&WIDTH=1000&HEIGHT=1000
Adding &maxFeatures=1000 it returns quicker, but it looks like it is still performing the query.
In org.geoserver.kml.sequence.FeatureSequenceFactory the following looks like if the simplified styles are null then it doesn’t create the feature iterator. I wonder if changing it to something like simplified!= null && ! simplified.isEmpty() would work. Or if the feature collection is also being created elsewhere.
@Override
public Sequence<Feature> newSequence() {
return new FeatureGenerator(simplified != null ? context.openIterator(features) : null);
}
I don’t know the code enough and the geoserver is running at a client site so I can verify In a debugger what is actually happening.
For example the following takes a long time to process and return an document with no KML placemarks.
http://test.openmaps.gov.bc.ca/geo/pub/wms?service=wms&request=GetMap&version=1.1.1&format=application/vnd.google-earth.kml+xml&layers=pub%3AWHSE_IMAGERY_AND_BASE_MAPS.AIMG_PHOTO_CENTROIDS_SP&styles=Airborne_Imagery_Air_Photo_Centres_2016&transparent=true&srs=EPSG%3A4326&format_options=AUTOFIT:true;KMATTR:true;KMPLACEMARK:true;KMSCORE:100;MODE:refresh;SUPEROVERLAY:false&BBOX=-130,49,-110,60&WIDTH=1000&HEIGHT=1000
Adding &maxFeatures=1000 it returns quicker, but it looks like it is still performing the query.
In org.geoserver.kml.sequence.FeatureSequenceFactory the following looks like if the simplified styles are null then it doesn’t create the feature iterator. I wonder if changing it to something like simplified!= null && ! simplified.isEmpty() would work. Or if the feature collection is also being created elsewhere.
@Override
public Sequence<Feature> newSequence() {
return new FeatureGenerator(simplified != null ? context.openIterator(features) : null);
}
I don’t know the code enough and the geoserver is running at a client site so I can verify In a debugger what is actually happening.