Skip to content

Instantly share code, notes, and snippets.

@albertsun
Created November 1, 2011 21:08
Show Gist options
  • Save albertsun/1331913 to your computer and use it in GitHub Desktop.
Save albertsun/1331913 to your computer and use it in GitHub Desktop.
VectorTileMapType
/*
VectorTileMapType implementing the Google Maps API V3 MapType Interface
http://code.google.com/apis/maps/documentation/javascript/maptypes.html#MapTypeInterface
Used for http://censusmapmaker.com/
*/
function VectorTileMapType() {
this.minZoom = 13;
this.maxZoom = 18;
}
VectorTileMapType.prototype = {
tileSize: new google.maps.Size(256, 256),
minZoom: 13,
maxZoom: 18,
getTile: function(coord, zoom, ownerDocument) {
//console.log([coord.x, coord.y, zoom]);
if ((zoom >= this.minZoom) && (zoom <= this.maxZoom)) {
//console.log("getting: "+[coord.x, coord.y, zoom]);
WSJNG.query.LoadCensusBlockTiles.LoadTile([coord.x, coord.y, zoom]);
}
return $("<div class='dummydiv'>"+[coord.x, coord.y, zoom].join("_")+"</div>")[0];
},
releaseTile: function(tileNode) {
//console.log("releasing: "+$(tileNode).text());
WSJNG.query.LoadCensusBlockTiles.RemoveTile($(tileNode).text());
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment