What does usability and Google Maps have in common. At least one thing, they are synonyms.
Map is the user interface for any data - any. That is the reason why a search engine company acquired a startup that had the keys for that user interface.
We who write map pages, must keep in mind, that we are using map as the user interface because it is the most intuitive way to present any data. Our client or boss may see map as a decoration on the web page. Try to make them see the difference between a list of addresses or that list presented on a map.
I was very delighted to see that a blog called "In usability we trust" talks a lot about Google Maps. The blog is kept by a Swedish guy called Gabriel Svennerberg. He has written some high quality articles about Google Maps API.
Friday, August 28, 2009
Tuesday, August 11, 2009
Images on v3 map
BoundsBox extension was used for drawing rectangles on map a few posts ago.
The new version of BoundsBox (1.0) has option to insert images inside (visible or invisible) rectangles. The image is attached in a draggable pane of map. So it pans with map. It scales when map is zoomed. It is attached below markers, so it doesn't eat marker clicks. The behavior is equal to GGroundOverlay of v2 api.
A few more options and methods were introduced with the new version. They mainly serve image handling like opacity and z-index. Events 'imageloaded' and 'imageloaderror' are also provided.
See an example with a table of options and methods.
Update v1.1
The most latest version provides also an alternative constructor KmBox(). Instead of LatLngBounds it takes LatLng and kmX, kmY dimensions as its parameters. As a side product we got LatLng.destinationLatLng(bearing, distance) method. That calculates LatLng 'that many kilometers from this LatLng to that compass bearing'.
The new version of BoundsBox (1.0) has option to insert images inside (visible or invisible) rectangles. The image is attached in a draggable pane of map. So it pans with map. It scales when map is zoomed. It is attached below markers, so it doesn't eat marker clicks. The behavior is equal to GGroundOverlay of v2 api.
A few more options and methods were introduced with the new version. They mainly serve image handling like opacity and z-index. Events 'imageloaded' and 'imageloaderror' are also provided.
See an example with a table of options and methods.
Update v1.1
The most latest version provides also an alternative constructor KmBox(). Instead of LatLngBounds it takes LatLng and kmX, kmY dimensions as its parameters. As a side product we got LatLng.destinationLatLng(bearing, distance) method. That calculates LatLng 'that many kilometers from this LatLng to that compass bearing'.
Curing IE8 complications
Many map pages work fine with all the other browsers but not IE8. Clicks seem to take place far away from the point that user actually clicked.
The bug has been archived in IE8 issue list since beta times. The only known workaround is to force IE8 to "IE7 combatibility mode".
Investigating Microsofts own code reveals that even they have not found any other workaround. You can find in the head section of Bing maps:
And in maps.google.com:
Those tags make IE8 behave more like IE7 and cure the click coordinate issue. If someone is really interested what they actually do, I would recommend starting from this excellent study. What I learned about that article, is that the tag will not pass HTML5 validation.
The bug has been archived in IE8 issue list since beta times. The only known workaround is to force IE8 to "IE7 combatibility mode".
Investigating Microsofts own code reveals that even they have not found any other workaround. You can find in the head section of Bing maps:
<meta http-equiv="X-UA-Compatible" content="IE=7" />
And in maps.google.com:
<meta http-equiv=X-UA-Compatible content=IE=EmulateIE7 />Those tags make IE8 behave more like IE7 and cure the click coordinate issue. If someone is really interested what they actually do, I would recommend starting from this excellent study. What I learned about that article, is that the tag will not pass HTML5 validation.
Wednesday, July 22, 2009
Custom marker generators
There are some fancy free services that generate custom marker icons for us. Google Chart API provides many useful labeled map pin types. Even tilted ones.Graham has released a fascinating service that generates all the needed files from an image file of your own. You upload the image as png, gif or jpeg and instantly you can download a zipped package containing:
- 24-bit png icon image
- shadow
- printImage
- mozPrintImage
- printShadow
- transparent
- imageMap array
Monday, July 20, 2009
Drawing rectangles with V3
The experimental API v3 does not support polylines yet. We don't need polyline support for drawing simple rectangles. We can make browser to draw them.
BoundsBox for v3 is an extension that takes LatLngBounds object as an argument and draws the bounds on map. A DIV is created and made an OverlayView overlay object.
Styling of the rectangle is made with CSS. You can put text content also and even a background image. 'click' event is available, 'mouseover' is easily attached.
See the example that visualizes bounds that v3 geocoder returns.
BoundsBox for v3 is an extension that takes LatLngBounds object as an argument and draws the bounds on map. A DIV is created and made an OverlayView overlay object.
Styling of the rectangle is made with CSS. You can put text content also and even a background image. 'click' event is available, 'mouseover' is easily attached.
See the example that visualizes bounds that v3 geocoder returns.
Monday, July 13, 2009
Location by browser
Now we have two browsers that provide client location by JavaScript API, Firefox 3.5 and Google Chrome.
FF3.5 supports W3C specification (draft) and provides navigator.geolocation object. The objects getCurrentPosition() method returns coordinates and even heading and speed properties.
Chrome provides geolocation object by built in Google Gears.
Actually other browsers return the location too with Google Gears installed.
Test and read more from the links of this page. The page is the first one that I set sensor=true.
Saturday, December 13, 2008
GoogleBar hack
How to make a Local search and have an info window opened during page load.
If you load the full blown Google AJAX Search API, that's not a problem. If you are using Local Search GControl, you have a
searchFormHint option but not a method to trigger the search. With GGoogleBar you don't have either of them.Both GoogleBar and Local Search Control generate a form element with a text input field and a submit button. The form element of GoogleBar is not generated until the GoogleBar is opened. So we can assume that the form is the last one on your page and we can access it like:
var lastForm = document.forms.length - 1;
document.forms[lastForm].elements[0].value = "Music";
document.forms[lastForm].elements[1].click();
You have to define the GoogleBar to open initially by googleBarOptions:{showOnLoad:true}.
How to trigger the form access? There is no event that would tell us when the form is built. I ended up using onIdleCallback function plus a small timeOut. The onIdleCallback is triggered when GoogleBar is formed. It is triggered also after each search so I set a variable to make sure the seach is made only once.
It seems to work but with no quarantee.
Subscribe to:
Posts (Atom)
