Tell me more ×
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 have a project with 3 layers , I see the layers names in the GetCapabilies and also as WMS layer in QGIS , But in Openlayers I get the tile empty.

I've used the following code :

var P4326 = new OpenLayers.Projection("EPSG:4326");
    var P900913 = new OpenLayers.Projection("EPSG:900913");
    var center = new OpenLayers.LonLat(34.87726678, 32.04670294).transform(P4326, P900913);
    var extent = new OpenLayers.Bounds(34.865,32.042,34.890,32.054).transform(P4326, P900913);
    var zoom = 15;
    var map, layer;

    function init() {           

    var options = {
            controls: [

                    new OpenLayers.Control.Navigation(),
                    new OpenLayers.Control.ScaleLine(),
                    new OpenLayers.Control.PanZoomBar(),
                    new OpenLayers.Control.LayerSwitcher(),                 
                    new OpenLayers.Control.MousePosition()
                ],
        maxExtent: extent,
        restrictedExtent: extent,           
        displayProjection: P4326
    };

    map = new OpenLayers.Map("map",options);
    var layerOptions = { zoomOffset: 11, resolutions: [76.4370282714844, 38.2185141357422, 19.1092570678711, 9.55462853393555, 4.77731426696777, 2.388657133483885, 1.194328566741943, 0.5971642833709715] };
    var base = new OpenLayers.Layer.OSM("Base", "", layerOptions);

     layer = new OpenLayers.Layer.WMS("WMS",
                "http://localhost:8081/qgis/qgis_mapserv.fcgi.exe",
                 {
                    layers: 'Water',
                    format: 'image/png',
                    map: 'D:/OSGeo4W/apps/qgis/bin/MyCity.qgs'
                 }, 
                 {
                    buffer: 1, 
                    isBaseLayer: true,
                    graphicZIndex: 1
                 }
                );

    map.addLayers([base,layer]);    

And only the OSM layer show , when I switch to the WMS , nothing shown.

Any Idea?!

share|improve this question
does it work if you take out the OSM layer? if so it is a projection issue – iant Jan 28 at 12:39
No it doesn't , and it also doesn't work if I use: localhost/qgis/… – Alophind Jan 28 at 13:24

1 Answer

This answer may be late. But you have had the same problem like i did.

Have a look at this:

Having trouble with Webserver configuration on Windows

share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer: please explain why you're recommending it as a solution. Answers that don't explain anything will be deleted. See Good Subjective, Bad Subjective for more information.

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.