Athfar


I have a layer of pushpins that is working fine but I am uncertain of how to change the icons for these pushpins.

Should it be stored in the XML or is it set globally for the layer

-Chris





Re: Using ImportShapeLayerData and Custom Icons

Derek Chan


Chris,

There's a thread that discusses this here:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1692076&SiteID=1

In particular, I've posted up a general guideline on how to do this here:
http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1664041&SiteID=1

Hope that helps,





Re: Using ImportShapeLayerData and Custom Icons

Athfar

hrmmm... Just out of curiosity is there some limitation to how many push pins that should be used with a regular VEShape call

I have about 100 pushpins so far to map but there could be alot more than that.







Re: Using ImportShapeLayerData and Custom Icons

Athfar

I'm lost as to what has to happen in the Callback function...

Here's what I have:

Code Snippet

function drawPins()
{
var existingLayer = new VEShapeLayer();
var veLayerSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS, 'url', 'existingLayer');

existingLayer.Hide();
map.ImportShapeLayerData(veLayerSpec, onFeedLoad, 1);
existingLayer.Show();
}

function onFeedLoad()
{
Shape.SetCustomIcon(Shape.IconId);
}

I know the callback isn't right I don't think...






Re: Using ImportShapeLayerData and Custom Icons

Derek Chan

The pushpin limit is endless although once you get around 200+ it just eats up too much memory and slows to a crawl depending on CPU performance.




Re: Using ImportShapeLayerData and Custom Icons

jhofker

Try something like this:

Code Snippet

function onFeedLoad(layer)
{
layer.Hide();
var numShapes = layer.GetShapeCount();
for(var i=0; i < numShapes; ++i)
{
var s = layer.GetShapeByIndex(i);

s.SetCustomIcon("<div class='pin'></div>");
}
layer.Show();
}

Basically, you're looping through all of the shapes you just added. Mine removes the pushpin, but yours can do whatever you'd like.