Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-14-2009, 01:27 PM   #1
Registered: Sep 2005
Posts: 183

Rep: Reputation: 30
Google Maps - how it works?


I'm wondering how Google Maps work. I'd like to do similar thing in
Lazarus (Delphi in Linux). In Google Maps map of whole world is
divided to squares. I'd like to create matrix of images 3 rows, 3 columns and be able to zoom in and out, pan and have uniform
pixel numbers through this matrix. With what algorithm can I achieve it?.


Last edited by mac1234mac; 08-14-2009 at 04:03 PM.
Old 08-15-2009, 11:10 PM   #2
Senior Member
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
If you restrict the zoom (as Google does) to certain factors (eg following the sequence 1,2,5,10,20,50,100,200,500, etc or just 1,2,4,8,16,32 etc), you make the job simpler.

This means that the zoom and pan is always aligned to the pixels (though you have to skip pixels as you zoom out).

Google also have more than one level of imaging; if you zoom through the levels, you will notice changes from one set to another at some of the levels.

Give that the most storage is used by the deepest zoom level, it doesn't actually cost much more to generate/store the map at every zoom level (rather than have a single data structure). For an extra 30% storage, you can store all the zoom levels. Though this assumes that the map is not dynamically changing.

So I'd suggest for a start that you just have a simple pixel map at the deepest zoom level, with an x and y offset and zoom level. As you zoom out, the zoom level will increase (1,2,5,10,20,50, etc). The pan rate is directly proportional to this zoom level. And when you are generating the zoomed out content, the zoom level also is the step size for selecting pixels (or groups of pixels).

If you need something more sophisticated (arbitrary zoom/angles, 3D imaging), then it is worth reading an introductory book on 3D graphics, covering topics such as mipmaps.

Last edited by neonsignal; 08-15-2009 at 11:12 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
regd GTK widgets to access google maps thilaga Linux - Newbie 0 04-22-2009 05:36 AM
LXer: Google Maps and Google Earth KML overlays LXer Syndicated Linux News 0 10-29-2008 05:30 AM
Force Squid to Cache esaym Linux - Networking 1 01-11-2007 05:59 PM
Showstopper bug in google maps... bulliver General 7 09-29-2006 10:38 AM
Google Maps not working in Firefox? clausawits Fedora 2 02-09-2005 07:11 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:34 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration