Specifying locations on a map

You can specify a location on a map by using the MapPoint class that is provided in the net.rim.device.api.lbs.maps.model package. MapPoint represents the geographical coordinates (latitude and longitude) for a location. You can use MapPoint to focus the map view to display a specific location (for example, you can set the center location for the map).

Your application can display a marker icon to identify a location on a map by using the MapLocation class. MapLocation is an extension of MapPoint. MapLocation represents the geographical coordinates (latitude and longitude), a label, and a description for the location and generates a marker icon (a red pushpin) for the location. You can use MapLocation to provide a point of interest on a map for a specified latitude and longitude (for example, a city). The map displays a marker icon and a label (for example, "Waterloo") for the location. When the user clicks the location, the description for the location (for example, "This is Waterloo") appears on a separate details screen.

This screen shows the elements described in the following code sample.

Code sample: Specifying a location by using the MapLocation class

MapLocation location = new MapLocation(43.46518, -80.52237, "Waterloo", "This is Waterloo");
Previous topic: Custom maps

Was this information helpful? Send us your comments.