{"id":19632528,"url":"https://github.com/metwork-framework/mapserverapi_python","last_synced_at":"2025-10-15T15:56:00.104Z","repository":{"id":94537716,"uuid":"155371596","full_name":"metwork-framework/mapserverapi_python","owner":"metwork-framework","description":"tiny python library to invoke mapserver engine as a library","archived":false,"fork":false,"pushed_at":"2025-05-15T06:27:19.000Z","size":198,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-15T07:23:02.466Z","etag":null,"topics":["autoreadme","github-actions","integration-level-3","library","mapserver","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metwork-framework.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-30T11:10:46.000Z","updated_at":"2025-05-15T06:27:22.000Z","dependencies_parsed_at":"2025-04-28T10:47:15.713Z","dependency_job_id":"76f16123-c058-4f22-a9c3-78c183daae50","html_url":"https://github.com/metwork-framework/mapserverapi_python","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/metwork-framework/mapserverapi_python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fmapserverapi_python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fmapserverapi_python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fmapserverapi_python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fmapserverapi_python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metwork-framework","download_url":"https://codeload.github.com/metwork-framework/mapserverapi_python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metwork-framework%2Fmapserverapi_python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279090310,"owners_count":26101179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autoreadme","github-actions","integration-level-3","library","mapserver","python"],"created_at":"2024-11-11T12:14:23.117Z","updated_at":"2025-10-15T15:56:00.074Z","avatar_url":"https://github.com/metwork-framework.png","language":"Python","readme":"# mapserverapi_python\n\n[//]: # (automatically generated from https://github.com/metwork-framework/github_organization_management/blob/master/common_files/README.md)\n\n**Status (master branch)**\n\n[![GitHub CI](https://github.com/metwork-framework/mapserverapi_python/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/metwork-framework/mapserverapi_python/actions?query=workflow%3ACI+branch%3Amaster)\n[![Maintenance](https://raw.githubusercontent.com/metwork-framework/resources/master/badges/maintained.svg)](https://github.com/metwork-framework/resources/blob/master/badges/maintained.svg)\n\n\n\n\n## What is it ?\n\nThis is a tiny python library to invoke [mapserver](http://www.mapserver.org) engine\nas a simple library (with no daemon or CGI).\n\n## Why ?\n\nWe don't want to run \"mapserver\" as CGI or even as FastCGI, we already have our python\nworkers and we want to invoke \"mapserver\" features from them directly in Python.\n\nMoreover, we don't like the \"mapscript\" feature because there is always something you can't change with it.\n\n## What is the point ?\n\nThe idea is to dynamically write two strings in your Python processes depending on the incoming request:\n\n- the full content of the mapfile (from a jinja2 template for example)\n- the \"query string\" for mapserver (which can be different from the incoming one)\n\nWith that, you can \"invoke\" mapserver from your Python code as a library and get the output as a Python buffer or redirect the output into a file (which avoid to load in memory the full mapserver output).\n\n## Example\n\n```python\n\n# With your logic, generate a mapfile content and load it (as a string)\n# into mapfile_content\nmapfile_content = [...]\n\n# With your logic, generate the query string for mapserver and put it into\n# mapserver_qs variable (as a string)\nmapserver_qs = \"LAYERS=ocean\u0026TRANSPARENT=true\u0026FORMAT=image%2Fpng\u0026SERVICE=WMS\u0026\" \\\n    \"VERSION=1.1.1\u0026REQUEST=GetMap\u0026STYLES=\u0026EXCEPTIONS=application%2Fvnd.ogc.\" \\\n    \"se_xml\u0026SRS=EPSG%3A4326\u0026BBOX=-180.0,-90.0,180.0,90.0\u0026WIDTH=500\u0026HEIGHT=250\"\n# (just an example)\n\n# Import the wrapper\nimport mapserverapi\n\n# Invoke mapserver and get the output\nbuf, content_type = mapserverapi.invoke(mapfile_content, mapserver_qs)\n\n# You have the content_type of the result and the output buffer (with probably\n# a binary image inside)\n\n[...]\n\n# Same idea but using a file instead of memory\ncontent_type = mapserverapi.invoke_to_file(mapfile_content, mapserver_qs,\n                                           \"/tmp/output.png\")\n\n# You have the content_type of the result in content_type and the raw result\n# in the given filepath\n```\n\n\n\n\n\n\n## Contributing guide\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) file.\n\n\n\n## Code of Conduct\n\nSee [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) file.\n\n\n\n## Sponsors\n\n*(If you are officially paid to work on MetWork Framework, please contact us to add your company logo here!)*\n\n[![logo](https://raw.githubusercontent.com/metwork-framework/resources/master/sponsors/meteofrance-small.jpeg)](http://www.meteofrance.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetwork-framework%2Fmapserverapi_python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetwork-framework%2Fmapserverapi_python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetwork-framework%2Fmapserverapi_python/lists"}