Skip to content

radioxoma/twms

 
 

Repository files navigation

twms

Hacky TMS/WMS proxy for JOSM. Please use only allowed data sources for OpenStreetMap contributing.

  • It's hard to proof which aerial imagery has been traced, but for a sake of OSM license purity use only approved aerial imagery
  • Absolutely forbidden to copy from copyrated maps

About this fork

  • Consider it as hacky replacement for MapProxy
  • Tested for interoperability with JOSM, MapProxy, SAS.Planet
  • Few dependencies (only python-pillow is mandatory), http.server is used instead of webpy
  • Huge refactoring: unsupported code has been dropped (e.g. filters).
  • SAS.Planet Time To Live (TTL), tile not exist *.tne file supported

Services provided

Setting up TWMS

Install dependencies and clone repo:

$ sudo pacman -S python-pillow  # Packages for Archlinux
$ git clone https://github.com/radioxoma/twms.git
$ cd twms

Edit twms/config.py and set tiles_cache path to your SAS.Planet/cache_ma/. Run TWMS in terminal:

$ python -m twms

Shared "Slippy Map" cache

TWMS uses Slippy map tilenames cache in MOBAC format i.e. filesystem with {z}/{x}/{y}{ext}.

SAS.Planet

SAS.Planet works fine with wine. Open "Settings > Options > Cache tab > Set Default cache type to Mobile atlas creator (MOBAC)". So tile path will conform "Slippy Map" standard e.g. SAS.Planet/cache_ma/vesat/{z}/{x}/{y}.jpg. From now you can browse tiles and *.tne "tile not exists" files in SAS.Planet and share the same cache.

MapProxy

MapProxy's quirks:

  • Imposible to specify just one global relative 'directory' and use caches prefixes

  • 'format' image/jpg for '.jpg' and image/jpeg for '.jpeg' file names

    caches: osmmapMapnik: grids: [GLOBAL_WEBMERCATOR] sources: [osm_tiles] cache: type: file directory_layout: tms directory: /home/rx/dev/gis/sasplanet/SAS.Planet/cache_ma/osmmapMapnik/ vesat: grids: [GLOBAL_WEBMERCATOR] sources: [ve_tiles] format: image/jpg cache: type: file directory_layout: tms directory: /home/rx/dev/gis/sasplanet/SAS.Planet/cache_ma/vesat/

Setting up JOSM

At 2021 JOSM uses Java cache system (ticket), which is not a directory with tiles, so it can't be shared. It also cannot be disabled in JOSM, so we move cache dir to RAM disk:

  1. Set property 'imagery.generic.loader.cachedir' to /dev/shm/JOSM/tiles or start JOSM with parameter -Djosm.cache=/dev/shm/JOSM/tiles.
  2. Set property 'imagery.cache.max_disk_size' to reasonable value, e.g. 64 Mb, to not exceed RAM

Load tiles directly from disk

JOSM supports file:// URL pointing to 256x256 tiles in EPSG:3857 projection (like OSM, Bing or Google, but not Yandex as it uses EPSG:3395). So it's possible to make JOSM load tiles directly from SAS.Planet MOBAC cache, without running any server.

  1. Check http://127.0.0.1:8080 for available file:// links

  2. Open JOSM Imagery > Imagery preferences > Press +TMS, Selected entries and paste link. E.g.:

    tms:file:///home/user/dev/gis/sasplanet/SAS.Planet/cache_ma/vesat/{z}/{x}/{y}.jpg tms[18]:file:///c:/SAS.Planet/cache_ma/vesat/{z}/{x}/{y}.jpg # Windows

About

Hacky tile proxy for JOSM

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Python 99.9%
  • Batchfile 0.1%