->

06 December 2006

Drag Polylines in Google Maps (v2.70)

Some nice new functions are coming out of the Google Maps API.
(trying to keep it simple but this post gets a bit geeky)

Drag Polyline v2.70 Esa Example
ESA has been busy and demostrates the draggable Polyline.

So whats the fuss about that? Well there are alot more discoveries in this update.

Mike Williams seems to know whats going on in the latest javascript update (v2.70)
his comments below.

There's lots of strange goings on inside the API this time.

I've not yet worked out how to use it all, or what it all does.

I've not actually tested any of them yet. All this information is my
reading of the source code and crawling through that part of the DOM
that contains the functions. So it's quite possible that I've
misunderstood some of it.

New function
============
GVerify(la)
This one's weird. I can't see where they managed to hide the source. I'm
pretty sure that it isn't in the normal API code or in the API loader,
but the code somehow is present in the DOM.

New method
==========
GBounds.mid()
returns the GPoint at the centre of the GBounds.

Extra parameters
================
new GPolygon()
new GPolyline()
GPolyline.fromEncoded()
all accept one extra parameter, making a total of 7, 5, and 2 parameters
respectively. The additional parameter appears to be a set of
{GPolylineOptions}

New properties
==============
GPolyline.opacity
GPolyline.color
GPolyline.weight
Perhaps you can now do things like changing the weight of a polyline
when the zoom changes, and changing the colour when the maptype changes.
Previously the properties were inaccessible so you could only make such
changes by removing the old polyline and adding a new one.

If so, it's rather strange for Google to be exposing properties instead
of providing methods like GPolyline.setWeight() etc. It's not their
usual coding style.

New event
=========
visibilitychanged
Triggered by GMarker, GPolyline and GPolygon when their .hide() or
.show() method is called. Returns a parameter which is true for .show()
and false for .hide().

New GMarkerOptions
==================
description
name
zIndexProcess

zIndexProcess sounds like fun. You can set it to a function(marker,b)
that returns a zIndex value for the marker instead of using the normal
API internal function that puts the southerly markers on top.

new GPolyLineOptions
====================
id
name
outline
mapsdt

new GMapOptions
===============
mapOrderMarkers
It looks like you can set this to be a reference to an ordering
function, as used in an Array.sort() call. If you use the option, then
the API will call markers.sort(yourfunction). I've no idea why you might
want to do that.

new GDraggableObjectOptions
===========================
restrictX

--
If your a bit of a javascript buff you can access these functions by changing your api key code.
from:
http://maps.google.com/maps?file=api&v=2&key=YOUR KEY HERE

to:
http://maps.google.com/maps?file=api&v=2.70&key=YOUR KEY HERE


Well done Mike and Esa good work, nice examples coming soon

Labels: , , , ,

0 Comments:

Post a Comment

<< Home