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
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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...
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
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
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
serverpartvariable.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
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>
Have you tested it?
I wonder if it is not a blocking of OpenStreetMap of the provider (error 403).
I'm at Free... and it doesn't work !
Do you remember these
https://sourceforge.net/p/mobac/forum/general/thread/143847e15e/?limit=25#2e2f
https://sourceforge.net/p/mobac/forum/general/thread/cd4b41326c/?limit=25#57f2
I cannot understand why, but my post changed uppercase/lowercase vs my entry.
The same as "code" :
thnx but not work and error ,
this is file i'm tested , and get error
I can't understand. I downloaded YOUR file, and it works.
The only explanations I could imagine :
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
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...
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
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
I would like to understand too.
obviously, in BSH (Laurent's BSH) it works
Last edit: Nicolas PAOUR 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 ?
Thanks to all
The problem was solved by changing the userAgent.
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 ?
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
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.
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.