summit72


Sorry, I'm not a developer, so when you say ...

"You simply add this":
shape.SetCustomIcon("<img src='http://maps.live.com/i/bin/1.3.1204222815.33/pins/RedCircle" + (cnt+1) + ".gif' />");

I don't understand where or how I tried to use the example you attached, but the example uses an outline, which I do not use. When I tried to take parts of the script, I just get error messages.

Also, the example uses a RedCircle. Is it possible to use the same red pushpins as in the collection The only difference being the addition (retention) of numbering.

I apologize for being so ignorant with these things.

This is my script...

<script>
var map = null;

function OnPageLoad()
{
map = new VEMap('MapDiv');

map.SetDashboardSize(VEDashboardSize.Small);
map.onLoadMap = fnLoadCollection;
map.LoadMap(new VELatLong(45.567909, 25.620117), 6 ,'r' , false);
map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
}

function fnLoadCollection()
{
var veLayerSpec = new VEShapeSourceSpecification(VEDataType.VECollection, "CCD5DFDC11361B33!103"); //Romanian Hostels
map.ImportShapeLayerData(veLayerSpec, null, true);
}

</script>




Re: I still don't get it?

Richard_Brundritt


This is how you will have to change your code.


function fnLoadCollection()
{
var veLayerSpec = new VEShapeSourceSpecification(VEDataType.VECollection, "CCD5DFDC11361B33!103");
map.ImportShapeLayerData(veLayerSpec, null, true);
var numShapes = layer.GetShapeCount();
for(var i=0; i < numShapes; ++i)
{
var s = layer.GetShapeByIndex(i);
s.SetCustomIcon("http://imageURL");
}
}







Re: I still don't get it?

summit72

I changed the code as per your reply, but I still don't get the custom (numbered) icons to appear.

<script>
var map = null;

function OnPageLoad()
{
map = new VEMap('MapDiv');

map.SetDashboardSize(VEDashboardSize.Small);
map.onLoadMap = fnLoadCollection;
map.LoadMap(new VELatLong(45.567909, 25.620117), 6 ,'r' , false);
map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
}


function fnLoadCollection()
{
var veLayerSpec = new VEShapeSourceSpecification(VEDataType.VECollection, "CCD5DFDC11361B33!103");
map.ImportShapeLayerData(veLayerSpec, null, true);
var numShapes = layer.GetShapeCount();
for(var i=0; i < numShapes; ++i)
{
var s = layer.GetShapeByIndex(i);
s.SetCustomIcon("<img src='http://dev.virtualearth.net/legacyService/i/bin/1.3.1204222815.33/pins/RedCircle" + (cnt+1) + ".gif' />");
}
}

</script>





Re: I still don't get it?

Craig731

Two problems that i see.

You're also using cnt + 1, when your counter in code is "i"

Finally, you're matching an apostrophe to a double quote around .gif. Keep those in-sync.

Try plugging this in

Code Block

s.SetCustomIcon("<img src='http://dev.virtualearth.net/legacyService/i/bin/1.3.1204222815.33/pins/RedCircle' + (i+1) + '.gif'/>" />








Re: I still don't get it?

SoulSolutions

No I'm pretty sure his use of quotes was fine. Do you get a js error or is the collection not loading at all Version 6 will not load live.com collections at this time, V5 is fine so I'm told.

John.






Re: I still don't get it?

summit72

I get no js error and the collection is loading. In fact, I use the same script and numbered pushpins on this page
http://www.russia-ukraine-travel.com/map-trans-siberian.html and it works fine.
Only differece between pages is the one above is a full page with an "outline" on the right hand side. The page I want to put numbered pushpins on (but can't figure out how) is a regular webpage with a VE Map embeded (no outline on the right).
Shouldn't be that big of a problem, but this stuffs over my head, so I don't know.




Re: I still don't get it?

TheClansman

It should work if you change your line too

Code Block

s.SetCustomIcon("<img src='http://dev.virtualearth.net/legacyService/i/bin/1.3.1204222815.33/pins/RedCircle' + i + '.gif'/>" />








Re: I still don't get it?

SoulSolutions

Ok, I thought I would run this up to see the problem but i fear I just found another, the code I would use is very different and although it works fine with a GeoRSS collection it fails for the live.com version:

Code Block

var map = null;

function OnPageLoad()
{
map = new VEMap('myMap');

map.SetDashboardSize(VEDashboardSize.Small);
map.onLoadMap = fnLoadCollection;
map.LoadMap(new VELatLong(45.567909, 25.620117), 6 ,'r' , false);
map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
}

function fnLoadCollection()
{
var l = new VEShapeLayer();
var veLayerSpec = new VEShapeSourceSpecification(VEDataType.VECollection, "CCD5DFDC11361B33!103", l);
map.ImportShapeLayerData(veLayerSpec, function()
{
var numShapes = l.GetShapeCount();
for(var i=0; i < numShapes; ++i)
{
var s = l.GetShapeByIndex(i);
s.SetCustomIcon("img src='http://dev.virtualearth.net/legacyService/i/bin/1.3.1204222815.33/pins/RedCircle"

+ (i+1) + ".gif' />");
}
}
, true);
}

John.






Re: I still don't get it?

summit72

Unfortunately, still doesn't work.




Re: I still don't get it?

RobertoRaimondo

Hello Summit,

I didn't follow the first thread about your problem, so maybe I'll say something you already know. I guess you want to use version 6, and I wasn't able to make it work with it, but if V5 is enough for you, this piece of code should work. I am sorry if this was obvious Smile
I simply put it together using code from other contributors. Just copy and paste everything in an html file, and test it.

Roberto.

Code Block

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5"></script>
<script type="text/javascript">
var map = null;

function OnPageLoad()
{
map = new VEMap('myMap');

map.SetDashboardSize(VEDashboardSize.Small);
map.onLoadMap = fnLoadCollection;
map.LoadMap(new VELatLong(45.567909, 25.620117), 6 ,'r' , false);
map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
}

function fnLoadCollection()
{
var l = new VEShapeLayer();
var veLayerSpec = new VEShapeSourceSpecification(VEDataType.VECollection, "CCD5DFDC11361B33!103", l);
map.ImportShapeLayerData(veLayerSpec, function()
{
var numShapes = l.GetShapeCount();

for(var i=0; i < numShapes; ++i)
{
var s = l.GetShapeByIndex(i);
s.SetCustomIcon("<img src='http://dev.virtualearth.net/legacyService/i/bin/1.3.1204222815.33/pins/RedCircle"+ (i+1) + ".gif' />");
}
}
, true);
}
</script>
</head>
<body onload="OnPageLoad();">
<div id='myMap' style="position:relative; width:600px; height:600px;"></div>
</body>
</html>





Re: I still don't get it?

summit72

I finally got it. You guys are all real kind. Thanks for the help.




Re: I still don't get it?

SoulSolutions

That is funny, I had it so close!!! I left off a "<"

Good work Roberto!

s.SetCustomIcon("img src='http://dev.virtualearth.net/legacyService/i/bin/1.3.1204222815.33/pins/RedCircle"

+ (i+1) + ".gif' />");

s.SetCustomIcon("<img src='http://dev.virtualearth.net/legacyService/i/bin/1.3.1204222815.33/pins/RedCircle"

+ (i+1) + ".gif' />");

John.






Re: I still don't get it?

RobertoRaimondo

Thank you John!
I was not sure to understand the problem, but I am glad I was able to help, even if mine was a very very small contribution.

Roberto.