Page 10 of 10
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sat Jul 13, 2019 1:58 pm
by Andre
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).
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Mon Jul 15, 2019 10:17 pm
by djes
Thank you Andre. It shouldn't crash anyway. I'll take a look.
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Thu Jul 18, 2019 3:30 pm
by djes
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 !
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Thu Jul 18, 2019 11:06 pm
by idle
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
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Fri Jul 19, 2019 9:01 am
by djes
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
Posted: Fri Jul 19, 2019 10:16 am
by djes
Code updated with idle's trick. Merged into master.
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Fri Jul 19, 2019 9:18 pm
by Andre
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

Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Thu Jan 14, 2021 10:31 am
by l1marik
Has somebody implemented OpenWeather(or any other) precipitation map layers in PBMap?
Lukas
Re: PBMap - OSM, Here, Geoserver maps in a Canvas gadget
Posted: Sun Jan 17, 2021 11:42 am
by djes
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 :
Code: Select all
PBMap::AddOSMServerLayer(#Map, "OpenSeaMap", 3, "http://t1.openseamap.org/seamark/") ; Add a special osm overlay map on layer nb 3
Change the URL as explained in
https://openweathermap.org/current api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key}
Don't include lat and long as it's PBMap's job. So you should have
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
The code is there :
https://github.com/djes/PBMap