Ryan Turney


Hello, I am a young coder with knowledge in C# and C++ and absolutely none in JavaScript but it's on my list! Because of my very limited understanding in JavaScript I am here asking: Is it possible to tweak the User Input block to zoom in on a location using Visual Earth I'm sick of having to zoom in manually every time I push accept.

You will see more of what I'm talking about on my Advanced Construction Finder. My Popfly user name is Pink-Splat, look me up

Thanks





Re: Zooming?

AndyS



With the Advanced Mode of a block and a bit of Javascript it's entirely possible there was a thread on it a while back: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1651710&SiteID=1

Or in your case you can replace the code in the Virtual Earth block with

Code Snippet

data["Virtual Earth"] = new Array();
pendingCalls["Virtual Earth"] = data["Weatherbug"].length;
for (var i=0; i<data["Weatherbug"].length; i++)
{
try
{
data["Virtual Earth"][i] = virtualEarth.addPushpin(data["Weatherbug"][i].latitude, data["Weatherbug"][i].longitude, "", data["Weatherbug"][i].title, data["Weatherbug"][i].description);
pendingCalls["Virtual Earth"]--;
virtualEarth.setMapView(data["Weatherbug"][i].latitude, data["Weatherbug"][i].longitude);

}
catch (ex)
{
pendingCalls["Virtual Earth"]--;
environment.reportErrorInLoop(i, ex);
}
}











Re: Zooming?

DonG2

Howdy Ryan,

Looks like your mashup could still use an auto-zoom, no If yes...

In the User Input block for your mashup, get three fields instead of two. Make the third one a "Zoom Level", or whatever you want to call it, and let the user enter it. You can set any default value you think would be reasonable. It seems that Virtual Earth can use values from 1 to 19 (based on my testing). Then, add a link from User Input directly to Virtual Earth, using the third value for VE's Zoom setting with the setMapView function. I did this in my EarthExplorer mashup (http://www.popfly.ms/users/DonG/EarthExplorer-WebPage) and it seems to work pretty good.

Hope this helps <smile>!