-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong report of domains in a categorized rendering #11
Comments
are you talking about the "old" mapfile generator of the new one? |
The new one. |
so better wait comment from @brncsk |
ok, for your original rt_mapserver_exporter code. If I will have success, I will report the new code here. |
The qgis project I convert to mapserver as sample, use the graduate render not the categorized render. |
...., perhaps the issue is in more than one renderer. surely in the graduate, and seem the code issue is also in the categorized and in the singlesymbol renderer. |
Resolved. The change for the categorized rendering is around the line 186. for cat in renderer.categories(): msClass = mapscript.classObj(self.msLayer) # XXX: type(cat.value()) differs whether the script is being run in QGis or as # a standalone PyQGis application, so we convert it accordingly. cv = cat.value() cv = cv.toString() if isinstance(cv, QVariant) else unicode(cv) msClass.setExpression((u'("[%s]" = "%s")' % (attr, cv)).encode('utf-8')) SymbolLayerSerializer(renderer.symbols()[i], msClass, self.msLayer, self.msMap) #add number to class name msClass.name+='_'+str(i) i = i + 1 with the code: for cat in renderer.categories(): msClass = mapscript.classObj(self.msLayer) # XXX: type(cat.value()) differs whether the script is being run in QGis or as # a standalone PyQGis application, so we convert it accordingly. cv = cat.value() cv = cv.toString() if isinstance(cv, QVariant) else unicode(cv) msClass.setExpression((u'("[%s]" = "%s")' % (attr, cv)).encode('utf-8')) SymbolLayerSerializer(renderer.symbols()[i], msClass, self.msLayer, self.msMap) msClass.name = cat.label() i = i + 1 Perhaps the i=i+1 is no more useful, but I leave it to avoid surprise. For the Graduate rendering the change is around the line 208 changing the code: for range in renderer.ranges(): msClass = mapscript.classObj(self.msLayer) # We use '>=' instead of '>' when defining the first class to also include the lowest # value of the range in the expression. msClass.setExpression((u'(([%s] %s %f) And ([%s] <= %f))' % ( \ attr, \ '>=' if (i == 0) else '>', \ range.lowerValue(), \ attr, \ range.upperValue() \ )).encode('utf-8')) SymbolLayerSerializer(renderer.symbols()[i], msClass, self.msLayer, self.msMap) #add number to class name msClass.name+='_'+str(i) i = i + 1 with the code: for range in renderer.ranges(): msClass = mapscript.classObj(self.msLayer) # We use '>=' instead of '>' when defining the first class to also include the lowest # value of the range in the expression. msClass.setExpression((u'(([%s] %s %f) And ([%s] <= %f))' % ( \ attr, \ '>=' if (i == 0) else '>', \ range.lowerValue(), \ attr, \ range.upperValue() \ )).encode('utf-8')) SymbolLayerSerializer(renderer.symbols()[i], msClass, self.msLayer, self.msMap) msClass.name = range.label() i = i + 1 In this case the code "i=i+1" is mandatory to leave unchanged because is used to counting the range domain. |
I see when the plugin export a categorized rendering it report the wrong values.
This is an image to show what is the legend in the qgis project:
And this is what is returned as legend in the layer from the wms exported:
I will try to patch this in my customized fork and if the patch is quite standard wll produce a fork for this version.
The text was updated successfully, but these errors were encountered: