Menu

create mapSource for Mobile Atlas Creator

saman
2022-07-28
2022-08-01
  • saman

    saman - 2022-07-28

    Hello good time

    I wanted to create an open source map for Mobile Atlas Creator software.
    This is how I created the file and copied it to the mapsources folder file OpenStreetMap.xml :

    <custommapsource>
    <name>OpenStreetMap</name>
    <minzoom>0</minzoom>
    <maxzoom>18</maxzoom>
    <url>http://{$serverpart}.tile.openstreetmap.org/{$z}/{$x}/{$y}.png</url>
    <serverparts>a b c</serverparts>
    </custommapsource>

    But it gives this error when running.

    Uknown error NullPointerException
    Cannot invoke "String.startWith(String)" bcause "contentType" is null

    How to solve the problem?

     
  • saman

    saman - 2022-07-28

    thnx but this not work and error !

    <custommapsource>
    <name>OpenStreetMap</name>
    <minzoom>0</minzoom>
    <maxzoom>18</maxzoom>
    <tiletype>png</tiletype>
    <url>http://tile.openstreetmap.org/{$z}/{$x}/{$y}.png</url>
    <tileupdate>None</tileupdate>
    <backgroundcolor>#000000</backgroundcolor>
    <ignoreerrors>false</ignoreerrors>
    <serverparts></serverparts>
    </custommapsource>

     

    Last edit: saman 2022-07-28
    • r_x

      r_x - 2022-07-28

      Because you can not simply remove a variable that had content. Check out the source where you got the URL from what values are used for serverpart variable.

       
  • saman

    saman - 2022-07-28

    this url for openstreetmap work :

    https://a.tile.openstreetmap.org/11/1296/789.png

    but this custommapsource not work and Error : contentType is null !!!!

    <custommapsource>
    <name>OpenStreetMap</name>
    <minzoom>0</minzoom>
    <maxzoom>18</maxzoom>
    <tiletype>png</tiletype>
    <tileupdate>None</tileupdate>
    <url>https://{$serverpart}.tile.openstreetmap.org/{$z}/{$x}/{$y}.png</url>
    <serverparts>a b c</serverparts>
    </custommapsource>

    If possible, please test this. I could not solve the problem

     

    Last edit: saman 2022-07-28
  • Laurent Grenet

    Laurent Grenet - 2022-07-28

    I'm afraid it's only a matter of uppercase / lowercase.

    This one works fine :

    <custommapsource>
    <name>Test for saman</name>
    <minzoom>0</minzoom>
    <maxzoom>18</maxzoom>
    <tiletype>png</tiletype>
    <url>http://{$serverpart}.tile.openstreetmap.org/{$z}/{$x}/{$y}.png</url>
    <serverparts>a b c</serverparts>
    </custommapsource>

     
  • Laurent Grenet

    Laurent Grenet - 2022-07-28

    I cannot understand why, but my post changed uppercase/lowercase vs my entry.
    The same as "code" :

    <customMapSource>
    <name>Test for saman</name>
    <minZoom>0</minZoom>
    <maxZoom>18</maxZoom>
    <tileType>png</tileType>
    <url>http://{$serverpart}.tile.openstreetmap.org/{$z}/{$x}/{$y}.png</url>
    <serverParts>a b c</serverParts>
    </customMapSource>
    
     
    • saman

      saman - 2022-07-28

      thnx but not work and error ,

       
  • saman

    saman - 2022-07-28

    this is file i'm tested , and get error

     
  • Laurent Grenet

    Laurent Grenet - 2022-07-28

    I can't understand. I downloaded YOUR file, and it works.

    The only explanations I could imagine :

    • We do not run the same version of MOBAC : we can give up this one, since, according to your screen copy, we are both running 2.2.3.2 (2678)
    • You are currently focused on a geographical zone in which data provided by the server are corrupted. Please use another mapsource, to verify "where" you are, then switch to this Mapsource. Personally, I tested it mainly in France and Western Europe
    • You have some corrupted tiles in the cache. Delete the cache (supposed to be in TileStore sub directory of Mobac) to force Mobac to download "fresh" tiles
    • We do not run the save Java. Personally, I'm running Azul Zulu JRE 17.28.13 (17), 64-bit
    • We are not in the same environment : Personally, W10 Pro 21H2 64 bits

    I can't imagine anymore it comes from the serverparts parameter. Nevertheless, to completely "close" this hypothesis, create a new Mapsource XML file, in which

    • you remove the line <serverparts>a b c</serverparts>
    • and you replace in URL {$serverpart} by one of the values, eg by "a" (URL becomes then http://a.tile.openstreetmap.org/{$z}/{$x}/{$y}.png

    PS : I attach you the "equivalent" source file, in BSH format.
    Please test it. It should provide exactly the same content. Then, both should be OK, or both should fail...

     
    👍
    1
  • Nicolas PAOUR

    Nicolas PAOUR - 2022-07-28

    It's strange, because I work on a same error today
    (Mobac 2.2.3.2 last version)
    test URL https://b.tile.openstreetmap.org/14/8498/5930.png

    <?xml version="1.0" encoding="UTF-8"?>
    <customMapSource>
    <name>Test for saman</name>
    <minZoom>0</minZoom>
    <maxZoom>18</maxZoom>
    <tileType>png</tileType>
    <url>http://{$serverpart}.tile.openstreetmap.org/{$z}/{$x}/{$y}.png</url>
    <serverParts>a b c</serverParts>
    </customMapSource>
    

    doesn't work, with error: 403
    2022-07-28 21:36:25,575 WARN [Map preview thread 9] mobac.gui.mapview.TileLoader - Downloading of tile 14/8805/5740@Test for saman failed: HTTP error: 403

    but this one works
    test URL https://b.tile-cyclosm.openstreetmap.fr/cyclosm/14/8498/5930.png

    <?xml version="1.0" encoding="UTF-8"?>
    <customMapSource>
    <name>Test Cyclosm for saman</name>
    <minZoom>0</minZoom>
    <maxZoom>18</maxZoom>
    <tileType>png</tileType>
    <url>http://{$serverpart}.tile-cyclosm.openstreetmap.fr/cyclosm/{$z}/{$x}/{$y}.png</url>
    <serverParts>a b c</serverParts>
    </customMapSource>
    

    I would like to understand too.
    obviously, in BSH (Laurent's BSH) it works

     
    👍
    1

    Last edit: Nicolas PAOUR 2022-07-29
  • Laurent Grenet

    Laurent Grenet - 2022-07-29

    Since problem (when there is problem) is a HTTP 403 (ie. "Access not authorized"), different behaviour for Saman, Nicolas or myself can come from different default UserAgent (the one provided if not specified in BSH file, defined in settings.xml)
    In my case, UserAgent is set (by default) to "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"

    Another difference could come from Referer. We can specify a "Referer" in BSH source files, but I don't know which one is provided by Mobac in case nothing is explicitely defined in source file (which is always the case is source file is in XML). I've not found any "default value" in my settings.xml, but maybe you have one in your case when it fails ?

     
    👍
    1
  • saman

    saman - 2022-07-31

    Thanks to all
    The problem was solved by changing the userAgent.

     
  • Laurent Grenet

    Laurent Grenet - 2022-07-31

    Happy to have been able to help, and that it eventually works.

    For my information, could you please tell us what WAS your previous value for UserAgent that prevented download ?

     
    • saman

      saman - 2022-07-31

      Thank you
      The previous value
      userAgent : MOBAC/2.2.3.2
      Was. which I had not changed by default and it worked correctly in many maps such as Google Maps etc. but it had problems only in openstreetmap which was solved by changing it

       
  • Laurent Grenet

    Laurent Grenet - 2022-08-01

    OK, Thanks.
    This is clearly a voluntary action from OSM servers focused AGAINST Mobac.
    I did a test with a completely "abnormal" value (I put my Firstname/Lastname as UserAgent) : No problem.
    Problem is ONLY when UserAgent mentions Mobac.

    => @r_x : Maybe it would be a good idea to change the default value for UserAgent, with a more "neutral" value, not claiming "I am Mobac", to avoid new users (not necessarily "comfortable" with update of this parameter in settings.xml) to have such problems.
    For example, I did also a test with UserAgent="No defined UserAgent"... and it works.

     
    👍
    1
    • r_x

      r_x - 2022-08-01

      I am sorry Laurent, but that the MOBAC's default user agent string is so "verbose" was an intentional decision.

      If an open source project (that has a usage policy that disallows loading map tiles in bulk) then blocks MOBAC is a decision we have to accept. Allowing such blocks was the purpose of the chosen user agent.

       
      👍
      1

Log in to post a comment.

MongoDB Logo MongoDB