Skip to content
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

GEOTRANSFORM "start", "end" casted to START END #50

Closed
loicgasser opened this issue Jan 30, 2018 · 9 comments
Closed

GEOTRANSFORM "start", "end" casted to START END #50

loicgasser opened this issue Jan 30, 2018 · 9 comments

Comments

@loicgasser
Copy link
Contributor

from mappyfile.parser import Parser                                             
from mappyfile.pprint import PrettyPrinter                                      
from mappyfile.transformer import MapfileToDict                                 
from mappyfile.validator import Validator                                       
                                                                                
                                                                                
                                                                                
def output(s, include_position=True, schema_name="map"):                        
    """                                                                         
    Parse, transform, validate, and pretty print                                
    the result                                                                  
    """                                                                         
    p = Parser()                                                                
    m = MapfileToDict(include_position=include_position)                        
    ast = p.parse(s)                                                            
    d = m.transform(ast)                                                        
    v = Validator()                                                             
    errors = v.validate(d, schema_name=schema_name)                             
    pp = PrettyPrinter(indent=0, newlinechar=" ", quote="'")                    
    s = pp.pprint(d)                                                            
    print s                                                                     
    assert(len(errors) == 0)                                                    
    return s                                                                    
                                                                                
                                                                                
s = """                                                                         
STYLE                                                                           
  SIZE 0                                                                        
  GEOMTRANSFORM "end"                                                           
END                                                                             
"""                                                                             
                                                                                
output(s, schema_name="style") 

Result:

STYLE SIZE 0 GEOMTRANSFORM END END
@geographika
Copy link
Owner

That's a nasty one..!

From http://mapserver.org/mapfile/geomtransform.html#end-and-start

GEOMTRANSFORM "end" (since END is used to end objects in the map file, end must be embedded in quotes)

Would you be able to check if the following is valid Mapfile syntax:?

    STYLE                                                                           
        SIZE 0                                                                        
        GEOMTRANSFORM START                                                
    END  

If so I can add a check just for the "end" keyword when part of a list of valid values.

@loicgasser
Copy link
Contributor Author

Yes I ll come back to you with the answer.

@geographika
Copy link
Owner

Fixed in 0.6.2 release.

For reference the following block is valid. It is only "END" that needs to be quoted.

STYLE                                                                           
      SIZE 0                                                                        
      GEOMTRANSFORM START                                                
END  

@loicgasser
Copy link
Contributor Author

👏 sorry I forgot this one.

I will test again 😄

Thanks!

@loicgasser
Copy link
Contributor Author

Ah but this is not fixed.
"end" is still casted to END.
And yes START is valid but a bit confusing.
I wouldn't close... since it is still not fixed.

@loicgasser
Copy link
Contributor Author

ping @geographika not fixed

@geographika
Copy link
Owner

@loicgasser - could you try with v0.7?

@geographika geographika reopened this Apr 4, 2018
@loicgasser
Copy link
Contributor Author

yes it does work with 0.7.0

It didn't with 0.6.2

thank you

FYI:
I have a warning that is present in both versions.

ERROR:mappyfile:The key 'rangeitem' was not found in the JSON schema for 'style'

  CLASS                                                                         
    NAME "0 1.5"                                                                
    STYLE                                                                       
      COLORRANGE 214 214 255 0 57 148                                           
      DATARANGE 0 1.5                                                           
      RANGEITEM accalcohol_ugt_usv_perpopulation                                
      OUTLINECOLOR 110 110 110                                                  
      WIDTH 1                                                                   
    END                                                                         
  END 

But it seems it's only a warning.

geographika added a commit that referenced this issue Apr 5, 2018
@geographika
Copy link
Owner

@loicgasser thanks for the report. RANGEITEM was missing from the MapServer docs. Added with MapServer/MapServer-documentation#233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants