Skip to main content

mappyfile

Version Docs Build Status Coveralls Appveyor Build Status Downloads

A pure Python parser for working with MapServer MapFiles, built using Lark

An online formatter demonstrating the libraries capabilities can be found at: http://mappyfile.geographika.net/

A presentation on mappyfile was given at FOSS4G Europe 2017 - slides are available for download here.

https://raw.githubusercontent.com/geographika/mappyfile/master/docs/images/class_parsed_small.png

Requirements

  • Python 2.7 or Python 3.x

Installation

mappyfile is available on PyPI (Python Package Index), and can be installed using pip:

pip install mappyfile

This will also install its required dependences Lark (lark-parser), and jsonschema.

Documentation

Full documentation is available at http://mappyfile.readthedocs.io/en/latest/

Usage

From within Python scripts:

import mappyfile

mapfile = mappyfile.open("./docs/examples/raster.map")

# update the map name
mapfile["name"] = "MyNewMap"

new_layer_string = """
LAYER
    NAME 'land'
    TYPE POLYGON
    DATA '../data/vector/naturalearth/ne_110m_land'
    CLASS
        STYLE
            COLOR 107 208 107
            OUTLINECOLOR 2 2 2
            WIDTH 1
        END
    END
END
"""

layers = mapfile["layers"]

new_layer = mappyfile.loads(new_layer_string)

layers.insert(0, new_layer) # insert the new layer at any index in the Mapfile

for l in layers:
    print("{} {}".format(l["name"], l["type"]))

print(mappyfile.dumps(mapfile, indent=1, spacer="\t"))

Two command line tools are available - format and validate:

mappyfile format raster.map formatted_raster.map
mappyfile validate D:\ms-ogc-workshop\ms4w\apps\ms-ogc-workshop\**\*.map

Authors

Contributors

Metadata

Release files for mappyfile 0.8.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mappyfile 0.8.3
File Size Uploaded Provenance Actions
mappyfile-0.8.3.tar.gz 87.7 kB Without provenance Details for mappyfile-0.8.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mappyfile 0.8.3
File Actions
mappyfile-0.8.3-py3.7.egg Legacy Egg format - - Details for mappyfile-0.8.3-py3.7.egg
mappyfile-0.8.3-py3.6.egg Legacy Egg format - - Details for mappyfile-0.8.3-py3.6.egg
mappyfile-0.8.3-py2.py3-none-any.whl Python 2, Python 3 none any Details for mappyfile-0.8.3-py2.py3-none-any.whl
mappyfile-0.8.3-py2.7.egg Legacy Egg format - - Details for mappyfile-0.8.3-py2.7.egg

Total release size: 353.2 kB

Release files / mappyfile-0.8.3.tar.gz

Download URL mappyfile-0.8.3.tar.gz
Size 87.7 kB
Tags Source
SHA-256 checksum
How to use checksums
91cfb4bc8ed68a3753c6746ea5b564a07f5f9f36587b063e70e75bb978eb23b2
BLAKE2b-256 checksum
How to use checksums
650f68c210867bc29cfc1cbc7a3cf665b1c9a074c4fbfcfe4b88e95fea74c83e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

Release files / mappyfile-0.8.3-py3.7.egg

Download URL mappyfile-0.8.3-py3.7.egg
Size 74.2 kB
Tags Egg
SHA-256 checksum
How to use checksums
0dca01339b10cd3da6e9b8e9707e0d7db61d7a8f7b5f736b8e280e0b721701e6
BLAKE2b-256 checksum
How to use checksums
37597c0e2fd36fb1c37d5d2c960357715a78a3e819a05fd03f0705888f6e28a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / mappyfile-0.8.3-py3.6.egg

Download URL mappyfile-0.8.3-py3.6.egg
Size 74.1 kB
Tags Egg
SHA-256 checksum
How to use checksums
106134c47b337a60a9825e3c7c6b293a557c16cc331113578542e520f13827b9
BLAKE2b-256 checksum
How to use checksums
d7bb813e5e2d67136b3df2ac11a7223cbc536702fc79a4044cce91a0b969e9a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

Release files / mappyfile-0.8.3-py2.py3-none-any.whl

Download URL mappyfile-0.8.3-py2.py3-none-any.whl
Size 43.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
91cdeafadd0b60b66a7e450e46afb3525094121d578e4c782ac57170d068a4bc
BLAKE2b-256 checksum
How to use checksums
7cc00890c40d4b21eef9cef0c219d12eaa36a8df8b2b8eec97e8e343f1553af7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15

Release files / mappyfile-0.8.3-py2.7.egg

Download URL mappyfile-0.8.3-py2.7.egg
Size 73.2 kB
Tags Egg
SHA-256 checksum
How to use checksums
dcd5e385c17bafcc59fa062a988c03c222252fa54dd032ea1469c0de7406aa3a
BLAKE2b-256 checksum
How to use checksums
ec7895602d9b0051d688d06b3516640cdbb6473d6de856b53b362de7790a4239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/2.7.16

Security for mappyfile 0.8.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.8.3 This release

5 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page