Skip to main content

manage files in xyz tile format

Project description

xyztilefile

Samples

Basic usage sample.

from xyztilefile import *
xyz = calc_xyz_from_lonlat

x, y, z = calc_xyz_from_lonlat(135.0,35.0,15)

test_txt = XYZTileFile("./tile_sample/{z}/{x}/{y}.txt")
txt = test_txt.get(*xyz(135.0,35.0,15))
test_txt.set(x,y,z,txt+"\nNew line is added")
test_txt.save(x,y,z)

Usage sample of XYZTileManager

from xyztilefile import *
xyz = calc_xyz_from_lonlat

test_json = XYZTileManager("https://raw.githubusercontent.com/aDAVISk/xyztilefile/dev/tile_sample/{z}/{x}/{y}.json", "./tile_sample2/{z}/{x}/{y}.json")
data = test_json.get(*xyz(135.0,35.0,15))

XYZTileManager first check the locally saved cache which is the second argument. If such local file is missing, then XYZTileManager will try to retrieve data from the online source which is the first argument.

please check './test/' for more sample codes

currently supported file formats

  • txt : encoding must be UTF-8

  • json : encoding must be UTF-8

  • png : with skit-image (tested with ./test/test_png.py)

  • npy : with numpy (tested with ./test/test_npy.py)

  • pickle/pkl : only for local file with extra keyword setting at the initialization XYZTileFile(basepath, allow_pickle=True) (tested with ./test/test_pickle.py)

  • (generic : this format is basic but your customization is needed.)

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

xyztilefile-0.3.3.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

xyztilefile-0.3.3-py3-none-any.whl (10.3 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