Lonifasiko


Hi,

I'm using Virtual Earth maps inside a Winforms application. My C# application, everytime that receives a new lat/long position, writes dinamically a HTML file in the user's "temp" directory. This HTML file containing the map specification is loaded into a webBrowser control. Untill today, I have no problems with Virtual Earth V4 API. I could draw pushpins with custom icons without problems; the HTML file was in user's "temp" directory and images referenced in the pushpins were located in another path on disk.

Today started upgrading application to V5. I've seen that now pushpins and polygons must be added like shapes. Then I was trying to show a simple pushpin with setCustomIcon method. I read from the documentation that:

"If the customIcon field is a string that begins with the < character, it is considered to be HTML, and it is used to create the pushpin icon. All other strings are treated as URLs to an image. If the URL is invalid or doesn't point to an image, then nothing will be displayed for the pushpin icon."

I used to do this with Virtual Earth V4:
Code Block

AddPin(40.405305,-3.68926,'C:\\image.gif', 'MADRID','Mostoles');


Now I'm just doing more or lees the same:

Code Block

shape.setCustomIcon("C:\\image.gif");


What's the problem here I understand V5 lets you point images on local paths, as V4 did. I don't want neither to copy images to user's "temp" directory nor upload them to a webserver like IIS.

I hope somebody can give me a quick solution.

Thanks very much.



Re: SetCustomIcon pointing to local image file does not work in v5

Mike Priven


Try this:

shape.setCustomIcon("file:///c:/image.gif");

\Mike





Re: SetCustomIcon pointing to local image file does not work in v5

Lonifasiko

Bravo Mike! Simply awesome!

I think it is the unique possibilitie I had not tried.

Thanks very much in advance.





Re: SetCustomIcon pointing to local image file does not work in v5

Igorr

Hi.

I have exactly the same problem, did you find the solution to this problem





Re: SetCustomIcon pointing to local image file does not work in v5

Lonifasiko

Just try what Mike said two posts above.

Regards.





Re: SetCustomIcon pointing to local image file does not work in v5

E Renken

I tried this and I keep getting the little red X square box saying it can't find my image. I know this image is correct. I can take the path and put it in my Start...Run and the image comes up. I have tried this in V5 and V6.

Here is my code:

Code Block
function DisplayPushPin( sTitle, sDesc, latlong )
{
shape = new VEShape(VEShapeType.Pushpin, latlong);
if ( shape != null )
{
shape.SetTitle( sTitle );
shape.SetDescription( sDesc );
shape.SetCustomIcon("file://C:\DOCUME~1\ERICRE~1\LOCALS~1\Temp\Exaktime\MashUp\Jobsite.png");
map.AddShape(shape);
points[siteIndex++]=latlong;
}
window.external.NextRecord();
}file://C:\DOCUME~1\ERICRE~1\LOCALS~1\Temp\Exaktime\MashUp\Jobsite.png">file://C:\DOCUME~1\ERICRE~1\LOCALS~1\Temp\Exaktime\MashUp\Jobsite.png");
map.AddShape(shape);
points[siteIndex++]=latlong;
}
window.external.NextRecord();

}

Any help would be appriciated.





Re: SetCustomIcon pointing to local image file does not work in v5

Mike Priven

Try with 3 forward slashes after file (i.e. file:///) and if that's not enough, change other backward slashes to forward slashes.

If that doesn't work, maybe 8-char folder clipping is a problem. Try putting the file under c:\temp and see if that works. If so, replace clipped folders with full names. Maybe that's the problem.




Re: SetCustomIcon pointing to local image file does not work in v5

E Renken

Thanks, the problem was the \ in the path I changed them to / and it worked fine.

Thanks, again.

Eric