deeplights


Can anyone help me to add a pushpin at a specific altitude in 3D. The VEShape class only takes the latitude,longitude info. and does not have any methods to specify the altitude.




Re: Adding pushpins at specific altitude in 3D

Duncan Lawler


It's not fully supported yet (and therefore not in the SDK), but you can can call SetElevation() on a shape object like this:

var veshape1 = new VEShape(VEShapeType.Pushpin,new VELatLong(43, -122));

veshape1.SetElevation(100000);






Re: Adding pushpins at specific altitude in 3D

Dugrhill

Duncan:

I can't seem to get this to work. I posted about it here...

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=2087831&SiteID=1

Is it pretty straight forward or is there something easy I could be missing.

Thanks!

Dugr






Re: Adding pushpins at specific altitude in 3D

SoulSolutions

Wow that's really cool, it worked for me! Now I can have little planes flying around also....

In terms of what the number actually is Duncan would have to answer but I could guess it maybe related to the altitiude setting:

"In 3D mode, sets the altitude (in meters) above the geoid in the map view."

So I suspect its not the actually sea-level altitude but rather the distance above the ground / building

John.






Re: Adding pushpins at specific altitude in 3D

Dugrhill

SoulSolutions/John:

It's exciting to hear that it worked for you, it gives me hope. Surprise)

I am a JavaScript Newb, here is the code I am using. Can you see any reason that what you are doing would work and what I am doing does not work

<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx v=5"></script>

<script>

var map = null;

var layerid=1;

function GetMap()

{

map = new VEMap('myMap');

map.LoadMap();

}

function AddMyLayer(type)

{

//test.value = txtSource.value;

var l = new VEShapeLayer();

var veLayerSpec = new VEShapeSourceSpecification(type, txtSource.value, l);

map.ImportShapeLayerData(veLayerSpec, onFeedLoad);

}

function onFeedLoad(layer)

{

var count = layer.GetShapeCount();

for (var i = 0; i < count; i++)

{

var shape = layer.GetShapeByIndex(i);

//test.value = shape.IconId;

shape.SetCustomIcon("<img src='" + shape.IconId + "'/>");

}

//Add a pushpin to the new layer

shape = new VEShape(VEShapeType.Pushpin, map.GetCenter());

shape.SetTitle('My pushpin');

shape.SetDescription('This is a pushpin.');

shape.SetElevation(100000);

layer.AddShape(shape);

alert('RSS or Collection loaded. There are '+layer.length+' items in this list.');

}

</script>

Do you have any working sample code that you are willing to publish

TIA

Dugr





Re: Adding pushpins at specific altitude in 3D

SoulSolutions

Ok, that was painful as it stopped working for me also.

It would appear you need to set a customIcon

veshape1.SetCustomIcon("pin.png");

and be running in a proper webserver not from the file system

eg localhost/flyingtest.htm

Then it works, I should do a video of flying pins......

John.