Is there a way to use a Bing client token with a VirtualEarthOverlay? I've searched the forums and the web to no avail - all the Bing documentation seems to pertain solely to using a VEMap, and I can't find any mention of using a Bing client token in the ThinkGeo documentation.
Using ThinkGeo VirtualEarthOverlay with client token
Adam,
The VirtualErathOverlay is just a wrapper for VirtualEarth JavaScript API. In other word, the WebEdition just uses the Virtual JavaScript API to request the online image server. To request the images normally, we need a clientToken and key via VEMap.SetCredentials and VEMap.SetClientToken methods following the MSDN, but It seems that the image request works fine if we don’t set the values.
Here is the references about VirtualEarth msdn.microsoft.com/en-us/library/bb429586.aspx . Please have a look at it.
Thanks,
Johnny
If other services need a client token, please use VEMap.SetCredentials and VEMap.SetClientToken methods.
Thanks,
Johnny
Is there a way to do this on the server side? We do not want to expose the token to users.
Adam,
Maybe it’s hard for VirtualEarthOverlay, which is just a wrapper for VE JavaScript library, even if we add some properties on server side, it still needs to transform them to client side. Could you let us know what your scenarios are? If you just want VE web services, such as routing, geocoding etc, I think you can add WebReferences, and then do your own logic on the VirtualEarthOverlay following services’ instruction.
Another workaround is that you can use MicrosoftMapLayerExtentsion, which is just a server side library in MapSuiteCore.dll, but it’s less efficient than VirtualEarthOverlay for requesting images.
Any questions please let us know. Thanks.
Johnny
How do you expose the underlying VEMap objects so that SetClientToken can be called and token events can be handled?
Adam,
You can get the bing map object in OnMapCreated function, and then do what you want. Please try the code below:
<script language="javascript" type="text/javascript">
var OnMapCreated = function(map) {
var veMap = map.getLayer("VirtualEarth Map");
var bingObject = veMap.mapObject; // the bing map object in VirtualEarth JavaScript liberary
// Set the token
veMap.SetClientToken(".....");
}
</script>
Thanks,
Johnny
<script language="javascript" type="text/javascript">
var OnMapCreated = function(map) {
var veMap = map.getLayer("VirtualEarth Map");
// the bing map object in VirtualEarth JavaScript liberary
var bingObject = veMap.mapObject;
// Set the token
bingObject.SetClientToken( "....."); }
Thank you for all your help, Johnny.
Adam.You are welcome.