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

Different map sources

58 replies [Last post]
jaak
User offline. Last seen 6 hours 40 min ago. Offline
Joined: 06/19/2008

Following are the Java ME code examples to use different map sources usign MGMaps Lib SDK. Map image previews are here. Pre-requirement for all is that new MapComponent or MapItem object called map is created.

  • OpenStreetMap Mapnik tiles from tile.openstreetmap.org. Used by default if MapItem or MapComponent constructor is used. If you use BasicMapComponent, or need to change map type later, use:
    map.setMap(OpenStreetMap.MAPNIK);
  • CloudMade 64-pixel (mobile) tiles using style number 1279 with direct access, no streaming:
    map.setMap(new CloudMade("YOUR-CLOUDMADE-KEY", 
       64, 1279));
  • CloudMade 128-pixel (mobile) tiles using style number 1279 with streaming using Nutiteq's streaming proxy, in zoom range 0-19:
    map.setMap(new NutiteqStreamedMap(
       "http://aws.nutiteq.com/mapstream.php?cmkey=YOUR-CLOUDMADE-KEY&ts=128&",
       "CloudMade", 128, 0, 19));
  • Bing maps (a.k.a. MSN Live or Virtual Earth maps) map tiles, using direct tile access (256-pixel tiles, no streaming):
    map.setMap(new QKMap("Bing","http://ecn.t1.tiles.virtualearth.net/tiles/r",256,0,19,".png?g=461&mkt=en-us&shading=hill&n=z"));
  • Bing Hybrid aerials map tiles, using direct tile access (256-pixel tiles, no streaming) and generic Quad-key map service of the library:
    map.setMap(new QKMap("Microsoft",
      "http://ecn.t2.tiles.virtualearth.net/tiles/h", 256,
      1,17, ".jpeg?g=321&mkt=en-us"));
  • Blom Urbex aerial images, using direct tile access (256-pixel tiles, no streaming), view from north:
    map.setMap(new BlomOrthoMap("YOUR-BLOM-KEY",
       BlomOrthoMap.NORTH));
  • Blom Urbex aerial images, using direct tile access (256-pixel tiles, no streaming), orthogonal view from top, street network overlay is added:
    GeoMap blom = new BlomOrthoMap("YOUR-BLOM-KEY",
        BlomOrthoMap.ORTHO);
    blom.addTileOverlay(new 
       BlomStreetsOverlay("YOUR-BLOM-KEY"));
    map.setMap(blom);
  • DigitalGlobe satellite images, using direct tile access (256-pixel tiles, no streaming), OpenStreetMap semi-transparent street network overlay is added to create "hybrid" map:
    GeoMap mapdg = new DigitalGlobeMap("YOUR-DG-KEY");
    mapdg.addTileOverlay(new OsmOverlay());
    map.setMap(mapdg);
    
  • DigitalGlobe satellite images, using streaming (64-pixel tiles) via Nutiteq's proxy; zoom levels 0-21:
    map.setMap(new NutiteqStreamedMap(
       "http://aws.nutiteq.com/dgstream.php?key=YOUR-DG-KEY&",
       "DigitalGlobe", 64, 0, 21));
    
  • OpenAerialMap satellite images, using direct tile access (256-pixel tiles, no streaming), zoom levels 1-19:
    map.setMap(new OpenAerialMap(1,19));
    
  • NAVTEQ MapTP maps, using direct quadtree API tile access (256-pixel tiles, no streaming):
    map.setMap(new NavteqMapTP("YOUR-MAPTP-KEY"));
    
  • OpenStreetMap bundled map tiles, put to JAR file (256-pixel tiles), zoom levels 1-11:
    map.setMap(new JaredOpenStreetMap(256, 1, 11));
    
  • WMS map service loaded as map tiles (256-pixel tiles, no streaming), zoom levels 1-11; data source is ICEDS - Integrated CEOS European Data Server by UCL, layers Blue Marble 1km, countries and cities, using EPSG:4326 projection. Note that the WidthHeigthRatio=2.0 statement is needed to get proper LongitudeLatitude (EPSG:4326) projection, where "the world" (zoom level=0) proportions are 1/2 (360x180 degrees: -180,-90 to 180,90). If you set the value to 1.0 (default value), then "the world" will be square (-180.0,-180.0 to 180.0,180.0), and this is compatible with the Sperical Mercator, but WMS server must support this distortion in server-side. E.g. UMN MapServer (and services with it, including ICEDS) is known to support this. Also note that depending on parameters some tile coordinates could be outside of your map bounds and invalid tiles may come due to that.
    SimpleWMSMap wms = new SimpleWMSMap(
       "http://iceds.ge.ucl.ac.uk/cgi-bin/icedswms?VERSION=1.1.1&SRS=EPSG:4326",
       256, 0, 18,"bluemarble,cities,countries", "image/jpeg",
       "default", "GetMap", "© UCL");
    wms.setWidthHeightRatio(2.0);
    mapComponent.setMap(wms);
    

/JaakL

seyi
User offline. Last seen 34 weeks 4 days ago. Offline
Joined: 05/11/2009

Can i use a map from ArcGIS i.e ESRI shapefile

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

Not directly. Currently you would need also a server solution to generate raster map tiles from the Shapefiles: e.g. ESRI ArcIMS, MapServer or some other.

Vector maps in client is something we are working on, it's not yet available. However, in most cases server-based rendering is better, as servers are more powerful and you can get much nicer maps with this approach. Also some map vendors may not allow to distribute their vector data in client side.

/JaakL

amishra
User offline. Last seen 1 year 15 weeks ago. Offline
Joined: 04/23/2009

How do I use My own WMS Map Service? is it enough to use :

SimpleWMSMap wms = new SimpleWMSMap(
"http://iceds.ge.ucl.ac.uk/cgi-bin/icedswms?VERSION=1.1.1&SRS=EPSG:4326",
256, 0, 18,"bluemarble,cities,countries", "image/jpeg",
"default", "GetMap", "© UCL");
wms.setWidthHeightRatio(2.0);
mapComponent.setMap(wms);

Here, "bluemarble,cities,countries" are layers for maps, what should i have to do if i am using my own maps and lets say i don't know the layers. What is the default parameter to write?

I tried to implement with own wms maps but it says the following error:
1. msWMSLoadGetMapParams(): wms server error.
2. Invalid layer(s) given in the LAYERS parameter.

Ajaya

admin
User offline. Last seen 37 weeks 4 days ago. Offline
Joined: 05/08/2008

It seems that your WMS server does not accept request parameters. It could be LAYERS, or also some other parameter. I suggest to check out final URL (using e.g. network monitor or WTK emulator), and try to get it working with changing parameters properly. You can post the final URL here also, so I could take a look.

faisal
User offline. Last seen 44 weeks 4 days ago. Offline
Joined: 04/30/2009

hi,

I'm using SimpleWMSMap, and able to set my Map.
can I give any value other than the default/"" for 'style' parameter,i.e., the seventh one in SimpleWMSMap constructor.

now I'm giving "" , I'm getting BIG letters on my Map. what shall I do to reduce the size of the letters?

admin
User offline. Last seen 37 weeks 4 days ago. Offline
Joined: 05/08/2008

You can use any value what your server accepts. It depends on server implementation and configuration. "Default" is common default value for ArcIMS-based servers, some others prefer empty value here.

amishra
User offline. Last seen 1 year 15 weeks ago. Offline
Joined: 04/23/2009

Hi,

This is my URL that I am requesting:

http://ar22.arbonaut.com/cgi-bin/mapserv.exe?map=D:/webpages_taaka/taaka...

Thank You.

Ajaya

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

I tried following code, and it worked for me. Note that you must use EPSG:4326 and cannot use 3067 like in your example URL. Your server seems to support also EPSG:4326.


SimpleWMSMap wms = new SimpleWMSMap("http://ar22.arbonaut.com/cgi-bin/mapserv.exe?map=D:/webpages_taaka/taaka/wmscapabilities_matintesti_modis.map&VERSION=1.1.1&&SRS=EPSG%3A4326&SERVICE=WMS&",
256, 0, 18, "topo", "image/png","", "GetMap", "");

wms.setWidthHeightRatio(2.0);

map.setMap(wms);

/JaakL

amishra
User offline. Last seen 1 year 15 weeks ago. Offline
Joined: 04/23/2009

Hi,

It worked for me.

Thanks

Ajaya

cricricrina
User offline. Last seen 1 year 12 weeks ago. Offline
Joined: 03/29/2009

If I have a image and I know it's four corner coordinates, is there a chance to use it as a map? It is just a school project so I don't need something accurate.

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

In principle it should be possible. Technically it requires that you convert image to the 256x256 tiles, in specific coordinate system. How do you want to use it, bundled with application (off-line), or using an on-line server? If you can give the image and coordinates then it could give better idea how this could be solved. Maybe we could suggest or provide you tool to do necessary conversions.

/JaakL

cricricrina
User offline. Last seen 1 year 12 weeks ago. Offline
Joined: 03/29/2009

ClujMap
The image is too big to be uploaded (about 10MB).
If I could send it to you on skype would be great. If it's just to put the maps on a local server, It doesn't matter their location (offline or online).
Thank you very much.

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

You can send it to skype user nutiteq. 10MB is too big bundling into application JAR, but it really depends on many factors.

/JaakL

cricricrina
User offline. Last seen 1 year 12 weeks ago. Offline
Joined: 03/29/2009

I wrote to you on skype

Thank you

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

/JaakL

cricricrina
User offline. Last seen 1 year 12 weeks ago. Offline
Joined: 03/29/2009

WOW!!!
I works!
You are realy great!
The only problem is that I don't know why is not loading all the tiles as you could see in the image:
MapMap

Anyway, it should be enough for the project I have. I appreciate your fast replys and I will recomend you wherever I'll have the oppurtunity.

Matrix
User offline. Last seen 1 year 1 week ago. Offline
Joined: 08/21/2009

Hi,
I can't use my own mapserver.

this my sample code.

package com.tutorial;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

import com.nutiteq.MapItem;
import com.nutiteq.maps.*;
import com.nutiteq.components.WgsPoint;
import com.nutiteq.controls.ControlKeys;
import com.nutiteq.components.Place;
import com.nutiteq.components.Line;
import com.nutiteq.components.Point;
import com.nutiteq.components.LineStyle;
import java.io.IOException;

public class HelloMap
extends MIDlet
implements CommandListener {
private Form mMainForm;
private MapItem mapItem;
private Image icon;

public HelloMap() {

mapItem = new MapItem("Map", "tutorial", this, 300, 400, new WgsPoint(69.3234345, 41.234423), 8);
mapItem.defineControlKey(ControlKeys.MOVE_UP_KEY, Canvas.KEY_NUM2);
mapItem.defineControlKey(ControlKeys.MOVE_DOWN_KEY, Canvas.KEY_NUM8);
mapItem.defineControlKey(ControlKeys.MOVE_LEFT_KEY, Canvas.KEY_NUM4);
mapItem.defineControlKey(ControlKeys.MOVE_RIGHT_KEY,Canvas.KEY_NUM6);

SimpleWMSMap wms = new SimpleWMSMap("http://217.29.118.23:8888/cgi-bin/mapserv.exe?map=f:/OSGeo4W/secure_maps/uzbekistan.map&VERSION=5.4.2&&SRS=EPSG%3A4326&SERVICE=WMS&",
256, 1, 15, "", "","", "GetMap", "");

wms.setWidthHeightRatio(2.0);

mapItem.setMap(wms);

mMainForm = new Form("Hello map");
mMainForm.append(new StringItem(null, "Hello, map!\n"));
mMainForm.append(mapItem);

mMainForm.addCommand(new Command("Exit", Command.EXIT, 0));
mMainForm.setCommandListener(this);
}
public void startApp() {
Display.getDisplay(this).setCurrent(mMainForm);
mapItem.startMapping();
// mapItem.addPlace(new Place(1, "Tashkent", icon, 69.3234345,41.334423));
}

public void pauseApp() {}

public void destroyApp(boolean unconditional) {}

public void commandAction(Command c, Displayable s) {
/* String label=c.getLabel();
if(label.equals("OK")){
mapItem.addPlace(new Place(1, "Tallinn", icon, 69.3264580, 41.237420));
}
*/
notifyDestroyed();
}

}

How can use my own mapserver?

Matrix
User offline. Last seen 1 year 1 week ago. Offline
Joined: 08/21/2009

In my project .
following error:
1. msWMSLoadGetMapParams(): wms server error.
2. Invalid layer(s) given in the LAYERS parameter.

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

The SimpleWMSMap() method has parameter layers and you have left it empty. UWM MapServer requires some of the defined layers to be specified in WMS requests.

/JaakL

Matrix
User offline. Last seen 1 year 1 week ago. Offline
Joined: 08/21/2009

I don't know how to set parametr layers.
What this parametrs mean?
Where I can take this parametrs?
Can you send me simples like that examples?

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

It depends on your mapserver configuration. You have the .map file and there are layers. One (or several) of these must be given in the map request also.

/JaakL

kibnelson
User offline. Last seen 8 weeks 3 hours ago. Offline
Joined: 01/08/2010

Hi?
I want to use my own map of a town.
It will be bundled with the application
How do i go about with it?

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

Did you take a look to http://www.nutiteq.com/content/mobile-map-mapcruncher ? Basically you can use MSR Mapcruncher to create map files, then you copy maps (directory Layer_NewLayer from MSR output) to the application /res directory

Code to activate the map would be something like:
mapItem.setMap(new MyQuadKeyMap("/"));

Note that MapCruncher creates map tile images for different zooms, also resampled images. Therefore package from single large image could be quite big (many MB), which could be larger than mobile's limitation. For example I got from 1.1 MB image 10 MB of tiles. You can reduce map package by removing resampled tiles, as SDK 1.1 version can itself resample map for one zoom level.

/JaakL

kibnelson
User offline. Last seen 8 weeks 3 hours ago. Offline
Joined: 01/08/2010

I have used mapcruncher but i still cant get to view the map,the size of the jar file is 1.12MB am only seeing a red image,i dont know what it might be the problem,anybody can help me figure out.

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

The issue is probably in the project setup and code, not in the image. You need to be sure that the map view is centered to the area where you have map. And you need to be sure that tile locations are pointed correctly.

/JaakL

kibnelson
User offline. Last seen 8 weeks 3 hours ago. Offline
Joined: 01/08/2010

The size of my image is 23.3kb can i send it to you

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

Hello,
Can I display the shapefile which I added using Geoserver using hellomap example of MGmaps??

Really appreciate your help!
Thanks in advance!

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

Yes, you can use Geoserver to provide WMS or tile-based map service, use your shapefile as data source in the server, and then Nutiteq library to display the map on mobile.

/JaakL

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

Hi,
I have created shapefiles and displayed it using geoserver. Now, I need to access these layers(shapefiles stored in geoserver) using hello map midlet. How can I dot this..?

Thanks in advance!!

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

GeoServer has WMS API, so the "WMS map service" code snippet example above should give hint. You should just replace parameter values: server and layer names with your server's.

/JaakL

anjana
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/22/2010

hi,
I created a shapefile called 'india shp' in geoserver. I need to view this using the hello map midlet. I tried to follow the "WMS map service" code snippet and my url is: "http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=india-shp&styles=&bbox=68.178,6.734,97.462,37.035&width=494&height=512&srs=EPSG:4326&format=application/openlayers"

but i get an error saying: cannot find symbol
symbol : class SimpleWMSmap
location: class com.tutorial.HellMap
SimpleWMSMap wms = new SimpleWMSmap("http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=india-shp&styles=&bbox=68.178,6.734,97.462,37.035&width=494&height=512&srs=EPSG:4326&format=application/openlayers",256,0,18,"india_st,india_water,india_natural,india_coastline,india_highway,india_ds","image/jpeg","default","GetMap","");
1 error

Can you please let me know the correct code to implement, and debug my error?
thanks in advance!!

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

Perhaps you have not added proper import to the class (import com.nutiteq.maps.SimpleWMSMap;)

/JaakL

anjana
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/22/2010

i have added the import. it works now i am not getting any error.but..
I have posted a part of the code i used in my example below. The layers of my india-shp file are-india_st,india_ds,india_coastline,india_natural,india_water and india_highway.

code:
private MapItem map;
public HellMap() {
SimpleWMSMap wms = new SimpleWMSMap("http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=india-shp&styles=&bbox=68.178,6.734,97.462,37.035&width=494&height=512&srs=EPSG:4326&format=application/openlayers",256,0,18,"india_st,india_water,india_natural,india_coastline,india_highway,india_ds","image/openlayers","","GetMap","");
wms.setWidthHeightRatio(2.0);
map.setMap(wms);
}

can you please let me know if the code written above is correct?

And also, when i execute my example it doesn't give any error, the emulator opens but when i try to launch my application it gives me an exception saying- the application has unexpectedly quit. Contact the application provider to resolve the issue.

I am not able to display the map. I did keep my geoserver started and even tried giving the website address in the emulator but it still gives me the same exception. please tell me where am i going wrong.

thank u!!

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

In this code two specific things looks wrong:

1) Map size in request should be tile size, by default 256 pixels. So instead width=494&height=512 use width=256&height=256
2) Use IP of the map server instead of "localhost". It may work with localhost on (some) emulators, but with real devices and in most emulators "localhost" means phone itself, not your computer host what you probably mean here.

/JaakL

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

Hello,

I and Anjana are working on the same topic. Even I am facing the same problem. I changed the Map size to 256 and used IP address as 127.0.0.1 but its still giving the same exception.

Thanks!

anjana
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/22/2010

hello,
ya..i agree with shamitha.its still giving the same exception....please specify a solution to this problem....
thank u!

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

Hi,
I was trying to figure out why an exception saying-"the application has unexpectedly quit. Contact the application provider to resolve the issue." is getting displayed on an emulator. Then I thought may its because, I have not added the MG maps evaluation key. Can u please tell me where I should include this key.

Thanks in advance!!

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

The exception probably has nothing to do with mapping library, it is general application issue. You can test it by removing (commenting out) map-related lines and check if the app works fine. If you send your project to support@nutiteq.com, we can take a brief look.

MGMaps SDK key should be generated at http://www.nutiteq.com/generate_key.html , and the value should be put to MapItem object constructor parameter. However, if this is wrong then you should see empty map with message something like "license error", and not get exception.

/JaakL

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

Hi,
Thanks for the reply. I tried to take out the comment of the following instruction.
mapItem = new MapItem("Map", "eecca5b6365d9607ee5a9d336962c5344bc292103431f5.83161285", this, 300, 150, new WgsPoint(24.764580, 59.437420), 0);

Now, when i executed the code it dint show an exception but it dint display maps from geoserver.

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

This is the entire code:

package com.tutorial;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import com.nutiteq.MapItem;
import com.nutiteq.maps.*;
import com.nutiteq.maps.SimpleWMSMap;
import com.nutiteq.components.WgsPoint;
import com.nutiteq.controls.ControlKeys;

public class HelloMap
extends MIDlet
implements CommandListener {
private Form mMainForm;
private MapItem mapItem;
public HelloMap() {
mapItem = new MapItem("Map", "eecca5b6365d9607ee5a9d336962c5344bc292103431f5.83161285", this, 300, 150, new WgsPoint(24.764580, 59.437420), 0);
SimpleWMSMap wms = new SimpleWMSMap(
"http://127.0.0.1:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=india:india_st&styles=&bbox=68.359,6.734,97.462,37.035&width=491&height=512&srs=EPSG:4326&format=application/openlayers",
256, 0, 18,"layer_st", "image/jpeg",
"default", "GetMap", "");

wms.setWidthHeightRatio(2.0);
mapItem.setMap(wms);

mMainForm = new Form("Hello map");
}
public void startApp() {
mMainForm.append(new StringItem(null, "Hello, map!\n"));

mapItem.startMapping();
mapItem.defineControlKey(ControlKeys.MOVE_UP_KEY,Canvas.KEY_NUM2);
mapItem.defineControlKey(ControlKeys.MOVE_DOWN_KEY, Canvas.KEY_NUM8);
mapItem.defineControlKey(ControlKeys.MOVE_LEFT_KEY, Canvas.KEY_NUM4);
mapItem.defineControlKey(ControlKeys.MOVE_RIGHT_KEY, Canvas.KEY_NUM6);
mapItem.defineControlKey(ControlKeys.ZOOM_IN_KEY, Canvas.KEY_POUND);
mapItem.defineControlKey(ControlKeys.ZOOM_OUT_KEY, Canvas.KEY_STAR);
mMainForm.append(mapItem);
mMainForm.addCommand(new Command("Exit", Command.EXIT, 0));
mMainForm.setCommandListener(this);
Display.getDisplay(this).setCurrent(mMainForm);
mapItem.startMapping();
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c, Displayable s) {
notifyDestroyed();
}
}

anjana
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/22/2010

Hi
i tried commenting out the lines as you have specified...but as shamita said, it does not display the map..and also, the emulator specifies whether to access the airtime or not..but since ours is an offline server we shouldn't be accessing the network..and even if we specify the 'yes' option,it displays a blank page with no map.

Can you please look at the code above and give us a solution...its a college project and we have to demonstrate the completed project next week. We have configured the server, understood the client side and tried it with online openstreet maps,but we need to integrate these two in order to complete the project....so...
thank you.....

anjana
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/22/2010

hello again

i just needed to know whether we need to publish our geoserver on the internet in order to access the shapefiles present in them using the SimpleWMSMap constructor, for map display. i.e., do we have to put our geoserver on the internet using a domain name or iP address?and use this iP of the geoserver in our uRL provided in the constructor of the SimpleWMSMap?

thanks in advance!!

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

Yes, the geoserver has to be accessable at least from thenetwork where is client device (emulator or actual phone).

/JaakL

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

Hello,
The geoserver which we have configured has to run in offline mode in localhost. We have to access this using the hellomap application. We used the code for the simple wms map as mentioned above. But it is not working. We even tried giving ip address as 127.0.0.1. We also tried giving my computers ip address which accesses internet. But we keep getting an error saying "Network Error".

This is the code snippet:

mapItem = new MapItem("Map", "eecca5b6365d9607ee5a9d336962c5344bc292103431f5.83161285", this, 300, 150, new WgsPoint(24.764580, 59.437420), 0);
SimpleWMSMap wms = new SimpleWMSMap(
"http://172.16.0.207:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=india:india_st&styles=&bbox=68.359,6.734,97.462,37.035&width=491&height=512&srs=EPSG:4326&format=application/openlayers",
256, 0, 18,"layer_st", "image/jpeg",
"default", "GetMap", "");
wms.setWidthHeightRatio(2.0);
mapItem.setMap(wms);

Can you please give us the actual code to implement this.

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

You use WTK emulator? What does HTTP monitor of it shows?

/JaakL

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

Yes. We use Java ME SDK version 3. It has emulator with CLDC configuration.
When we run the application on emulator, it shows network error, even though Geoserver is started.

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

There could be many reasons for networking to fail: wrong IP, firewall, proxy config, blocked ports etc. None of these has anything to do with this thread (different map sources).

You need two network connections: to your map server and to Internet (SDK makes also request to lbs.nutiteq.com). This could also give networking errors.

/JaakL

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

Hello,
Solved the problem. Map is getting displayed in the emulator now. But the whole map is not getting displayed. In goeserver, when maps are displayed using openlayers, there is automatic zooming and panning on the displayed map. In midlet we have used png format so in emulator, panning works fine as we had coded in the hello map midlet. But we are not able to view the zoomed maps.
Do we need to use any other tool such as map- cruncher??

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

You have to define action buttons for zoom in and zoom out, then it should work. In MapItem there are default keys 1 and 3 for ths.

/JaakL

shamitha
User offline. Last seen 13 weeks 1 day ago. Offline
Joined: 04/11/2010

Thanks for the reply!!We have defined the action buttons for zoom in and zoom out. We have used zoom-in:KEY_POUND and zoom-out:KEY_STAR.
We have two problems:
1.Map is not getting loaded fast. So should we use RMSCache or streamed maps as a solution for this?
There is a caching technique in geoserver called GeoWebCache. GeoWebCache works as a proxy between your client(emulator) and GeoServer.
So in order to use this, it is specified that we have to use:
http://example.com:8080/geoserver/gwc/service/wms
instead of this:
http://example.com:8080/geoserver/wms

But when we used this in SimpleWmsMap constructor it is not loading the map, instead displays red tiles.
2.Zooming option is not working. When map is zoomed it gives blurred image rather than displaying subsequent layer details.

Can you please specify the solution for this.