Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

i try to display WMS layer from geoserver with openLayers Mobile,and its working great in the navigator (chrome) but its not appeering in the simulator device (android)...
& with another WMS layer like open street map , its working perfectly in both, web navigator and android device , so i can't figure out where the problem is , its been more then 10 days and i can't handel this problem..

this is my code:

var map;
    OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";

    function init() {
        map = new OpenLayers.Map('map', {
                controls: [
                    new OpenLayers.Control.Navigation(),
                    new OpenLayers.Control.PanZoomBar(),
                    new OpenLayers.Control.LayerSwitcher({'ascending':false}),
                    new OpenLayers.Control.ScaleLine(),                    
                    new OpenLayers.Control.MousePosition()                       
                ]       
            });

            var wms = new OpenLayers.Layer.WMS(
                "OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0",
                {layers: "basic"}
            );

           var osgeo = new OpenLayers.Layer.WMS("OpenLayers WMS",
                "http://vmap0.tiles.osgeo.org/wms/vmap0",
                {layers: 'basic'},
                {isBaseLayer: true, transitionEffect: 'resize'}
            );

          com = new OpenLayers.Layer.WMS(
            "communes",
            "http://localhost:8080/geoserver/wms",
            {layers: 'cite:matcommune_view', format: 'image/gif',transparent: true}
        );

       map.addLayers([osgeo, com]);

map.setCenter(new OpenLayers.LonLat(-104, 42), 3);

im looking forward your help, tks.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

You are adding the layer using the following piece of code:

com = new OpenLayers.Layer.WMS(
            "communes",
            "http://localhost:8080/geoserver/wms",
            {layers: 'cite:matcommune_view', format: 'image/gif',transparent: true}
        );

If you read it carefully, you will see that you are calling it as localhost. Since the device is a different system, you will need to refer to it using a hostname, that is accessible from the virtual device. I usually use the IP address of the server.

Ideally, this application should be visible from outside of your internal network.(For example when you are testing on a real device with a cellular 3G network) For this, you will have to make sure that your Geoserver is accessible from outside. You will then have to give the external IP or the domain name.

share|improve this answer
    
finnaly its works for me.. ichanged "localhost" with my ip adress and its xorking great tks very much Mr.Devdatta Tengshe. this is an exemple : layer = new OpenLayers.Layer.WMS( "States WMS/WFS", "192.168.1.12:8080/geoserver/topp/wms";, {layers: 'topp:states', format: 'image/gif'} ); –  Аюб ибн Ясин May 2 '13 at 18:44
    
I'm glad to help you out. –  Devdatta Tengshe May 3 '13 at 3:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.