Link to home
Start Free TrialLog in
Avatar of Nate_LR
Nate_LR

asked on

Google Maps API v3 with custom tiles and opacity slider

A while back I put together a Google Maps mashup using version 2 of the api.  Now for some reason the opacity slider is not displaying and I can't figure out why....
http://www.geology.ar.gov/geology/geology_map.htm

I decided to update this map to version 3 of the Google Maps api.  I can get the custom tiles on the map with this function...
 var maptiler = new google.maps.ImageMapType({
	getTileUrl: function(coord, zoom) { 
		var proj = map.getProjection();
		var tileSize = 256 / Math.pow(2,zoom);
		var tileBounds = new google.maps.LatLngBounds(
            proj.fromPointToLatLng(new google.maps.Point(coord.x*tileSize, (coord.y+1)*tileSize)),
			proj.fromPointToLatLng(new google.maps.Point((coord.x+1)*tileSize, coord.y*tileSize))
        );
        //if (mapBounds.intersects(tileBounds) && (zoom >= mapMinZoom) && (zoom <= mapMaxZoom))
			// return "http://www.maptiler.org/example-usgs-drg-grand-canyon-gtiff/" +
			return "datatiles/COGEO/" + zoom + "/x" + coord.x + "_y" + coord.y + ".png" ;
        //else
            //return "http://www.maptiler.org/img/none.png";
	},
	tileSize: new google.maps.Size(256, 256),
	isPng: true
	//opacity: .5
});

map.overlayMapTypes.insertAt(0, maptiler);

Open in new window


I can set the opacity initially with this - maptiler.setOpacity(.5) - but it won't work dynamically with the opacity slider.

I'm using the example at....
http://www.gavinharriss.com/code/opacity-control

When I attempt to use Gavin Harriss' CustomTileOverlay I cannot get it to load my tiles.  My tiles are not all 256 x 256 px - could that be the problem?

Here is my test url....
http://www.geology.ar.gov/geology/geology_map_v3.htm

Thanks!
Avatar of CvD
CvD
Flag of Netherlands image

ASKER CERTIFIED SOLUTION
Avatar of Nate_LR
Nate_LR

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Fine with me
Avatar of Nate_LR
Nate_LR

ASKER

I found the solution on my own.