开发者

BlackBerry maps location document with multiple points

When I implement BlackBerry maps in my application using the code from RIM in How To - Invoke BlackBerry Map开发者_StackOverflow社区s, my map works fine with Ontario points, but when I use Latitude 13.083333 and Longitude: 80.283333, it does not work.

What about the dot? On skipping the dot, it shows the incorrect position.

String document = "<lbs>
<location lon='-8030000' lat='4326000' label='Kitchener, ON' description='Kitchener, Ontario, Canada' />
<location lon='-7569792' lat='4542349' label='Ottawa, ON' description='Ottawa, Ontario, Canada' />

";


The right way would be to multiply LAT & LONG by 100,000 and cast it to an integer value, something like this:

    // LAT & LONG times 100,000, converted to integer
    int lon = (int) (80.283333 * 100000);
    int lat = (int) (13.083333 * 100000);

    String label = "Label of point on map";
    String desc = "Description of point when clicked";

    // create the location element
    StringBuffer sb = new StringBuffer();
    sb.append("<location");
    sb.append(" lon='").append(String.valueOf(lon)).append("'");
    sb.append(" lat='").append(String.valueOf(lat)).append("'");
    sb.append(" label='").append(label).append("'");
    sb.append(" description='").append(desc).append("'");
    sb.append(" />");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜