Layer not rendering correctly

Hi,

I am using the "adding a transparent layer SDK sample", however when I change the source image from the one provided to my own image (located on my machine), I get strange results.

Specifically the source image becomes tiled ad-infinitum over the entire map surface, instead of staying inside the bounding box. Does anyone have any idea as to what I'm doing wrong Specifically, do any of the following matter:

image name, image location, image format (tried both jpg and png), image size, image metadata etc.

Thanks for the help,
Radu


<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>
<script>
var map = null;
var pinID = 1;

function GetMap()
{
map = new VEMap('myMap');
map.LoadMap(new VELatLong(48.03,-122.4),12,'r' ,false);
GetTiles();
}

function GetTiles()
{
var bounds = [new VELatLongRectangle(new VELatLong(49,-123),new VELatLong(47,-121))];
var tileSourceSpec = new VETileSourceSpecification();
tileSourceSpec.ID = "lidar";
tileSourceSpec.TileSource = "thumb_small.jpg";
tileSourceSpec.NumServers = 1;
tileSourceSpec.Bounds = bounds;
tileSourceSpec.MinZoom = 10;
tileSourceSpec.MaxZoom = 18;

map.AddTileSource(tileSourceSpec);

var tileLayer = new VELayerSpecification(VELayerType.VETileSource,"1", "lidar");
tileLayer.ZIndex = 100;
tileLayer.Opacity=0.5;

map.AddLayer(tileLayer);
}
function DeleteTileLayer()
{
map.DeleteLayer("1");
map.DeleteTileSource("lidar");
}
</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:600px; height:600px;"></div>
<a href="#" onclick="DeleteTileLayer();">Remove the tile layer</a>
</body>
</html>



Answer this question

Layer not rendering correctly

  • mcdonaldn

    For the TileSource i believe it has to be a full web address eg. http://locahost/NewLayer/%4.png

    Not sure if this is your problem.

    John.



  • PradeepVaithy

    There is another thread about this, too. The custom tiling is not designed for overlaying a single image on the map. It is for overlaying a suite of tiles. In your example, you are referencing a single .jpg file, so the map control will always use that single file for each tile.

    Assuming you are trying to use tiles, and not just a single file, then you need to change your path to include the %4 variable, as the sample shows.

    If you are simply trying to overlay an image on the map, use the Map.AddControl() method and reference the image file in an <img> tag within the control.

    Hope that helps,
    Caleb


  • Soumya B

    Also, as mentioned in another thread, try using our "MapCruncher" tool to convert your .jpg image into a collection of tiles that are placed geographically in the place you'd like them.

    Cheers,

    Jeremy


  • Taylor Meek

    Nope, that's not it. I am using a jpg image from the web and it shows up infinitely tiled as well.

    I am using IE 7.

     


  • Layer not rendering correctly