Re: Custom Tiles plus GEvent polygon overlay
On Mar 12, 1:55 pm, snake211 <jiry...@gmail.com> wrote:
> > How can we tell that or see the problem?
>
> > -- Larry
>
> Sorry that it took me long to find a way to show the problem.
>
> Please go tohttp://code.google.com/apis/ajax/playground/#map_polygon_simple
>
> Then, in "Pick an API" module, choose "Maps" -> "Map Simple".
>
> Then, in "Edit Code" module, remove the current content and copy/paste
> the following:
> ------------
> function initialize() {
> if(GBrowserIsCompatible()) {
> var copyCollection = new GCopyrightCollection('My Copyright');
> var copyright = new GCopyright(1, new GLatLngBounds(new
> GLatLng(-90, -180), new GLatLng(90, 180)), 0, "2010 My Copyright");
> copyCollection.addCopyright(copyright);
>
> var tilelayers = [new GTileLayer(copyCollection, 3, 3,
> {isPng:true, opacity:1.0})];
> tilelayers[0].getTileUrl = function() {return "http://
> code.google.com/apis/maps/documentation/examples/include/
> tile_crosshairs.png";};
>
> var custommap = new GMapType(tilelayers, new
> GMercatorProjection(12), "MyMap", {errorMessage:"No map data
> available"});
>
> var map = new GMap2(document.getElementById("map_canvas"));
> map.addMapType(custommap);
> map.addControl(new GLargeMapControl());
>
> 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, 1,
> "#ff0000", 0.2);
> alert(lat+","+lon);
> map.addOverlay(polygon);
> });
> map.setCenter(new GLatLng(0, 0), 3, custommap);
> }
> }
> ------------
>
> Then, in "Output" module, click "Run Code" button.
>
> The result will show the custom tiles using recurring
> "tile_crosshairs.png" images. GEvent listener works as it pops up the
> latlng.lat() and latlng.lng() correctly. However, GPolygon is not
> showing.
Nothing shows. Please make it easy for us and post a link to a map
that shows the problem.
-- Larry
--
You received this message because you are subscribed to the Google Groups "Google Maps API" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home