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
- 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
- WMS 1.1.1 http://localhost:8080/wms which supports also tile links
http://localhost:8080/wms/{layer_id}/{z}/{x}/{y}{ext}
with reprojection. Conventional URL placeholders:{z}
,{x}
,{y}
,{-y}
etc - WMTS 1.0.0 http://127.0.0.1:8080/wmts/1.0.0/WMTSCapabilities.xml Also provides tile proxy without reprojection
http://localhost:8080/wmts/{layer_id}/{z}/{x}/{y}{ext}
- Imagery overview web page http://localhost:8080 with JOSM remote control (
wms
,tms:
) links- Open "JOSM Imagery > Imagery preferences > Press +TMS, Selected entries" and paste link from here. E.g.:
tms:http://localhost:8080/wms/vesat/{z}/{x}/{y}.jpg
- Open "JOSM Imagery > Imagery preferences > Press +TMS, Selected entries" and paste link from here. E.g.:
- JOSM imagery XML: http://localhost:8080/josm/maps.xml - imagery list for
imagery.layers.sites
property
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
TWMS uses Slippy map tilenames cache in MOBAC format i.e. filesystem with {z}/{x}/{y}{ext}
.
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's quirks:
-
Imposible to specify just one global relative 'directory' and use caches prefixes
-
'format'
image/jpg
for '.jpg' andimage/jpeg
for '.jpeg' file namescaches: 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/
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:
- Set property 'imagery.generic.loader.cachedir' to
/dev/shm/JOSM/tiles
or start JOSM with parameter-Djosm.cache=/dev/shm/JOSM/tiles
. - Set property 'imagery.cache.max_disk_size' to reasonable value, e.g. 64 Mb, to not exceed RAM
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.
-
Check http://127.0.0.1:8080 for available
file://
links -
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