Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
My Carrier: Airtel

how to draw route in mapfield in blackberry maps

[ Edited ]

is it possible to draw the route in mapfield if i pass the longitude and latitude coordinates to it?

i want to draw route onto the blackberry maps using mapfield.

 if yes how . any sample snippet or link.

Swapnil G.
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: how to draw route in mapfield


you write this type so you get rout for two point ok.



<location y='4326000' x='-8030000' label='Kitchener, ON' description='Kitchener, Ontario, Canada' />
<location y='4542349' x='-7569792' label='Ottawa, ON' description='Ottawa, Ontario, Canada' />



Posts: 64
Registered: ‎07-15-2008
My Device: Z10
My Carrier: Rogers

Re: how to draw route in mapfield

I belive the GetRoute code only works when you invoke the Maps app, for some reason it does not work for embeded MapFields.

Posts: 122
Registered: ‎09-15-2010
My Device: BB - 9800

Re: how to draw route in mapfield


           may b u can use some third party APIs like which I used in my application, wher u can 

draw route maps if the log and lat are available. Below is the code snippet for the 

same. U can get the third party APIs from the link given below. 




U can get some sample applications and tutorials in the same site.





final WgsPoint[] linePoints = {
              new WgsPoint(77.6268116, 12.9391275),
              new WgsPoint(77.6258544, 12.9388582),
              new WgsPoint(77.6268947, 12.9372689),
              new WgsPoint(77.6209643, 12.9276252),
              new WgsPoint(77.6287249, 12.9242083),
              new WgsPoint(77.6202804, 12.9211575),
              new WgsPoint(77.6227266, 12.9172831),
              new WgsPoint(77.6059923, 12.9166556),
              new WgsPoint(77.6059923, 12.9166556),
              new WgsPoint(77.6062471, 12.9136387),
              new WgsPoint(77.6062015, 12.9073174) };
        // 2. create label for line (optional)
        final PlaceLabel lineLabel = new PlaceLabel("LineLabel");
        // 3. create line itself, declare style
        Line line = new Line(linePoints, new LineStyle(0xFF0000FF, 5), lineLabel);
        // 4. add line to the map