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

Comments

Projects
None yet
2 participants
@loicgasser
Contributor

loicgasser commented Jan 30, 2018

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

This comment has been minimized.

Owner

geographika commented Jan 31, 2018

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

This comment has been minimized.

Contributor

loicgasser commented Jan 31, 2018

Yes I ll come back to you with the answer.

@geographika

This comment has been minimized.

Owner

geographika commented Feb 26, 2018

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

This comment has been minimized.

Contributor

loicgasser commented Feb 26, 2018

👏 sorry I forgot this one.

I will test again 😄

Thanks!

@loicgasser

This comment has been minimized.

Contributor

loicgasser commented Feb 26, 2018

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

This comment has been minimized.

Contributor

loicgasser commented Mar 28, 2018

ping @geographika not fixed

@geographika

This comment has been minimized.

Owner

geographika commented Apr 4, 2018

@loicgasser - could you try with v0.7?

@geographika geographika reopened this Apr 4, 2018

@loicgasser

This comment has been minimized.

Contributor

loicgasser commented Apr 5, 2018

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

This comment has been minimized.

Owner

geographika commented Apr 5, 2018

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

@geographika geographika closed this Apr 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment