I'm using the PBMap regularly too (in my internal GeoWorldEditor, showed before), so thanks again to djes and team!
I know the crashes too. They happen from time to time, even if I regularly clear the cache (by standard at program end).
But I can't find any specific reason or a way to reproduce.... probably it has something to do with high traffic on the OSM servers (it's only a thought, because the crash happens during day/evening but not later in the night).
PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Thank you Andre. It shouldn't crash anyway. I'll take a look.
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
I've corrected some parts of the code there in the 'djes' branch : https://github.com/djes/PBMap/blob/djes/PBMap.pb
Sadly, I think there's a PB bug in the PB's internal PNG image library, leading to a crash when a malformed PNG file is loaded. I've already had something similar in the past. I've sent a bug report, I'm waiting for a fix. It should be possible to use another image library, but I think it easier to wait.
By now, could you test the updated code ? Thank you !
Sadly, I think there's a PB bug in the PB's internal PNG image library, leading to a crash when a malformed PNG file is loaded. I've already had something similar in the past. I've sent a bug report, I'm waiting for a fix. It should be possible to use another image library, but I think it easier to wait.
By now, could you test the updated code ? Thank you !
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
haven't tested it on a range of pngs but workaround for now, check to see if IEND tag is set in the image
Code: Select all
Procedure _LoadImage(ImageNumber,File.s)
Protected fn,pat,pos
pat = $444E4549
fn= ReadFile(#PB_Any,file)
If fn
pos = Lof(fn)
FileSeek(fn,pos-8)
res = ReadLong(fn)
CloseFile(fn)
If res = pat
ProcedureReturn LoadImage(ImageNumber,file)
EndIf
EndIf
EndProcedure
Windows 11, Manjaro, Raspberry Pi OS
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Thank you Idle ! It could do the trick and be faster than pngcheck. I'll test today. I've also added a function to delete incomplete file, even if we don't have by now the possibility without another request to know size of downloaded file.
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Code updated with idle's trick. Merged into master.
- Andre
- PureBasic Team
- Posts: 2056
- Joined: Fri Apr 25, 2003 6:14 pm
- Location: Germany (Saxony, Deutscheinsiedel)
- Contact:
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Thank you very much idle and djes! (and thanks too for the credits in your Readme - you're the ones, who deserve them - later in my project )
I've included the updated PBMap.pb code into my GeoWorldEditor.
It runs fine.... if it helps in the long term to avoid the randomly crashes we will see... but your approach to make tests for valid map tiles before loading them as image sounds like a good idea
I've included the updated PBMap.pb code into my GeoWorldEditor.
It runs fine.... if it helps in the long term to avoid the randomly crashes we will see... but your approach to make tests for valid map tiles before loading them as image sounds like a good idea
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Has somebody implemented OpenWeather(or any other) precipitation map layers in PBMap?
Lukas
Lukas
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Did you try to change the demo application ?
Edit : BTW, I just found that including the demo in the module can be difficult to understand. And the demo code is maybe a bit confusing with too many options... I just separated the basic demo, and if I have time I'll do a very basic demo.
Could you test by altering the demo.pb code at the line 300 :Change the URL as explained in https://openweathermap.org/current
The code is there : https://github.com/djes/PBMap
Edit : BTW, I just found that including the demo in the module can be difficult to understand. And the demo code is maybe a bit confusing with too many options... I just separated the basic demo, and if I have time I'll do a very basic demo.
Could you test by altering the demo.pb code at the line 300 :
Code: Select all
PBMap::AddOSMServerLayer(#Map, "OpenSeaMap", 3, "http://t1.openseamap.org/seamark/") ; Add a special osm overlay map on layer nb 3
Don't include lat and long as it's PBMap's job. So you should haveapi.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key}
Code: Select all
PBMap::AddOSMServerLayer(#Map, "OpenWeatherMap", 3, "http://api.openweathermap.org/data/2.5/weather?appid=your_key") ; Add a special openweathermap overlay map on layer nb 3