Well, the creator of this topic didn't write anything ;-)
But I want to use it for a question regarding mapsources consisting of 512x512 px tiles:
Is there a tag for custom map's XML-files to define that map files are 512x512 Pixel instead of 256x256 ?
Like the parameter "tileSize = 512" for .BSH-files
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The tilesize parameter in .bsh files do not change (in itself...) the size of downloaded tiles !
What is important is the fact tat the server is able (or not) to provide 512x512 tiles vs. 256x256
And if the server is able to provide both (that is sometimes the case, but very rarely for WMTS servers), it is in the URL itself (with one of its parameters) that the choice is done.
Most of the times, when a tileSize parameter is present in .bsh, it is used in the calculation of "bounding box" (for WMS servers), or its value is added somewhere in the URL. Or (in most of the cases !) purely "informative" and is not used at all !
Adding such a parameter in a BSH for a server that do not provide both options won't change anything.
And if the server delivers only 512x512 tiles, no need to specify any "tile size", neither in a .bsh, nor in a .xml
The only case I know of server delivering both formats is Strava Heatmaps server, and for these servers, a parameter in the URL "?px=256" or "?px=512" is there to make the choice.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You have to specify the tileSize because MOBAC needs it for the calculation tile image x/y/z to lat/lon. If MOBAC uses the tile size of 256 x 256 for a server that uses 512 x512 tiles then the lat/lon position will be totally wrong.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But I don't understand why ? AFAIK, this calculation should take place ONLY for servers that serve in lat/lon, ie. WMS servers.
While WMTS servers serve directly pre-calculated (and pre-stored) tiles, only based on x/y/z, as provided in the URL. For all these servers, tile size should be useless, since there is no need to convert Lat/Lon in x/y ?
Or maybe, would it be because area selection (in Mobac) is not done in x/y but in lat/lon ?
Thank you for explanation !
And what about the initial question of @wernerschka : how to do with xml source files when tile size is not 256x256 ? (knowing that it is always possible to replace a xml source file by its equivalent in .bsh)
PS : It seems that when not specified in the .bsh, the default value for tileSize is 256. Exact ?
Last edit: Laurent Grenet 2025-03-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The preview map and the atlas profiles where you define the regions to be downloaded don't work internally with lat/lon but they work with a "tile coordinate" which is effectively the tile number * tile-size on a certain zoom level.
That allows you to select regions that don't match the tile grid. For download the map tiles and the atlas creation (if the atlas format only supports full map tiles) the region is then converted back to tile numbers.
So without the knowledge that tile size is 512 x 512 MOBAC would calculate the coordinate for the wrong zoom level and download a totally wrong set of tiles.
Also keep in mind that some atlas formats use lat/lon coordinates as calibration points.
In BSH if not set the default tile size of 256x256 pixel is assumed as this is the correct value for 99.9% of all maps:
Yes I'm talking about TMS-server tiles. More and more servers today are providing their tiles either by default or even exclusive as 512x512 tiles. 256x256 ist still mostly used, but with the intention to don't brake legacy apps (yet):
Good support of 512px-server tiles within .BSH as well as within .XML custom map definitionfiles is important. "tileSize = 512" is essential if used on 512px-Servers. If not, the resulting MOBAC-Atlas consists of completly scrambled tiles. Not to speak from wrong worldfiles e.g. in the Atlas-format "PNG+worldfile". An example Map with 512px-tiles to test with is:
Hi @wernerschka,
the example you provide (tracestrack.com) do NOT provide 512px tiles in the first meaning of what is described in your Maptiler topic, ie. extended area, but in the second meaning, ie. twice resolution for the same area.
As a result, no need to add any tileSize (the tileSize of this source from Mobac standpoint remains 256x256, and NOT 512), as you can see with the attached source file.
On the other hand, I'm not able to provide you the equivalent in XML format, because this source requires to specify the "referer" (otherwise, the http request is rejected with a 403 (forbidden) error), and I do not remember how to add such a referer in an XML source. I'm quite sure it's feasible, but I do not remember how to, since I personnally always priviledge bsh format, that is more "flexible" than xml for map sources.
Well, the creator of this topic didn't write anything ;-)
But I want to use it for a question regarding mapsources consisting of 512x512 px tiles:
Is there a tag for custom map's XML-files to define that map files are 512x512 Pixel instead of 256x256 ?
Like the parameter "tileSize = 512" for .BSH-files
The tilesize parameter in .bsh files do not change (in itself...) the size of downloaded tiles !
What is important is the fact tat the server is able (or not) to provide 512x512 tiles vs. 256x256
And if the server is able to provide both (that is sometimes the case, but very rarely for WMTS servers), it is in the URL itself (with one of its parameters) that the choice is done.
Most of the times, when a tileSize parameter is present in .bsh, it is used in the calculation of "bounding box" (for WMS servers), or its value is added somewhere in the URL. Or (in most of the cases !) purely "informative" and is not used at all !
Adding such a parameter in a BSH for a server that do not provide both options won't change anything.
And if the server delivers only 512x512 tiles, no need to specify any "tile size", neither in a .bsh, nor in a .xml
The only case I know of server delivering both formats is Strava Heatmaps server, and for these servers, a parameter in the URL "?px=256" or "?px=512" is there to make the choice.
You have to specify the tileSize because MOBAC needs it for the calculation tile image x/y/z to lat/lon. If MOBAC uses the tile size of 256 x 256 for a server that uses 512 x512 tiles then the lat/lon position will be totally wrong.
Oooops, it seems you are right (as usual....!)
But I don't understand why ? AFAIK, this calculation should take place ONLY for servers that serve in lat/lon, ie. WMS servers.
While WMTS servers serve directly pre-calculated (and pre-stored) tiles, only based on x/y/z, as provided in the URL. For all these servers, tile size should be useless, since there is no need to convert Lat/Lon in x/y ?
Or maybe, would it be because area selection (in Mobac) is not done in x/y but in lat/lon ?
Thank you for explanation !
And what about the initial question of @wernerschka : how to do with xml source files when tile size is not 256x256 ? (knowing that it is always possible to replace a xml source file by its equivalent in .bsh)
PS : It seems that when not specified in the .bsh, the default value for tileSize is 256. Exact ?
Last edit: Laurent Grenet 2025-03-28
The preview map and the atlas profiles where you define the regions to be downloaded don't work internally with lat/lon but they work with a "tile coordinate" which is effectively the tile number * tile-size on a certain zoom level.
That allows you to select regions that don't match the tile grid. For download the map tiles and the atlas creation (if the atlas format only supports full map tiles) the region is then converted back to tile numbers.
So without the knowledge that tile size is 512 x 512 MOBAC would calculate the coordinate for the wrong zoom level and download a totally wrong set of tiles.
Also keep in mind that some atlas formats use lat/lon coordinates as calibration points.
In BSH if not set the default tile size of 256x256 pixel is assumed as this is the correct value for 99.9% of all maps:
https://sourceforge.net/p/mobac/code/HEAD/tree/trunk/MOBAC/mobac/src/main/java/mobac/mapsources/custom/BeanShellHttpMapSource.java#l105
Last edit: r_x 2025-03-28
Yes I'm talking about TMS-server tiles. More and more servers today are providing their tiles either by default or even exclusive as 512x512 tiles. 256x256 ist still mostly used, but with the intention to don't brake legacy apps (yet):
https://docs.maptiler.com/guides/maps-apis/maps-platform/difference-between-256x256-512x512-and-hidpiretina-rasterized-tiles/
Good support of 512px-server tiles within .BSH as well as within .XML custom map definitionfiles is important.
"tileSize = 512" is essential if used on 512px-Servers. If not, the resulting MOBAC-Atlas consists of completly scrambled tiles. Not to speak from wrong worldfiles e.g. in the Atlas-format "PNG+worldfile". An example Map with 512px-tiles to test with is:
https://console.tracestrack.com/explorer
Hi @wernerschka,
the example you provide (tracestrack.com) do NOT provide 512px tiles in the first meaning of what is described in your Maptiler topic, ie. extended area, but in the second meaning, ie. twice resolution for the same area.
As a result, no need to add any tileSize (the tileSize of this source from Mobac standpoint remains 256x256, and NOT 512), as you can see with the attached source file.
On the other hand, I'm not able to provide you the equivalent in XML format, because this source requires to specify the "referer" (otherwise, the http request is rejected with a 403 (forbidden) error), and I do not remember how to add such a referer in an XML source. I'm quite sure it's feasible, but I do not remember how to, since I personnally always priviledge bsh format, that is more "flexible" than xml for map sources.