Skip to main content

Mapkick.py

Create beautiful JavaScript maps with one line of Python. No more fighting with mapping libraries!

See it in action

For static maps, check out Mapkick Static.py, and for charts, check out Chartkick.py

Build Status

Installation

Run:

pip install mapkick

Mapkick uses Mapbox GL JS v1. To use tiles from Mapbox, create a Mapbox account to get an access token and set MAPBOX_ACCESS_TOKEN in your environment.

Then follow the instructions for your web framework:

Django

Add to INSTALLED_APPS in settings.py

INSTALLED_APPS = [
    'mapkick.django',
    # ...
]

Load the JavaScript

{% load static %}

<script src="{% static 'mapkick.bundle.js' %}"></script>

Create a map in a view

from mapkick.django import Map

def index(request):
    map = Map([{'latitude': 37.7829, 'longitude': -122.4190}])
    return render(request, 'home/index.html', {'map': map})

And add it to the template

{{ map }}

Flask

Register the blueprint

from mapkick.flask import mapkick_blueprint

app.register_blueprint(mapkick_blueprint)

Load the JavaScript

<script src="{{ url_for('mapkick.static', filename='mapkick.bundle.js') }}"></script>

Create a map in a route

from mapkick.flask import Map

def index():
    map = Map([{'latitude': 37.7829, 'longitude': -122.4190}])
    return render_template('home/index.html', map=map)

And add it to the template

{{ map }}

Maps

Point map

Map([{'latitude': 37.7829, 'longitude': -122.4190}])

Area map

AreaMap([{'geometry': {'type': 'Polygon', 'coordinates': ...}}])

Data

Data can be a list

Map([{'latitude': 37.7829, 'longitude': -122.4190}])

Or a URL that returns JSON (same format as above)

Map('/restaurants')

Point Map

Use latitude or lat for latitude and longitude, lon, or lng for longitude

You can specify a label, tooltip, and color for each data point

{
  'latitude': ...,
  'longitude': ...,
  'label': 'Hot Chicken Takeover',
  'tooltip': '5 stars',
  'color': '#f84d4d'
}

Area Map

Use geometry with a GeoJSON Polygon or MultiPolygon

You can specify a label, tooltip, and color for each data point

{
  'geometry': {'type': 'Polygon', 'coordinates': ...},
  'label': 'Hot Chicken Takeover',
  'tooltip': '5 stars',
  'color': '#0090ff'
}

Options

Width and height

Map(data, width='800px', height='500px')

Marker color

Map(data, markers={'color': '#f84d4d'})

Show tooltips on click instead of hover

Map(data, tooltips={'hover': False})

Allow HTML in tooltips (must sanitize manually)

Map(data, tooltips={'html': True})

Map style

Map(data, style='mapbox://styles/mapbox/outdoors-v12')

Zoom and controls

Map(data, zoom=15, controls=True)

Refresh data from a remote source every n seconds

Map(url, refresh=60)

Pass options directly to the mapping library

Map(data, library={'hash': True})

See the documentation for Mapbox GL JS for more info

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/mapkick.py.git
cd mapkick.py
pip install --group dev
pytest

Metadata

Release files for mapkick 0.3.0

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

Source distribution (sdist)

Source distribution for mapkick 0.3.0
File Size Uploaded Provenance Actions
mapkick-0.3.0.tar.gz 222.3 kB Without provenance Details for mapkick-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mapkick 0.3.0
File Interpreter ABI Platform Actions
mapkick-0.3.0-py3-none-any.whl Python 3 none any Details for mapkick-0.3.0-py3-none-any.whl

Total release size: 443.1 kB

Release files / mapkick-0.3.0.tar.gz

Download URL mapkick-0.3.0.tar.gz
Size 222.3 kB
Tags Source
SHA-256 checksum
How to use checksums
49e9c77ce7b6080dced0e7493c732d1b877e469c5f2c29a702ee9eec1cc958d8
BLAKE2b-256 checksum
How to use checksums
43860a9658f7e8e5a6bf371b4c8dd11730350b94814d370443cff0b17fb68f12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / mapkick-0.3.0-py3-none-any.whl

Download URL mapkick-0.3.0-py3-none-any.whl
Size 220.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adc41720c168b2a2373f45a54ee782fb0bc7ce9d5ebb6890bdebf1831b6a85d2
BLAKE2b-256 checksum
How to use checksums
3b7882dfaafd0b98840852835dfc63cf408f3438cfed396f42ac3c5819b7b5cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for mapkick 0.3.0

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.

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