Map API

Nutiteq Maps Lib SDK enables developing advanced mobile mapping applications.
Platforms: Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

» View demos
» Downloads

Latest news

Last at Tue, 3 Apr 2012 23:31:42
Topic: MapXT SDK evaluation
See more news »

Open map with current city where i am and navigation map

5 replies [Last post]
zakirhussain49
User offline. Last seen 2 weeks 2 days ago. Offline
Joined: 01/02/2012

Hello jaak,

1. After the login in our app ,i want the map come with our current city or current location where i am

2. when i click on current location it will show my location but we can't navigate the map
"The below code i use for current location"

if (System.getProperty("microedition.location.version") != null)
{
final LocationSource dataSource = new LocationAPIProvider(3000);
try
{
final Image gpsPresentImage = Image.createImage("/gps_marker_green.png");
final Image gpsConnectionLost = Image.createImage("/gps_marker_brown.png");
final LocationMarker marker = new NutiteqLocationMarker(new PlaceIcon(gpsPresentImage, 4, 16), new PlaceIcon(gpsConnectionLost, 4, 16), 3000, true);
dataSource.setLocationMarker(marker);
mapComponent.setLocationSource(dataSource);
}
catch (final IOException e)
{
}
}

so can you tell me how i achieve this two task please reply me as soon as possible

Thanks & Regards
Zakir Hussain

jaak
User offline. Last seen 15 hours 29 min ago. Offline
Joined: 06/19/2008

LocationSource (dataSource in your case) has method addLocationListener(LocationListener). So you should implement a LocationListener class and add it to your dataSource. then LocationListener method setLocation(WgsPoint) which will get location updates. In this method you can call map.setMiddlePoint(WgsPoint) to recenter map with the first received location fix. Note: this fix could take some time, even few minutes (depending on satellite visibility etc).

/JaakL

zakirhussain49
User offline. Last seen 2 weeks 2 days ago. Offline
Joined: 01/02/2012

Hello jaak,

I use below code to navigate the map but i still face the same problem
please provide your suggesstion

if (System.getProperty("microedition.location.version") != null)
{
final LocationSource dataSource = new LocationAPIProvider(3000);
try
{
final Image gpsPresentImage = Image.createImage("/gps_marker_green.png");
final Image gpsConnectionLost = Image.createImage("/gps_marker_brown.png");
final LocationMarker marker = new NutiteqLocationMarker(new PlaceIcon(gpsPresentImage, 4, 16), new PlaceIcon(gpsConnectionLost, 4, 16), 3000, true);
dataSource.setLocationMarker(marker);
mapComponent.setLocationSource(dataSource);
dataSource.addLocationListener(new LocationListener()
{
public void setLocation(WgsPoint p)
{ marker.updatePosition();
mapComponent.setLocationSource(dataSource);
}
});

}
catch (final IOException e)
{
}
}

Thanks & Regards
Zakir Hussain

jaak
User offline. Last seen 15 hours 29 min ago. Offline
Joined: 06/19/2008

Probably what happens here is that you get recentered with every GPS measurements, so if user navigates map away, it will jump back automatically. You should make sure that if map is recentered with "My location" only once, unless user really wants to get "automatic gps tracking". I know it could be a bit tricky to get properly working.

/JaakL

jaak
User offline. Last seen 15 hours 29 min ago. Offline
Joined: 06/19/2008

Probably what happens here is that you get recentered with every GPS measurements, so if user navigates map away, it will jump back automatically. You should make sure that if map is recentered with "My location" only once, unless user really wants to get "automatic gps tracking". I know it could be a bit tricky to get properly working.

/JaakL

zakirhussain49
User offline. Last seen 2 weeks 2 days ago. Offline
Joined: 01/02/2012

Thanks Jaak for your suggestion

Thanks & Regards
Zakir Hussain