Skip to main content

Tile maps rendered with Vispy

Project description

Vismap

Provides a ViewBox for creating maps with Vispy. The view automatically gets its tiles from a TileProvider based on the zoom level. Several tile providers are bundled with this project; adding a tile provider simply requires knowing the URL at which to grab a tile, and providing the attribution text for the tiles. You can add your own data to the map by creating SceneVisuals and setting the parent to the created view.scene.

Run the provided example to check out how interacting with the map works. The script is installed as vismap-example if you install vismap; so from your command line just run

vismap-example

Use the left and right arrow keys to change the tile provider.

Vismap provides you with a map on which to plot your own data. An example map:

Stamen Toner Inverted

What's the Point?

The idea is to be able to display real-time geographical data on top of a map–for example, radar data. This project provides the view which automatically fills the map based on the current zoom level, and also provides transforms, so you can actually view data on top of the map. The transforms are located in vismap/transforms.py.

Currently, two transforms are provided: MercatorTransform and RelativeMercatorTransform. Use the MercatorTransform when your data is naturally represented in longitude/latitude pairs. For example, the following will draw a line from Norman, OK to Oklahoma City, OK:

from vismap import Canvas, MercatorTransform
import vispy.scene.visuals as visuals
from vispy import app
import numpy as np

c = Canvas()
c.show()
line = visuals.Line(np.array([[-97.4395, 35.2226], [-97.5164, 35.4676]]),
                    parent=c.view.scene)
line.transform = MercatorTransform()  # the magic line!
app.run()

The RelativeMercatorTransform is for plotting data that is naturally expressed in units of length, but would be nice if it were centered somewhere geographically. The motivating use case is radar data: it makes sense to think of the data in meters, relative to a specific latitude and longitude.

When you are using these transforms, make sure you always remember to add the visual to the correct scene, otherwise the data will not show up and it will probably be confusing.

Installing

Vismap is available via pip:

pip install vismap

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vismap-0.2.1.tar.gz (216.9 kB view hashes)

Uploaded Source

Built Distribution

vismap-0.2.1-py3-none-any.whl (217.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page