MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Setting default distance unit

This is a discussion on Setting default distance unit within the MapPoint Web Service and Virtual Earth forums, part of the Map Forums category; I'm using MapPoint Web Service in a Java J2EE architecture. How do I set the default distance unit to miles ...


Go Back   MapPoint Forums > Map Forums > MapPoint Web Service and Virtual Earth

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-04-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Setting default distance unit

I'm using MapPoint Web Service in a Java J2EE architecture. How do I set the default distance unit to miles in the RouteService CalculateSimpleRoute call?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 06-04-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Here's an example of how to set the header elements in Java:

The following is a code snippet of how you would set the Distance Unit property of
the UserInfoFindHeader and UserInfoRouteHeader. These edits were done to the FindRouteDialog.java
file which is in the 'Java Driving Directions' demo located at
http://demo.mappoint.net/.

try {
String findUrl = staging ? findStagingUrl : findProductionUrl;
findService = new FindServiceLocator().getFindServiceSoap(new
URL(findUrl));
((FindServiceSoapStub) findService).setUsername(userName);
((FindServiceSoapStub) findService).setPassword(password);

//Create a SOAP Header Element and child elements to support setting
the Distance unit for the FindService
SOAPHeaderElement myUserInfoFindHeader = new
SOAPHeaderElement("","UserInfoFindHeader");
MessageElement myDistanceUnit = new MessageElement("","DefaultDistanceUnit");
myDistanceUnit .addTextNode("DistanceUnit.Mile");
myUserInfoFindHeader.addChild(myDistanceUnit);

//Set the header using the SOAP Header Element and children created
above
((FindServiceSoapStub) findService).setHeader(myUserInfoFindHeader);

String routeUrl = staging ? routeStagingUrl : routeProductionUrl;
routeService = new RouteServiceLocator().getRouteServiceSoap(new
URL(routeUrl));
((RouteServiceSoapStub) routeService).setUsername(userName);
((RouteServiceSoapStub) routeService).setPassword(password);

//Create a SOAP Header Element and child elements to support setting
the Distance unit for the Route Service
SOAPHeaderElement myUserInfoRouteHeader = new
SOAPHeaderElement("","UserInfoRouteHeader");
MessageElement myDistanceUnit = new MessageElement("","DefaultDistanceUnit");
myDistanceUnit .addTextNode("DistanceUnit.Mile");
myUserInfoRouteHeader.addChild(myDistanceUnit);

//Set the header using the SOAP Header Element and children created
above
((RouteServiceSoapStub) routeService).setHeader(myUserInfoRouteHeader);

}
catch (Exception e) {
ExceptionDialog.displayException(this, e);
}


Steven Pushee

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2003 Microsoft Corporation. All rights
reserved.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Has anyone had any problems setting the value of t.... Anonymous MapPoint 2006/2009 Discussion 2 10-26-2006 07:43 AM
European Utilities Business Unit Leader florence4000 News and Announcements 0 05-26-2005 05:38 AM
Low cost GPS unit with SDK Anonymous MapPoint 2006/2009 Discussion 4 11-24-2004 08:22 AM
How to change the default country setting neo MapPoint 2006/2009 Discussion 6 08-13-2003 12:29 PM
Setting Speeds aarunprakash MapPoint 2006/2009 Discussion 0 06-06-2003 12:45 PM


All times are GMT -5. The time now is 08:28 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Borovets Ski
Enjoy the stunning scenery of the Rila Mountains when you book a Borovets Ski Holiday in Bulgaria. Holiday Hypermarket makes price comparison between competitors easy.

Best Travel Agent
Travel Counsellors has been named the UK's Best Travel Agent at the Guardian Unlimited Travel awards.

Cuba Holidays
After years of neglect by the western world, Cuba is coming back onto the holiday scene. Cuba Holidays are a unique and enjoyable experience. Book at dealchecker.co.uk.

Holidays in Cyprus
Holidays in Cyprus are enriched by the abundance of churches, ruins and natural wonders. Book a holiday with us today!

Cheap Canaries Holidays
Are you hunting down cheap Canaries holidays? Well check out ulookubook.com to bag a great value holiday. There are numerous festivals taking place all year round. Why not book your holiday around one?

Compare Holidays
Compare holidays online where you can see all the amazing possibilities at Travel.co.uk

Cheap Sharm el Sheikh Holidays
Visit the Red Sea Riviera! Info on cheap Sharm el Sheikh holidays, found at On The Beach.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51