Unfortunately SourceForge dropps the E-Mail support for all project websites on June 26, 2017 (which includes this forum).

E-Mail is required for registration, password-reset and notifications - therefore after this date the creation of new accounts will no longer be possible.

Use mod_tile to render required tiles

For discussions, questions and problems using MOBAC
remco_schoen
Posts: 4
Joined: 15 Jan 2012, 11:19

Use mod_tile to render required tiles

Postby remco_schoen » 15 Jan 2012, 11:43

Hello,

Let's start with a big thanks for creating this program!!! I use it in combination with Galileo Offline Maps for my iPhone, so that I now have detailed maps of everywhere I go.

I created my own tile server for not asking too much resources from the OSM-project servers. Before I let MOBAC create an atlas, I pre-render all the necessary tiles on the server. Currently I determine by hand, which tiles should be rendered. My guess is, that I can also do this from the profile-xml file as well. But I'm currently trying to understand the format, because it doesn't directly translate to the tiles on the server.

This line in the XML:

Code: Select all

<Map name="Layer name_0 00" zoom="0" mapSource="Mapnik" minTileCoordinate="0/0" maxTileCoordinate="255/255"/>


Needs to be translated to:

Code: Select all

./render_list -m default -a -z 0 -Z 0 -x 0 -X 0 -y 0 -Y 0


The render_list command will give an error if I enter tiles, that are not available. My guess is, that when MOBAC starts to retrieve the tiles from the server, there is some translation made.

Could you tell me, how I can translate this to the tiles needed to be rendered? I understand Java, so you can point me to the code as well.

Thanks in advance and with kind regards,

Remco Schoen

remco_schoen
Posts: 4
Joined: 15 Jan 2012, 11:19

Re: Use mod_tile to rended required tiles

Postby remco_schoen » 15 Jan 2012, 13:21

Maybe this isn't necessary.

Just installed MOBAC on the tile server itself and put it to work there. It downloads the tiles nicely, but sometimes times out, when the rendering of the tiles takes too long. On my not too fast server it can take up to 90 seconds for some zoom levels.

I'm not sure where the time-out occurs, in MOBAC or Apache. Maybe just expanding the time-out could make the pre-rendering redundant.

Greetz,

Remco

r_x
Site Admin
Posts: 670
Joined: 25 Jun 2011, 14:00

Re: Use mod_tile to render required tiles

Postby r_x » 18 Jan 2012, 19:29

Hi Remco,

understanding the profile XML format is not very complicated. I assume that the only problematic part are the minTileCoordinate and the maxTileCoordinate.

Both specify the x/y coordinate of the selected rectangle. The coordinate itself is denoted in pixels regarding the selected zoom level.
Therefore for the common case that each tile has the size 256x256 pixels you get the x/y tile numbers as it is used by OSM/Google servers this way (also called slippy map tilenames).

Therefore you can simply divide the numbers by 256 (and ignore the remainder) for getting the slippy map tile number. For converting a slippy map number to lat/lon and vice versa please the the OSM wiki: Slippy map tilenames.


Regarding your timeout problem you may want to take a look into the settings.xml file where MOBAC saves the settings. Some values in this file are not visible in the settings dialog and can therefore only be changed by editing the settings.xml file (while MOBAC is not running).

The interesting entries are <httpConnectionTimeout> and <httpReadTimeout> which specify two timeout values in seconds. Increasing them may help you with complex tiles that require a lot rendering time.
Please read the MOBAC FAQ and MOBAC README before posting.

remco_schoen
Posts: 4
Joined: 15 Jan 2012, 11:19

Re: Use mod_tile to render required tiles

Postby remco_schoen » 18 Jan 2012, 21:52

Yup, I had problems with the coordinates. Now you have explained it, it starts to dawn at me. I knew how the tiles worked, but didn't think how the slippy maps translated mouse clicks to tiles, but I get that part now as well :)

Furthermore I changed the timeouts and MOBAC now nicely waits, until the tiles are rendered.

Thanks for the answers!

Greetz,

Remco
Soon off to the Harz region in Germany with a map with zoom level 17 in the pocket!

aleksk
Posts: 2
Joined: 01 Nov 2016, 11:52

Re: Use mod_tile to render required tiles

Postby aleksk » 01 Nov 2016, 12:06

Sorry to bump a dead thread, but I am lost when it comes to trying understand maybe not so much mintilecoordinate/maxtilecoordinate but the points still. I am looking for a way to bulk-convert GPX tracks to mobac-profiles using a script (i have over 400 gpx tracks i don't want to do them one by one using Mobac, though i know it supports GPX directly).

So i wanted to write a conversion script to do this with Python. I'm not new to Python and i found some example mobac profiles but i am baffled why the min and max x/y coordinates don't match up with some of the examples i'm analysing.. The ones i'm looking at are from https://github.com/peterburk/mobacProfiles and here's an excerp from one of the smaller ones:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<atlas outputFormat="AFTrack" name="Vatican 18" version="1">
    <Layer name="Vatican 18">
        <PolygonMap name="Vatican 18 00" zoom="0" mapSource="MapQuest" minTileCoordinate="0/0" maxTileCoordinate="255/255">
            <polygon>
                <point>136/95</point>
                <point>136/95</point>
                <point>136/95</point>
                <point>136/95</point>
                <point>136/95</point>
                <point>136/95</point>
            </polygon>
        </PolygonMap>
        <PolygonMap name="Vatican 18 01" zoom="1" mapSource="MapQuest" minTileCoordinate="256/0" maxTileCoordinate="511/255">
            <polygon>
                <point>273/190</point>
                <point>273/190</point>
                <point>273/190</point>
                <point>273/190</point>
                <point>273/190</point>
                <point>273/190</point>
            </polygon>
        </PolygonMap>
        <PolygonMap name="Vatican 18 02" zoom="2" mapSource="MapQuest" minTileCoordinate="512/256" maxTileCoordinate="767/511">
            <polygon>
                <point>547/380</point>
                <point>547/380</point>
                <point>547/380</point>
                <point>547/380</point>
                <point>547/380</point>
                <point>547/380</point>
            </polygon>
        </PolygonMap>
[..snip..]
        <PolygonMap name="Vatican 18 17" zoom="17" mapSource="MapQuest" minTileCoordinate="17935616/12467200" maxTileCoordinate="17936895/12468735">
            <polygon>
                <point>17936708/12468509</point>
                <point>17935775/12468509</point>
                <point>17935775/12468509</point>
                <point>17935775/12467256</point>
                <point>17936708/12467256</point>
                <point>17936708/12468509</point>
            </polygon>
        </PolygonMap>
        <PolygonMap name="Vatican 18 18" zoom="18" mapSource="MapQuest" minTileCoordinate="35871488/24934400" maxTileCoordinate="35873535/24937215">
            <polygon>
                <point>35873416/24937018</point>
                <point>35871551/24937018</point>
                <point>35871551/24937018</point>
                <point>35871551/24934513</point>
                <point>35873416/24934513</point>
                <point>35873416/24937018</point>
            </polygon>
        </PolygonMap>
    </Layer>
</atlas>


If i look at the point values, and then look at the min/max tile coordinates.. it seems

a.) at lower zoom levels, like 0 or 1, you'll see the points' min & max of x/y both be 136/95 , but minMaxTileCoordinate lists 0/0 and 255/255..
b.) at zoom level 18 you'll see minTileCoordinates be 35871488/24934400, and maxTileCoordinates be 35873535/24937215.. but if you manuallay take the min() of all points listed, you'll see them as 35871551/24934513 for x and the manually-calculated max() be 35873416/24937018.. why the discrepency?

This leads me to believe that the x/y for minMax deals in terms of tile numbers, where as the x/y in the points deals with pixels within those tiles ?? Is that correct? and if so, i know how one calculates lat/lon to tile # but how does one calculate lat/lon to the pixel???

aleksk
Posts: 2
Joined: 01 Nov 2016, 11:52

Re: Use mod_tile to render required tiles

Postby aleksk » 02 Nov 2016, 01:42

nevermind, figured out that the calculations for tile x/y's are usually made 'ints' times the tileSize, but if you don't cut off the floating point part before multiplying by tileSize, you can use that to get your pixel coordinates where inside that tile..


Return to “Mobile Atlas Creator (English)”



Who is online

Users browsing this forum: No registered users and 1 guest