Opened 13 years ago
Closed 13 years ago
#3590 closed defect (fixed)
Can't create class with style size 0 using layer->updateFromString()
Reported by: | strk | Owned by: | aboudreault |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | MapScript-PHP | Version: | 5.6 |
Severity: | normal | Keywords: | |
Cc: |
Description
The call:
l->updateFromString('LAYER CLASS STYLE SIZE 0 END END END');
fails to write 'SIZE 0' for the STYLE object to the resulting mapfile
This failure, in turn, results in this message coming out from a pie-chart layer type:
Cannot draw pie charts for negative values
NOTE that writing 'SIZE 0' _manually_ in the mapfile does the right thing.
The only workaround I found from mapscript to obtain an invisible class (which is in turn a workaround for the message you get if you only have a single class) was to use a SIZE 0.0000001
Not sure if this is one or two bugs:
- Being unable to set STYLE SIZE 0 in mapfile
- STYLE SIZE defaulting to < 0 ?
This is PHP with 5.6, haven't tried trunk.
Change History (10)
comment:1 by , 13 years ago
Status: | new → assigned |
---|
comment:2 by , 13 years ago
Component: | MapScript → MapScript-PHP |
---|---|
Owner: | changed from | to
Status: | assigned → new |
comment:3 by , 13 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:4 by , 13 years ago
Resolution: | invalid |
---|---|
Status: | closed → reopened |
What do you mean "you can't" ? It works perfectly with any size but zero ! I'm actually _adding_ (not modifying existing) classes, and it's what I want to do.
Maybe the summary should be changed to "Can't create class with style size 0"
comment:5 by , 13 years ago
Summary: | Can't set STYLE SIZE 0 from mapscript → Can't create class with style size 0 using layer->updateFromString() |
---|
ah! Here's the summary modified.
comment:6 by , 13 years ago
strk, could you show me your complete layer definition. (what you pass to updateFromString)
comment:7 by , 13 years ago
$layer->updateFromString(' LAYER CLASS # Do not show in legend... # NAME "pad'.$padclasses.'" STYLE # Must avoid 0 for http://trac.osgeo.org/mapserver/ticket/3590 SIZE 0.000001 END END END');
comment:8 by , 13 years ago
it seems that my test case/mapfile is different that you. I can load a style with size of 0 properly. I can also see your error message by setting -1. The only thing I suspected, and that why I asked you the complete definition, was that something creates two style objects. ie. This example creates 2 style objects:
$layer->updateFromString('LAYER CLASS SYMBOL gif # first style object created here. STYLE SIZE 0 # this is the second style object END END END');
By putting SYMBOL gif in the style definition, we got only 1 style object created. Reading your updateFromString call... this doesn't seem to be your problem. As a quick test, I'd check the numclasses and numstyles values before and after the updateFromString call.
comment:9 by , 13 years ago
Please try _saving_ your mapfile containing the class with style size 0. I'm only saving the mapfile and using it trough the .cgi so probably the bug is in mapfile writing (stripping off zero-sized styles) being inconsistent with mapfile reading (taking unspecified-sized style as -1 sized).
comment:10 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Effectively the problem was in the save functions. Those things have been fixed in trunk.
You cannot modify classes/styles with updateFromString. In this case, a new class is created because the code doesn't know anything about existing classes. Change setting using getclass(x)->getstyle(y)->set(...) (ms 5.6) or using the updateFromString methods of the class/style objects.