Wednesday, August 29, 2007

Some Hacks in Google Maps

1. You cannot setMapType before setCenter
2. To change cursor the the map, look for the div inside map_div that has style cursor. So, normally in my application in the second child div. This type I found in http://groups.google.com/group/Google-Maps-API.

$('map').down(1).style.cursor = "pointer";

3. To use custom cursor for the map. This type I could not in Google Groups at all. It seems no one can change to a custom cursor. But I try, using Firebug to monitor the DOM changing while I use Google Maps. And I found that, Google uses this format in their style, so I try it with javascript in my both browser IE 6 and Mozilla 2.0.0.5, and It works.

$('map').down(1).style.cursor = "url(http://www.google.com/intl/en_ALL/mapfiles/openhand.cur), default";


4. Making GMarker drag smoothly without flip and flop. This one I get from Mike http://www.econym.demon.co.uk/googlemaps/. The first thing you have to do is:
Change dragCrossImage of GIcon to Invisble Image
Set dragCrossMove of GMarker to true
Set bouncy of GMarker to false
Finally, if it doesn't work, set GIcon.maxHeight = 1 or less than 1. Don't set to zero otherwise you will get the default height.

5. Testing a point is inside a Polygon or not, see this http://econym.googlepages.com/inside.htm

No comments:

Subscribe in a Reader