Skip to content

feat: support multiple tile URL templates for flat tile maps - #11

Open
LonghiTW wants to merge 1 commit into
BuildTheEarth:mainfrom
LonghiTW:feature/multiple-tile-urls
Open

feat: support multiple tile URL templates for flat tile maps#11
LonghiTW wants to merge 1 commit into
BuildTheEarth:mainfrom
LonghiTW:feature/multiple-tile-urls

Conversation

@LonghiTW

Copy link
Copy Markdown

Add support for 'tile_urls' field in flat tile map services, allowing a single map layer to consist of multiple tile URL sources that are fetched and composited together.

  • Make tile_url and tile_urls mutually exclusive (at least one required)
  • Add UrlOption inner class and tileUrls field to TileMapServiceCommonProperties
  • Update FlatTileMapService to download and composite images from multiple URLs
  • Add Taiwan LiDAR Map as example with multi-year tile_urls in default_maps.yml

Comment thread core/src/main/resources/assets/bteterrarenderer/default_maps.yml
@Zoriot
Zoriot requested a review from Amrsatrio July 28, 2026 17:31
@LonghiTW
LonghiTW force-pushed the feature/multiple-tile-urls branch from 1859fe0 to c0cb344 Compare August 5, 2026 07:56
- tile_url now accepts either a single URL string or a list of URL strings
- internally normalized to List<UrlOption> for compositing
- FlatTileMapService composites all URL options in parallel, drawing in reverse order (later entries on top); per-URL failures are skipped
- serialization keeps the single tile_url field (string for one URL, array for multiple); no separate tile_urls field remains
@LonghiTW
LonghiTW force-pushed the feature/multiple-tile-urls branch from c0cb344 to 5dbbb6c Compare August 5, 2026 08:08
@LonghiTW

LonghiTW commented Aug 5, 2026

Copy link
Copy Markdown
Author

I've reworked the PR based on Zoriot's feedback:

Single field, no dual-field support

You were right that keeping tile_url + tile_urls long-term is a terrible idea — so the tile_urls field is gone entirely. tile_url now accepts either one URL string or a list of URL strings, normalized internally into a List:

# single source (unchanged, backward compatible)
tile_url: https://example.com/{z}/{y}/{x}.png

# multiple sources
tile_url:
  - https://2024.example.com/{z}/{y}/{x}.png
  - https://2023.example.com/{z}/{y}/{x}.png

Existing configs keep working as-is, and serialization always writes back the single tile_url key (string for one source, array for multiple).

All commits are signed.

g.drawImage(img, 0, 0, null);
}
} catch (Exception e) {
// Ignore

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blindly ignoring the exception without any explanation is not so nice

en_us: ["",{"text":"© ","color":"white"},{"text":"National Land Surveying and Mapping Center, Ministry of the Interior, ROC","underlined":true,"color":"aqua","clickEvent":{"action":"open_url","value":"https://maps.nlsc.gov.tw/"}}]
zh_tw: ["",{"text":"內政部國土測繪中心","underlined":true,"color":"aqua","clickEvent":{"action":"open_url","value":"https://maps.nlsc.gov.tw/"}},{"text":"版權所有 ©Copyright","color":"white"}]
tile_url:
- https://wmts.nlsc.gov.tw/wmts/LiDAR2024/default/GoogleMapsCompatible/{z}/{y}/{x}.png

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to not work at all.

Show log
[15:59:47] [Render thread/INFO]: [System] [CHAT] T+- » Teleported to 25.014052, 121.463778, 11.
[15:59:49] [Render thread/INFO]: [FANCYMENU] ScreenCustomizationLayer registered: pause_screen
[15:59:49] [Render thread/INFO]: Resized a dynamic immediate buffer to 160!
[15:59:49] [Render thread/INFO]: Resized a dynamic immediate buffer to 320!
[15:59:49] [Render thread/INFO]: Resized a dynamic immediate buffer to 640!
[15:59:49] [Render thread/INFO]: Resized a dynamic immediate buffer to 1280!
[15:59:50] [Render thread/INFO]: [FANCYMENU] ScreenCustomizationLayer registered: com.mndk.bteterrarenderer.mcconnector.client.gui.screen.AbstractGuiScreenImpl
[15:59:50] [terra++ disk I/O thread/INFO]: [STDOUT]: [2026/08/09 15:59:50:260] INFO [terra++ bootstrap] Cache miss: https://www.historygis.udd.gov.taipei/urban/assets/images/logo.svg
[15:59:53] [terra++ disk I/O thread/INFO]: [STDOUT]: [2026/08/09 15:59:53:507] INFO [terra++ bootstrap] Cache miss: https://maps.nlsc.gov.tw/images/entrance.gif
[15:59:54] [terra++ HTTP network thread/INFO]: [STDOUT]: [2026/08/09 15:59:54:808] INFO [terra++ bootstrap] Request succeeded: https://maps.nlsc.gov.tw/images/entrance.gif
[16:00:00] [terra++ HTTP network thread/INFO]: [STDOUT]: [2026/08/09 16:00:00:653] INFO [terra++ bootstrap] Request succeeded: https://www.historygis.udd.gov.taipei/urban/assets/images/logo.svg
[16:00:00] [ForkJoinPool.commonPool-worker-1/ERROR]: Error processing cache value
java.util.concurrent.CompletionException: java.lang.RuntimeException: com.mndk.bteterrarenderer.dep.batik.transcoder.TranscoderException: null
Enclosed Exception:
null:0
The URI "data:image/png;base64,
<printed data of the file>
on element <image> can't be opened because:
URL data in unsupported format or corrupt
	at knot//com.mndk.bteterrarenderer.dep.batik.bridge.UserAgentAdapter.getBrokenLinkDocument(UserAgentAdapter.java:448)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing for me.

Show log

Can not write a field name, expecting a value
com.fasterxml.jackson.core.JsonGenerationException: Can not write a field name, expecting a value
	at com.fasterxml.jackson.core.JsonGenerator._reportError(JsonGenerator.java:2733)
	at com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.writeFieldName(WriterBasedJsonGenerator.java:153)
	at com.fasterxml.jackson.core.JsonGenerator.writeObjectField(JsonGenerator.java:2407)
	at com.mndk.bteterrarenderer.core.tile.TileMapServiceCommonProperties.write(TileMapServiceCommonProperties.java:102)
	at com.mndk.bteterrarenderer.core.tile.TileMapServiceCommonPropertiesTest.writeJson(TileMapServiceCommonPropertiesTest.java:72)
	at com.mndk.bteterrarenderer.core.tile.TileMapServiceCommonPropertiesTest.givenMultipleTileUrls_whenWriteCalled_thenWrittenAsArray(TileMapServiceCommonPropertiesTest.java:64)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants