SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Guru CompiledMonkey's Avatar
    Join Date
    Sep 2002
    Location
    Richmond, VA
    Posts
    975
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Anyone doing any serious JavaScript?

    Like these sites:

    http://map.search.ch/
    http://maps.google.com/

    If I could figure out the JavaScript behind such mapping projects, I'd be one happy guy.

  2. #2
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The JS behind Google Maps shouldn't be too difficult. I haven't actually looked, but the functionality seems pretty easy to reproduce. Basically you just keep track fo what the very center point of the page is. When you first load the page, you know where that is (across the entire map). Then, when the most moves, you move the center dot the same distance as the mouse moves, and then you fill in the missing image sectors based on the center dot. Likewise, when you double click an area, all it does is set the center to that dot and reload the missing images.

    To zoom in and out, all you have to do is keep track of the zoom factor and have request the images at the right zoom level.

  3. #3
    SitePoint Guru CompiledMonkey's Avatar
    Join Date
    Sep 2002
    Location
    Richmond, VA
    Posts
    975
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm actually doing more complex things in my mapping application than Google Maps, but the continuous movement of the imagery looks difficult to me.

    I'd love to know how that first site does the real zoom in/out. That looks awesome.

  4. #4
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The first one looks like it could be done using CSS. Stretch the image to be huge, cut off the sides, and then once it's done the fancy effect, it loads the real images. That's probably why it goes so blurry before it can load the real thing.

  5. #5
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. I made an alert() display "hello" and "world" on separate lines. The implications for world peace are staggering. I also heard about some guy who compiled a monkey.

  6. #6
    SitePoint Zealot codescribbler's Avatar
    Join Date
    Nov 2004
    Location
    New York, NY
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This was blogged about quite a bit when first released. The continuous movement comes from chopping the entire world map into small pieces, a set for each zoom level. A couple degrees of movement in each direction are loaded based on the current coordinates, but clipped out of the visible map area, and simply repositioned when the user moves in one direction or the other. When this happens, I believe they use XMLHTTP to load up the images to be ready for the next degrees of movement.

    I bet you can find coverage on the technique if you Google it.

  7. #7
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,499
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •