Skip to main content

Generator of tiles and js for Yandex Maps Hotspots v2

Project description

Yandex Hotsposts

Python library to generate tiles and js for Yandex Maps Hotspots version 2. Beware, hotspots js api is not documented well. Use at your own risk. Works on python 2.6-2.7.

It’s a fork of an app by Paul Koltyshev, called django-hotspots. yandex-hotspots is written to support new version of hotspots API and primarily to be django-free package.

This lib supports only simplest of hotspots: points.

Usage

Subclass HotspotsManager and define at least these methods:

from PIL import Image
from hotspots import HotspotsManager


class MyHotspotsManager(HotspotsManager):
    img_big = Image.open('static/images/big_marker.png')
    img_small = Image.open('static/images/small_marker.png')

    def get_base_path(self):
        """ Where to save tiles"""
        return 'static/hotspots'

    def get_img(self, obj, scale):
        """ Hotspot image object"""
        return self.img_big if scale > 12 else self.img_small

    def get_lng(self, obj):
        """ Latitude of your object"""
        return obj.coordinates[0]

    def get_lat(self, obj):
        """ Longitude """
        return obj.coordinates[1]

Run hotspot generator:

# Obtain data for hotspots (some locations with data)
data_iterable = [{'coordinates': (37.925288, 55.720903), 'title': 'My House'}, <...>]

# Generate hotspots for zoom levels raging form 10 to 17
MyHotspotsManager().generate_tiles(data_iterable, scale=(10, 17))

And finally put together created hotspots and some clientside.

Ballon content and hint

Use gett_descr(self, obj) and get_name(self, obj) respectively.

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

yandex-hotspots-0.1.zip (7.5 kB view details)

Uploaded Source

File details

Details for the file yandex-hotspots-0.1.zip.

File metadata

  • Download URL: yandex-hotspots-0.1.zip
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yandex-hotspots-0.1.zip
Algorithm Hash digest
SHA256 2d0a1c7ad3f8aff36f540f6e021e842c8b0a7081ac5bc2c9471076211d2bc62f
MD5 aee7b13541cd969662a17c8d0c02d428
BLAKE2b-256 dd720ab7fdb80b391ad8a53c7e706d30caea9f7068236b069fea2e7d71084b94

See more details on using hashes here.

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