Skip to main content

Python library for reading and writing GEMF map tile files.

Project description

GEMF

Python package for the GEMF map format. From the format specification:

This tile store format is intended to provide a static (i.e. cannot be updated without regenerating from scratch) file containing a large number of tiles, stored in a manner that makes efficient use of SD cards and with which it is easy to access individual tiles very quickly. It is intended to overcome the existing issues with the way tiles are stored in most existing Android map applications as these are not very scalable.

.gemf files may be used in mobile mapping applications like Locus

Installation

pip install gemf-map

Features

Core features are...

  • reading .gemf map files via the GEMF.from_file() classmethod
  • creating a GEMF object from PNG or JPG tiles via the GEMF.from_tiles() classmethod
  • writing a newly created GEMF object to file via the write() method

Further features are...

  • spatially subset (crop) a .gemf file
  • extracting image tiles from binary .gemf files via the save_tiles() method
  • adding tiles to an existing .gemf file (TODO)
  • combining GEMF objects via stack()/+, merge()/|, intersect()/& and difference()/-

Visualization features:

  • show the tiles of a .gemf file on a folium map
  • show tile boundaries on a map

Usage

Core

from gemf import GEMF

# load an existing .gemf file
my_gemf = GEMF.from_file("MY_GEMF.gemf")

# extract the tiles
my_gemf.save_tiles("PATH/TO/TILEDIR")

# create a GEMF object from tiles on disk
new_gemf = GEMF.from_tiles("PATH/TO/TILEDIR")

# write GEMF object to .gemf file
new_gemf.write("PATH/TO/GEMF_FILE.gemf")

Manipulation

# crop to bounding box (all zoom levels will be cropped accordingly)
gemf_crop = my_gemf.crop(7, 60, 62, 36, 38)

Combining GEMF objects

# stack: add all sources of gemf2 onto gemf1 as new sources
combined = gemf1 + gemf2

# merge: union of tiles for sources present in both (matched by name)
# on conflicting tiles, "|" keeps gemf1's tile by default
merged = gemf1 | gemf2

# intersect: keep only tiles present in both, for shared sources
shared = gemf1 & gemf2

# difference: keep gemf1's tiles that are not present in gemf2's matching source
diff = gemf1 - gemf2

Visualization

from gemf.plot import GEMFPlot

# visualize tiles and tile boundaries
gemf_map = GEMFPlot(my_gemf)

# visualize tiles without boundaries
tile_map = GEMFPlot(my_gemf, show_tile_boundaries=False)

# visualize only boundaries (to avoid loading tile contents from disk)
boundary_map = GEMFPlot(my_gemf, show_tiles=False)

Other

# save the embedded tiles to image files
gemf_map.save_tiles("path/to/output/dir")

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

gemf_map-1.0.3.tar.gz (49.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gemf_map-1.0.3-py3-none-any.whl (50.0 kB view details)

Uploaded Python 3

File details

Details for the file gemf_map-1.0.3.tar.gz.

File metadata

  • Download URL: gemf_map-1.0.3.tar.gz
  • Upload date:
  • Size: 49.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gemf_map-1.0.3.tar.gz
Algorithm Hash digest
SHA256 7050c272ebf618448e9743921845cc657dca463cb45ad97fbbfba86efb08758c
MD5 ef7a4736fa00f5faeccd85c8771864e3
BLAKE2b-256 4de80f6000c7a17d030c94938e1b5e684a5be9fa7fbfc78cd93cc4ccc7c18b13

See more details on using hashes here.

Provenance

The following attestation bundles were made for gemf_map-1.0.3.tar.gz:

Publisher: publish.yml on ColinMoldenhauer/GEMF

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gemf_map-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: gemf_map-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 50.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gemf_map-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2f61e117e6c493d6385d5b04cf76ea3b855cd6193f92f372e9b073dbbf5e4a90
MD5 c425046e71e8b88deb4b41a7283e6f2c
BLAKE2b-256 90d93a86016eb680ba734a4310cf0bb8e3c7e25eb7f04fbff351a3ca7fa71b5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for gemf_map-1.0.3-py3-none-any.whl:

Publisher: publish.yml on ColinMoldenhauer/GEMF

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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