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

Latest news

Last at Mon, 6 Sep 2010 12:27:06
Topic: Let your feedback ideas flow
See more news »

Nutiteq on Twitter

12 weeks 2 days ago Nutiteq is proud sponsor of StateOfTheMap 2010 #sotm10

Can't show map of Indonesia

2 replies [Last post]
Amri Shodiq
User offline. Last seen 12 weeks 2 days ago. Offline
Joined: 04/03/2010

Hi everybody,
I've tried Nutiteq SDK. It's work really good when I wrote the code pretty similar to the sample found in the tutorial. But after I edit the latitude and longitude to point to my address at Jakarta, I just found blank white and blue color. No map there.

I then checked OpenStreetMap to see wether my city is supported or not. I found Jakarta is under their coverage. So it should works.

Here is my code:

package com.betterb.bmap;

import com.betterb.bmap.view.MapField;
import com.nutiteq.components.WgsPoint;
import com.nutiteq.controls.ControlKeys;
import com.nutiteq.controls.UserDefinedKeysMapping;
import com.nutiteq.net.DefaultDownloadStreamOpener;

import net.rim.device.api.system.Display;
import net.rim.device.api.ui.MenuItem;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.component.Menu;
import net.rim.device.api.ui.component.SeparatorField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

public class BMapScreen extends MainScreen {

VerticalFieldManager fieldManagerMiddle;
private LabelField title;
private MapField map;
private final UserDefinedKeysMapping keysMapping = new UserDefinedKeysMapping();

private final int SCREEN_WIDTH = Display.getWidth();
private final int SCREEN_HEIGHT = Display.getHeight();

public BMapScreen(String title) {
// set screen's title
this.title = new LabelField(title, LabelField.ELLIPSIS |
LabelField.USE_ALL_WIDTH);
setTitle(this.title);

fieldManagerMiddle = new VerticalFieldManager();
add(new SeparatorField());
add(fieldManagerMiddle);

// create map field
map = new MapField(
"Map",
"tutorial",
"Nutiteq",
"proovin",
SCREEN_HEIGHT,
SCREEN_HEIGHT,
// new WgsPoint(-71.023865, 42.416857), // -6.2333, Longitude: 106.816
new WgsPoint(-6.2333000, 106.81600),
// 12
4
);

// set how to handle with keys O for zoom out and I for zoom in
keysMapping.defineKey(ControlKeys.ZOOM_OUT_KEY, 79); // 79 is ascii for O
keysMapping.defineKey(ControlKeys.ZOOM_IN_KEY, 73); // 73 is ascii for I

map.setControlKeysHandler(keysMapping);

// setting how to download the map's tiles
map.setDownloadStreamOpener(new DefaultDownloadStreamOpener(";deviceside=true"));
map.startMapping();

fieldManagerMiddle.add(map);

}

protected void makeMenu(Menu menu, int instance) {
menu.add(close);
}

private MenuItem close = new MenuItem("Close", 110, 10) {
public void run() {
onClose();
}
};

public boolean onClose() {
Dialog.alert("Thanks for using.");
map.stopMapping();
System.exit(0);
return true;
}
}

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

You have longitude and latitude values swapped: correct order in WgsPoint should be lon, lat. For Jakarta: new WgsPoint(106.81600,-6.2333000)

/JaakL

Amri Shodiq
User offline. Last seen 12 weeks 2 days ago. Offline
Joined: 04/03/2010

Aaah, I see. It make sense now. I didn't read the Javadoc. Thanks for your quick reply Jaak.