[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/osm c2c7dff887 22/77: Compact server configuration
From: |
ELPA Syncer |
Subject: |
[elpa] externals/osm c2c7dff887 22/77: Compact server configuration |
Date: |
Mon, 7 Mar 2022 08:58:05 -0500 (EST) |
branch: externals/osm
commit c2c7dff887dd24f37fbc3e6dde775cc057400ae9
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Compact server configuration
---
osm.el | 66 ++++++++++++++++++++++++++----------------------------------------
1 file changed, 26 insertions(+), 40 deletions(-)
diff --git a/osm.el b/osm.el
index 5977b25b59..1dd77fa9c3 100644
--- a/osm.el
+++ b/osm.el
@@ -42,69 +42,47 @@
'((default
:name "OpenStreetMap"
:min-zoom 2 :max-zoom 19 :max-connections 2
- :url ("https://a.tile.openstreetmap.org/%z/%x/%y.png"
- "https://b.tile.openstreetmap.org/%z/%x/%y.png"
- "https://c.tile.openstreetmap.org/%z/%x/%y.png"))
+ :url "https://[abc].tile.openstreetmap.org/%z/%x/%y.png")
(de
:name "OSM Deutschland"
:min-zoom 2 :max-zoom 19 :max-connections 2
- :url ("https://a.tile.openstreetmap.de/%z/%x/%y.png"
- "https://b.tile.openstreetmap.de/%z/%x/%y.png"
- "https://c.tile.openstreetmap.de/%z/%x/%y.png"))
+ :url "https://[abc].tile.openstreetmap.de/%z/%x/%y.png")
(fr
:name "OSM France"
:min-zoom 2 :max-zoom 19 :max-connections 2
- :url ("https://a.tile.openstreetmap.fr/osmfr/%z/%x/%y.png"
- "https://b.tile.openstreetmap.fr/osmfr/%z/%x/%y.png"
- "https://c.tile.openstreetmap.fr/osmfr/%z/%x/%y.png"))
+ :url "https://[abc].tile.openstreetmap.fr/osmfr/%z/%x/%y.png")
(humanitarian
:name "OSM Humanitarian"
:min-zoom 2 :max-zoom 19 :max-connections 2
- :url ("https://a.tile.openstreetmap.fr/hot/%z/%x/%y.png"
- "https://b.tile.openstreetmap.fr/hot/%z/%x/%y.png"
- "https://c.tile.openstreetmap.fr/hot/%z/%x/%y.png"))
+ :url "https://[abc].tile.openstreetmap.fr/hot/%z/%x/%y.png")
(opentopomap
:name "OpenTopoMap"
:min-zoom 2 :max-zoom 17 :max-connections 2
- :url ("https://a.tile.opentopomap.org/%z/%x/%y.png"
- "https://b.tile.opentopomap.org/%z/%x/%y.png"
- "https://c.tile.opentopomap.org/%z/%x/%y.png"))
+ :url "https://[abc].tile.opentopomap.org/%z/%x/%y.png")
(opvnkarte
:name "ÖPNVKarte"
:min-zoom 2 :max-zoom 18 :max-connections 2
- :url ("http://a.tile.memomaps.de/tilegen/%z/%x/%y.png"
- "http://b.tile.memomaps.de/tilegen/%z/%x/%y.png"
- "http://c.tile.memomaps.de/tilegen/%z/%x/%y.png"))
+ :url "http://[abc].tile.memomaps.de/tilegen/%z/%x/%y.png")
(cyclosm
:name "CyclOSM"
:min-zoom 2 :max-zoom 19 :max-connections 2
- :url ("https://a.tile.openstreetmap.fr/cyclosm/%z/%x/%y.png"
- "https://b.tile.openstreetmap.fr/cyclosm/%z/%x/%y.png"
- "https://c.tile.openstreetmap.fr/cyclosm/%z/%x/%y.png"))
+ :url "https://[abc].tile.openstreetmap.fr/cyclosm/%z/%x/%y.png")
(openriverboatmap
:name "OpenRiverBoatMap"
:min-zoom 2 :max-zoom 19 :max-connections 2
- :url ("https://a.tile.openstreetmap.fr/openriverboatmap/%z/%x/%y.png"
- "https://b.tile.openstreetmap.fr/openriverboatmap/%z/%x/%y.png"
- "https://c.tile.openstreetmap.fr/openriverboatmap/%z/%x/%y.png"))
+ :url "https://[abc].tile.openstreetmap.fr/openriverboatmap/%z/%x/%y.png")
(stamen-watercolor
:name "Stamen Watercolor"
:min-zoom 2 :max-zoom 19 :max-connections 2
- :url ("https://stamen-tiles-a.a.ssl.fastly.net/watercolor/%z/%x/%y.jpg"
- "https://stamen-tiles-b.a.ssl.fastly.net/watercolor/%z/%x/%y.jpg"
- "https://stamen-tiles-c.a.ssl.fastly.net/watercolor/%z/%x/%y.jpg"))
+ :url
"https://stamen-tiles-[abc].a.ssl.fastly.net/watercolor/%z/%x/%y.jpg")
(stamen-terrain
:name "Stamen Terrain"
:min-zoom 2 :max-zoom 18 :max-connections 2
- :url ("https://stamen-tiles-a.a.ssl.fastly.net/terrain/%z/%x/%y.png"
- "https://stamen-tiles-b.a.ssl.fastly.net/terrain/%z/%x/%y.png"
- "https://stamen-tiles-c.a.ssl.fastly.net/terrain/%z/%x/%y.png"))
+ :url "https://stamen-tiles-[abc].a.ssl.fastly.net/terrain/%z/%x/%y.png")
(stamen-toner
:name "Stamen Toner"
:min-zoom 2 :max-zoom 19 :max-connections 2
- :url ("https://stamen-tiles-a.a.ssl.fastly.net/toner/%z/%x/%y.png"
- "https://stamen-tiles-b.a.ssl.fastly.net/toner/%z/%x/%y.png"
- "https://stamen-tiles-c.a.ssl.fastly.net/toner/%z/%x/%y.png")))
+ :url "https://stamen-tiles-[abc].a.ssl.fastly.net/toner/%z/%x/%y.png"))
"List of tile servers."
:type '(alist :key-type symbol :value-type plist))
@@ -250,17 +228,22 @@ We need two distinct images which are not `eq' for the
display properties.")
(defun osm--tile-url (x y zoom)
"Return tile url for coordinate X, Y and ZOOM."
- (let ((url (osm--server-property :url)))
+ (let ((url (osm--server-property :url))
+ (count 1))
+ (save-match-data
+ (when (string-match "\\`\\(.*\\)\\[\\(.*\\)\\]\\(.*\\)\\'" url)
+ (setq count (- (match-end 2) (match-beginning 2))
+ url (concat (match-string 1 url)
+ (char-to-string (aref (match-string 2 url)
osm--url-index))
+ (match-string 3 url)))))
(prog1
- (format-spec (nth osm--url-index url) `((?z . ,zoom) (?x . ,x) (?y .
,y)))
- (setq osm--url-index
- (mod (1+ osm--url-index)
- (length url))))))
+ (format-spec url `((?z . ,zoom) (?x . ,x) (?y . ,y)))
+ (setq osm--url-index (mod (1+ osm--url-index) count)))))
(defun osm--tile-file (x y zoom)
"Return tile file name for coordinate X, Y and ZOOM."
(format "%s%d-%d-%d.%s" (osm--cache-directory) zoom x y
- (file-name-extension (car (osm--server-property :url)))))
+ (file-name-extension (osm--server-property :url))))
(defun osm--cache-directory ()
"Return tile cache directory."
@@ -281,7 +264,10 @@ We need two distinct images which are not `eq' for the
display properties.")
(defun osm--download ()
"Download next tile in queue."
(when-let (job (and (< (length osm--active)
- (* (length (osm--server-property :url))
+ (* (save-match-data
+ (if (string-match "\\[\\(.*\\)\\]"
+ (osm--server-property :url))
+ (- (match-end 1) (match-beginning 1)) 1))
(osm--server-property :max-connections)))
(pop osm--queue)))
(push job osm--active)
- [elpa] externals/osm 7a1d920492 59/77: Display bookmarks in map, (continued)
- [elpa] externals/osm 7a1d920492 59/77: Display bookmarks in map, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 25d891088f 70/77: Emacs 27 base64 encoding fallback, ELPA Syncer, 2022/03/07
- [elpa] externals/osm ec97b1d1c0 23/77: Add separate hook function, ELPA Syncer, 2022/03/07
- [elpa] externals/osm ee64b96509 56/77: Add map variant, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 1bd4751bcf 34/77: Better link names, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 7a50000e1e 58/77: Add separate resize function, revert tile cache, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 4c9337bf79 69/77: Update README, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 76b41f5fb5 51/77: Add keybindings, ELPA Syncer, 2022/03/07
- [elpa] externals/osm a6335090e9 33/77: Handle multiple windows, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 2fbf12f0ef 46/77: seq is not needed, ELPA Syncer, 2022/03/07
- [elpa] externals/osm c2c7dff887 22/77: Compact server configuration,
ELPA Syncer <=
- [elpa] externals/osm 7ce1d26c88 67/77: Extract osm--make-tile, ELPA Syncer, 2022/03/07
- [elpa] externals/osm ff8ff68b4d 65/77: Check if bookmarks are present, ELPA Syncer, 2022/03/07
- [elpa] externals/osm cb191d426f 76/77: Version 0.2, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 8e8e4583f5 74/77: More robust mouse dragging, ELPA Syncer, 2022/03/07
- [elpa] externals/osm d776cdb343 42/77: Fix melpa issues (See https://github.com/melpa/melpa/pull/7936), ELPA Syncer, 2022/03/07
- [elpa] externals/osm 5b82b32201 28/77: Add server descriptions, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 832bce78f8 72/77: Implement proper map dragging with the mouse, ELPA Syncer, 2022/03/07
- [elpa] externals/osm df844cd56b 30/77: Add osm-rename command, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 458257fa1f 19/77: Improve tile loading, ELPA Syncer, 2022/03/07
- [elpa] externals/osm 699aae27b1 20/77: Rename osm-new to osm-home, ELPA Syncer, 2022/03/07