mappyfile

A Python library to create, parse, modify, and format MapServer Mapfiles.

community project

mappyfile

community projectmappyfile_logo

mappyfile takes a Mapfile as input and parses it into an Abstract syntax tree (AST) using lark a Python parsing library. mappyfile can then transform the AST into a dictionary structure, containing keys and values of dicts, and lists familiar to Python programmers. This structure can be edited directly. Alternatively new objects can be added by parsing further Mapfile text and inserting into the dictionary structure.

mappyfile also includes a “pretty printer” to export this dictionary structure back to a Mapfile, with keyword formatting and indentation.

An online-editor built on mappyfile is available at https://app.mapserverstudio.net/.

Core features

  • Python Library

    • Pure Python - no MapServer dependencies
    • Open Source License (MIT)
  • Mapfile Functionality

    • Parsing
    • Transforming
    • Pretty Printing
    • Validation