My solution to 'markers too close together' is via manipulating z-index of the markers. The possibility was given to us with 2.70.
A test page with some more explanation.
Wednesday, December 27, 2006
Monday, December 04, 2006
Finding map buttons
The string variables listed earlier can be used to identify map buttons.
var divs = map.getContainer().getElementsByTagName("div");Now variable 'zoomInButton' is the container of 'Zoom In' button and you can change its style or construct an event listener.
for(var i = 0; i<divs.length; i++)
{
var title = divs[i].getAttribute("title");
if(title==_mZoomIn)
{
zoomInButton=divs[i];
}}
Update 2008. Excpected lifespan of this kind of hacks is a few months. This hasn't been working for a long time. if(title=="Zoom in") works but but you have to lock the language to hl=en.
Tuesday, November 21, 2006
GPolygon()
v2.69 gives us possibility to fill inner area of a polyline. The syntax is like GPolyline() but with two more parameters:
Discovered by Mike Williams. An example.
new GPolygon(array_of_points, line_color, line_width, line_opacity,
fill_color, fill_opacity);
Discovered by Mike Williams. An example.
Sunday, November 12, 2006
A page without a key
Api checks
If you have your page hosted in GooglePages without a key you get Navteq maps for US and today you can get African maps with the trick. Just delete '&key=blahblah..' from the api call script. 'Powered by Google' logo goes with the key. Cairo.
I have not solved how to make GClientGeocoder work with a page like that.
if((d=="igoogle"||d=="gmodules"||d=="googlepages"||from the page url. If satisfied no key is needed. The bonus is that you get the same tileset as maps.google.com.
d=="orkut")&&c=="com")
If you have your page hosted in GooglePages without a key you get Navteq maps for US and today you can get African maps with the trick. Just delete '&key=blahblah..' from the api call script. 'Powered by Google' logo goes with the key. Cairo.
I have not solved how to make GClientGeocoder work with a page like that.
Friday, November 03, 2006
Event tester 2.0 pre alpha
Now I have a partially operating pre alpha event test page v2.0 on line:
- parameters (first three of them)
- draggable output fields
- more objects (info window, overview map, draggable object...)
- the list of GEvents is read from text file that is a section of api
- events are alphabetically sorted to a "List" field
- events field is editable [submit]
- call GLog to see timing
- script area (also in v1) to write event listeners of your own
- a bug was revealed:
- mouseover and mouseout of map will not come back if once deleted
- 'mousemove' is deleted for saving output field
- I have managed to get a few times
Monday, October 30, 2006
'load' GEvent of overview map
Oh yes. I took time to enhance the event test page. I will publish 2.0 beta very soon. During testing I made some discovery.
It has been a common practice to apply a small delay when setting the initial map type or position of overview map.
I happened to find a GEvent 'load' that is probably intended for the purpose.
It has been a common practice to apply a small delay when setting the initial map type or position of overview map.
I happened to find a GEvent 'load' that is probably intended for the purpose.
Seems to work perfect.
var ovMap=new GOverviewMapControl();
map.addControl(ovMap);
var mini=map.getOverviewMap();
GEvent.addListener(mini,"load",function(){
mini.setZoom(14);
mini.setMapType(G_SATELLITE_MAP);
});
Saturday, October 28, 2006
GEvents
There is an easy to read section in api.js. The one where string variables are introduced (2.67):
var Bb="newcopyright";
var mf="blur";
var X="click",
bd="contextmenu",
Ca="dblclick";
var nf="error";
var ce="keydown",
de="keypress",
of="keyup",
cd="load",
Da="mousedown",
xc="mousemove",
Ea="mouseout",
Ma="mouseup",
he="mousewheel",
ie="DOMMouseScroll";
var sf="unload",
yc="remove",
Va="mouseover",
Yd="closeclick",
fe="maximizeclick",
ke="restoreclick",
ge="maximizeend",
rf="restoreend",
pf="maxtab",
Wd="animate",
Vd="addmaptype",
lf="addoverlay",
Xd="clearoverlays",
Zd="infowindowbeforeclose",
be="infowindowprepareopen",
$d="infowindowclose",
ae="infowindowopen",
Kb="maptypechanged",
qa="moveend",
Lb="movestart",
je="removemaptype",
qf="removeoverlay",
Wa="resize",
tf="zoom",
dd="zoomend",
le="zooming",
me="zoomrangechange",
ne="zoomstart",
ub="dragstart",
tb="drag",
Ua="dragend",
vb="move",
wc="clearlisteners";
var vc="changed";
var ee="logclick";
Most of them are known GEvents but there are a few strings that I have no idea about. They are not necessarily GEvents but it is very easy to try that. I have to find time to create the event test pages further on. For instance info window has GEvents now.
var Bb="newcopyright";
var mf="blur";
var X="click",
bd="contextmenu",
Ca="dblclick";
var nf="error";
var ce="keydown",
de="keypress",
of="keyup",
cd="load",
Da="mousedown",
xc="mousemove",
Ea="mouseout",
Ma="mouseup",
he="mousewheel",
ie="DOMMouseScroll";
var sf="unload",
yc="remove",
Va="mouseover",
Yd="closeclick",
fe="maximizeclick",
ke="restoreclick",
ge="maximizeend",
rf="restoreend",
pf="maxtab",
Wd="animate",
Vd="addmaptype",
lf="addoverlay",
Xd="clearoverlays",
Zd="infowindowbeforeclose",
be="infowindowprepareopen",
$d="infowindowclose",
ae="infowindowopen",
Kb="maptypechanged",
qa="moveend",
Lb="movestart",
je="removemaptype",
qf="removeoverlay",
Wa="resize",
tf="zoom",
dd="zoomend",
le="zooming",
me="zoomrangechange",
ne="zoomstart",
ub="dragstart",
tb="drag",
Ua="dragend",
vb="move",
wc="clearlisteners";
var vc="changed";
var ee="logclick";
Most of them are known GEvents but there are a few strings that I have no idea about. They are not necessarily GEvents but it is very easy to try that. I have to find time to create the event test pages further on. For instance info window has GEvents now.
Tuesday, October 17, 2006
More custom legends
Tooltips of map type buttons are here again. We had them in v1 and now in v2,65. When trying to find how to modify their contents I found many other parameters too.
_mPanNorth, _mPanWest, _mPanEast, _mPanSouth (Arrow button tooltips)
_mLastResult (Return button tooltip)
_mZoomIn, _mZoomOut (Zoom button tooltips)
_mMapMode (Map button legend)
_mMapModeShort (Map legend of small button)
_mStreetMapAlt (Map button tooltip)
_mMapError (Error message of uncovered areas)
_mSatelliteMode (Sat button legend)
_mSatelliteModeShort (Sat legend of small button)
_mSatelliteMapAlt (Sat button tooltip)
_mSatelliteError (Error message of uncovered areas)
_mHybridMode (Hyb button legend)
_mHybridModeShort (Hyb legend of small button)
_mHybridMapAlt (Hyb button tooltip)
Syntax as in previous post.
_mPanNorth, _mPanWest, _mPanEast, _mPanSouth (Arrow button tooltips)
_mLastResult (Return button tooltip)
_mZoomIn, _mZoomOut (Zoom button tooltips)
_mMapMode (Map button legend)
_mMapModeShort (Map legend of small button)
_mStreetMapAlt (Map button tooltip)
_mMapError (Error message of uncovered areas)
_mSatelliteMode (Sat button legend)
_mSatelliteModeShort (Sat legend of small button)
_mSatelliteMapAlt (Sat button tooltip)
_mSatelliteError (Error message of uncovered areas)
_mHybridMode (Hyb button legend)
_mHybridModeShort (Hyb legend of small button)
_mHybridMapAlt (Hyb button tooltip)
Syntax as in previous post.
Update 2008. These variables have gone a long time ago.
Sunday, October 15, 2006
Custom type button legends
Add this script right after your Maps API call:
<script>
_mMapMode = "Karta";
_mMapModeShort = "Karta";
_mSatelliteMode = "Sputnik";
_mSatelliteModeShort = "Sput";
_mHybridMode = "Gibrid";
_mHybridModeShort = "Gib";
GLoadMapsScript();
<\script>
An example.
The trick was presented by Alexander on the forum.
var blog = new collectionOfTricks();
A blog is the most convenient notebook. This is my notebook for Google Maps API code snippets and tricks.
The first one is a method to edit the legends of map type buttons.
The first one is a method to edit the legends of map type buttons.
Subscribe to:
Posts (Atom)