On Mar 12, 7:58 pm, snake211 <[email protected]> wrote:
>
> I am sorry that I cannot post a link to my page because it requires a
> vpn.
>

VPN?

Then contact your Google Premier representative for technical support.
It is included in the price you paid for your Premier license.

--
Marcelo - http://maps.forum.nu
--






> So far, the custom tiling is successful. On the custom map, I want to
> add a GEvent listener to generate polygon or polyline with a mouse
> click. Below is my code:
>
> function init() {
> ...
>   var map = new GMap2(document.getElementById("map"));
>   var customTileLayers = [new GTileLayer(...)];
>   customTileLayers[0].getTileUrl = customGetTileUrl;
>   var customMap = new GMapType(customTileLayers, new
> GMercatorProjection(12)...);
>
>   map.addMapType(customMap);
>   map.setCenter(new GLatLng(0, 0), 3, customMap);
>   // I will skip explanation up to this point. It is just a routine
> for custom map.
>
>   GEvent.addListener(map, "click", function(overlay, latlng) {
>     var lat = latlng.lat();
>     var lon = latlng.lng();
>     var latOffset = 10;
>     var lonOffset = 10;
>
>     var polygon = new GPolygon([
>       new GLatLng(lat, lon - lonOffset),
>       new GLatLng(lat + latOffset, lon),
>       new GLatLng(lat, lon + lonOffset),
>       new GLatLng(lat - latOffset, lon),
>       new GLatLng(lat, lon - lonOffset)], "#f33f00", 5);
>
>     map.addOverlay(polygon);     // <------- THIS IS THE PROBLEM, I
> THINK!!
>   });
>
>   }
>
> }
>
> I checked that latitude and longitude information are correctly
> captured by GEvent listener. It seems that the GPolygon object is
> created without a problem. However, the last line
> (map.addOverlay(polygon);) causes a javascript error "Object doesn't
> support this property or method".
>
> Could anyone please help me??
>
> * I tried different orderings among "map.addMapType", "map.setCenter",
> and "GEvent.addListener", but still got the same error.
>
> ** I tried to add the GEvent listener on the "customMap" (GMapType
> object) but it is not working. So it seems that the source object for
> the GEvent listener has to be "map" (GMap2 object).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to