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

Expression grammar not allowing ! #25

Closed
loicgasser opened this Issue Aug 3, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@loicgasser
Contributor

loicgasser commented Aug 3, 2017

layer = """                                                                     
LAYER                                                                           
    CONNECTION "user=user password=pass host=host dbname=mydb port=5432 options='-c client_encoding=utf-8'"
    CONNECTIONTYPE POSTGIS                                                      
    DATA "the_geom from  (SELECT *,mod(exposurecurve_level_db::integer, 5) as bgdi_modulo_5 FROM bazl.laermbelastungskataster_zivilflugplaetze ) as data using unique bgdi_id using srid=21781"
    NAME "ch.bazl.laermbelastungskataster-zivilflugplaetze_militaer-gesamt"        
    STATUS OFF                                                                  
    TEMPLATE "ttt"                                                              
    TYPE LINE                                                                   
    UNITS METERS                                                                
    LABELITEM exposurecurve_level_db                                            
    LABELMAXSCALEDENOM 20000                                                    
    FILTER "exposuregroup_exposuretype like 'OverallTrafficMilitary_Lr'"        
    METADATA                                                                    
        "ows_title"             "ch.bazl.laermbelastungskataster-zivilflugplaetze_militaer-gesamt"
        "ows_featureid"         "bgdi_id"                                       
        "wms_srs" "EPSG:21781 EPSG:2056 EPSG:4326 EPSG:3857 EPSG:3034 EPSG:3035 EPSG:4258 EPSG:31287 EPSG:25832 EPSG:25833 EPSG:31467 EPSG:32632 EPSG:32633"
        "ows_include_items"     "all"                                           
        "ows_exclude_items"     "bgdi_created_by,bgdi_modified_by,bgdi_created,bgdi_modified,bgdi_modulo_5"
    END                                                                         
    CLASS                                                                       
       NAME "bazl_overalltrafficmilitary_lr_5db"                                
       EXPRESSION ( [bgdi_modulo_5] eq 0 )                                      
       STYLE                                                                    
          COLOR 120 145 60                                                      
          WIDTH 2                                                               
       END                                                                      
       LABEL                                                                    
          COLOR 120 145 60                                                      
          OUTLINECOLOR 255 255 255                                              
          FONT "arialbd"                                                        
          TYPE truetype                                                         
          SIZE 10                                                               
          ANGLE FOLLOW                                                          
          MAXOVERLAPANGLE 40                                                    
          FORCE TRUE                                                            
       END                                                                      
    END                                                                         
                                                                                
    CLASS                                                                       
       NAME "bazl_overalltrafficmilitary_lr_1db"                                
       EXPRESSION ( [bgdi_modulo_5] != 0 )                                      
       STYLE                                                                    
          COLOR 120 145 60                                                      
          WIDTH 1                                                               
       END                                                                      
    END                                                                         
END                                                                                                                                               
"""                                                                         
import mappyfile                                                                
                                                                                
mappyfile.loads(layer)

the code sample above failes and complains about !
But this is still a valid EXPRESSION.
By the way thanks for this lib. ;)

See also:
http://mapserver.org/fr/mapfile/expressions.html#logical-expressions

While this clearly ok:
https://s.geo.admin.ch/74d42d8231

@geographika

This comment has been minimized.

Show comment
Hide comment
@geographika

geographika Aug 3, 2017

Owner

@loicgasser thanks for reporting this. I'll look at adding this into the grammar.
In the meantime does the alternative ne work for you?

Owner

geographika commented Aug 3, 2017

@loicgasser thanks for reporting this. I'll look at adding this into the grammar.
In the meantime does the alternative ne work for you?

@loicgasser

This comment has been minimized.

Show comment
Hide comment
@loicgasser

loicgasser Aug 4, 2017

Contributor

yes it does work with ne.
I've got something like a thousand layers, I am trying to lint with your tool. I may come up with other things. ;)

Contributor

loicgasser commented Aug 4, 2017

yes it does work with ne.
I've got something like a thousand layers, I am trying to lint with your tool. I may come up with other things. ;)

@geographika

This comment has been minimized.

Show comment
Hide comment
@geographika

geographika Aug 7, 2017

Owner

Just to add if you have very large mapfiles maybe try out the experimental lalr_first branch - it is several orders of magnitude faster, although will require falling back to earley in some cases.

Owner

geographika commented Aug 7, 2017

Just to add if you have very large mapfiles maybe try out the experimental lalr_first branch - it is several orders of magnitude faster, although will require falling back to earley in some cases.

@loicgasser

This comment has been minimized.

Show comment
Hide comment
@loicgasser

loicgasser Aug 7, 2017

Contributor

thanks for the tip, I'll try it out.

Contributor

loicgasser commented Aug 7, 2017

thanks for the tip, I'll try it out.

@loicgasser loicgasser closed this Aug 8, 2017

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