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, 6 Dec 2011 18:37:53
Topic: New BlackBerry sample app
See more news »

About MapPos and WgsPoint

10 replies [Last post]
matthewlcy
User offline. Last seen 2 years 6 days ago. Offline
Joined: 08/24/2009

Hi all, I found that there is a way to convert a WgsPoint to its MapPos using the "getMapPosition" method in BasicMapComponent.

But it seems that there is no function to convert the MapPos back to WgsPoint in BasicMapComponent/MapComponent. I would like to ask is there any solution to convert MapPos to WgsPoint to do such thing?

Besides, I saw that the "getMapPosition" method is "not part of public API". Does it means I need to do somethings to make this function works on my blackberry device? Thank you.

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

try:

 map.getMap().mapPosToWgs(mapPos).toWgsPoint();

/JaakL

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

ps. "not part of public API" means that this method can change in future versions, even through you can use it and probably it also works fine. On some platforms (J2ME) these non-public methods are also obfuscated, so you will not find them so easily, on some others (RIM, Android) we cannot obfuscate them.

Public method for similar function should be

map.getMap().wgsToMapPos(new WgsPoint(-71.023865,42.416867).toInternalWgs(),zoom);

Note that these conversions are using current map service, so result depends on map projection.

Can you please also describe for what exactly do you need these methods. Usually we expect that you do not need to see or manipulate pixel space coordinates, and most features can be done some other way with less coding, using custom placemarks, labels etc.

/JaakL

matthewlcy
User offline. Last seen 2 years 6 days ago. Offline
Joined: 08/24/2009

Actually, I want to calculate the latitude and longitude difference in one pixel in difference zoom level. I found that I have went to a wrong way to do the calculation and I have find a better solution to do so. Anyway, thanks for your help.

I want to ask one more question, now I'm using the OpenStreetMap, is there any ways to take away the "OpenStreetMap" watermark on the map?

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

To remove OpenStreetMap try something like:
map.setmap(new OpenStreetMap(new StringCopyright(""),"http://tile.openstreetmap.org/",256,0,19));

For what do you really need it? Maybe you want scalebar line to the map?

/JaakL

matthewlcy
User offline. Last seen 2 years 6 days ago. Offline
Joined: 08/24/2009

For example, I create the map using the WgsPoint(x, y) with screen width "i" and screen height "j". I want to add a place on the map at the point (x+i/4, y+j/5) without knowing the WgsPoint of the place. So, I need to know the latitude and longitude difference in one pixel in difference zoom level.

matthewlcy
User offline. Last seen 2 years 6 days ago. Offline
Joined: 08/24/2009

Now, I need to draw some lines on the map and regularly update the lines. Therefore, I created a timertask to call "removeLines" and "addLines" functions at a fixed interval, let's say 5 seconds.
The timertask works fine in the first 5 seconds, and then throw a NullPointerException in the next five seconds.
I'm wondering why this is happened. Will calling the "addLines" function immediately after calling the "removeLines" function create this problem? Or maybe the error was created by my own code. Thank you.

tourismradio
User offline. Last seen 1 year 49 weeks ago. Offline
Joined: 03/24/2009

Perhaps I shouldn't be replying in this thread, but I have a similar issue with the lines.

If I want to add another point to a line, I remove the line, add my new point to the list points for the line, and then add the new line.

It works without issue for a while and then throws null pointer exceptions.

matthewlcy
User offline. Last seen 2 years 6 days ago. Offline
Joined: 08/24/2009

I fixed the problem, you should better lock the map component first before you draw lines or remove lines on it.

parthi2929
User offline. Last seen 2 years 4 weeks ago. Offline
Joined: 07/26/2009

Hi
Can you please share how to calculate per pixel lat,lon distance at a particular zoom level.

Parthiban Rajendran