Recent

Author Topic: Any Lazarus-compatible map library for using maps from Google/Bing/any other?  (Read 6304 times)

blankname

  • New Member
  • *
  • Posts: 35
Hi,
I've been searching for a library for using maps rendered from google/bing or any other provider. I've found LazMapViewer, but I'm not sure if there is no other better solution.

The base problem is that I'm not familiar with lazarus package managers - in PHP I have composer, so I can quickly download dependencies without commiting them to git - is there something like that in Lazarus? If so, is there any good and valuable map component, that I could use in commercial applications without publishing the source code?

Soner

  • Sr. Member
  • ****
  • Posts: 305
Search in lazarus->menu>package>Online Package Manager for LazMapViewer or here on this website click on Packages(OPM) and search on the new page for  LazMapViewer.

Online Package Manager installs it automatically.

blankname

  • New Member
  • *
  • Posts: 35
I've checked LazMapViewer a while ago, and it's bugged as hell.
Is there any other package/library to display map with optional points pinned on it?

paweld

  • Hero Member
  • *****
  • Posts: 1003
Best regards / Pozdrawiam
paweld

blankname

  • New Member
  • *
  • Posts: 35
https://www.tmssoftware.com/site/tmsfncmaps.asp
I won't be paying that much for a thing I cant try out.
Probably will stick to the LazMapViewer... But I have a problem with changing to Google Maps engine or any other. When I try to change MapProvider property to any of the listed in Wiki, I get error 'Unknown provider [...]'. Any ideas how to bypass this?

blankname

  • New Member
  • *
  • Posts: 35
Oh, found a solution: GetMapProviders.

Another thing: is there a possibility of drawing the map recursively when it's not zoomed? For now, when zoom is on the lowest level, I get full map of the World with white borders.

loaded

  • Hero Member
  • *****
  • Posts: 825
It's an idea, not a solution;
It's been a long time since I used LazMapViewer.
But as far as I remember, you can review the source code for your problem and make your own solution or if you have time LazMapViewer is a great tutorial, it helps you understand the logic.
Then you can even write your own map view engine.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

wp

  • Hero Member
  • *****
  • Posts: 11916
I've checked LazMapViewer a while ago, and it's bugged as hell.
The original authors have left, and you can be lucky that someone (myself) at least takes care of the basic maintainance of the package... I know of a variety of bugs, but since the component heavily depends on threads it is quite difficult to debug (for someone who did not write this stuff). When you find a specific bug please report it. A statement like "bugged as hell" will be ignored, sorry.

is there a possibility of drawing the map recursively when it's not zoomed? For now, when zoom is on the lowest level, I get full map of the World with white borders.
The mapviewer loads predefined png images of - I think - 512x256 pixels from the servers specified. At the lowest zoom level, the png image covers the entire world, and the display consists of one single bitmap. So, when your window is larger than 512x256 the map will be surrounded by a white border in this case.

blankname

  • New Member
  • *
  • Posts: 35
The mapviewer loads predefined png images of - I think - 512x256 pixels from the servers specified. At the lowest zoom level, the png image covers the entire world, and the display consists of one single bitmap. So, when your window is larger than 512x256 the map will be surrounded by a white border in this case.
The problem is that the white border is not a normal background. When I move the map, the closest-to-the-border pixels of it are drawn on the background, so it looks like drawing with a brush. :(

wp

  • Hero Member
  • *****
  • Posts: 11916
This is because the background bitmap is not erased for better speed performance. Normally zoom levels are quite large so that the "edges of the world" almost never make it into the drawing area and the issue is not observed.

I tried to call a window erasing procedure in such cases, but this makes the reaction of the component rather sluggish. Seeking for a better solution...

blankname

  • New Member
  • *
  • Posts: 35
Shouldn't it be like looping to the opposite edge of the map, or something like this? Or maybe it's not cost-effective?

wp

  • Hero Member
  • *****
  • Posts: 11916
There are several possibilities:
/1/ Repaint the background when the outer-most edges come into view.
/2/ Continue with the first horizontal tile when the right edge of the right-most tile comes into view, and vice versa. But what with vertical panning? It feels strange to me as a non-geographer that panning below the south pole jumps to the north pole...
/3/ Prohibit panning beyond the outer-most edges.

The best solution probably is a combination of /3/ and /4/: Periodic panning in horizontal direction and restricted panning in vertical direction. In case of very low magnification when the map window is larger than the entire map probably /1/ will have to be used.

Patches are welcome.

loaded

  • Hero Member
  • *****
  • Posts: 825
Dear wp master,
The mapviewer loads predefined png images of - I think - 512x256 pixels from the servers specified. At the lowest zoom level, the png image covers the entire world, and the display consists of one single bitmap. So, when your window is larger than 512x256 the map will be surrounded by a white border in this case.

All views on tile type maps are 256x256.
There is never a single image. Actually, the Zoom ratio is the number of tiles. So if the zoom value is Z=1, then 2^(Z*2) ->2 Horizontal x 2 Vertical is made up of 4 tiles.

The biggest problem in LazMapViewer is the speed problem. ;
On a 1920x1080 resolution screen, there will be approximately 45~55 tiles. This problem manifests itself clearly when downloading them.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

wp

  • Hero Member
  • *****
  • Posts: 11916
All views on tile type maps are 256x256.
There is never a single image. Actually, the Zoom ratio is the number of tiles. So if the zoom value is Z=1, then 2^(Z*2) ->2 Horizontal x 2 Vertical is made up of 4 tiles.
Thanks for correcting me. I noticed that after posting when I looked at the mapviewer demo again.

The biggest problem in LazMapViewer is the speed problem. ;
On a 1920x1080 resolution screen, there will be approximately 45~55 tiles. This problem manifests itself clearly when downloading them.
I do know... It gets a bit faster, though once the required tiles already have been loaded into the image cache. And I try to avoid full-screen maps.

loaded

  • Hero Member
  • *****
  • Posts: 825
Thanks for correcting me. I noticed that after posting when I looked at the mapviewer demo again.

Actually, I should thank you, Grand Master.
Everything I know about it, I learned from what you wrote.
Check out  loaded on Strava
https://www.strava.com/athletes/109391137

 

TinyPortal © 2005-2018