Geeks With Blogs


Add to Google

Tim Hibbard CEO for EnGraph software

In the session the other night, I told Jeff and John that I have never had problems with Google Maps, or any Google API. Well, I think I might have found something.

I was redesigning the layout for Where's Tim, because, well, I'm an awful UI designer. And I was putting everything into a 2x4 table and I set the left column width at 25% and the right column width at 74%. The upper right hand cell contains the div tag that eventually becomes the Google Map and I set the width of that div tag at 100% so the map would increase with the size of the window (like real web developers do).

That all worked, but when I would increase the size of the window, the right tiles on the Google Map would not always display, sometimes they would though...very inconsistent, but it was tied to increasing the width of the window.
The second thing that went wrong is that the map thought that it's center point and the x/y bounds of the map were the same even though the window has maximized and the map had a new dimension. Like for example, when you click "Refresh location with AJAX" on Where's Tim, it will look to see if the new location is inside the bounds of the existing map using the map.getBoundsLatLng(); function...more code on this post. If my new location is outside the bounds that this function returns, then the map will recenter on the new location, if it is within the bounds of the map, it doesn't change anything and the icon just "moves" to the new location. This way the user gets more of a seamless smart client feel. Well, if you start Where's Tim with a normal sized window, and then maximize it. Then move the map so that my location is on the right hand side of the map (but still visible) and click "Refresh Location with AJAX", you will notice that the map recenters because it thinks that the new location is outside the bounds (even though I haven't actually moved and my current position is still visible on the map).

Now, having said all that, it is very possible that I have missed something obvious in the Google API or that I am just a bad web developer and do not know the proper way to accomplish this. I'm sure that many good web developers have created Google mashups with % width div tags in did you guys make it work?

Technorati Tags: Google Maps

Posted on Saturday, December 31, 2005 2:16 PM .NET , Mapping , Where's Tim | Back to top

Comments on this post: *Gasp*...potential problem with Google Maps

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Tim Hibbard | Powered by: