This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

two layers - I cannot see the graphical representation on the map

0

People, I need a Help. I have one layer on the Geoserver, called Comp5 into a var wmms (it is a point map) I want to put this layer together with a map from Openstreetmap into a var mapnik.

I'm not seeing both map, but just the Openstreetmap (Mapnik). Why? I would like to see the Map of city (from Openstreetmmap) and the points over the city map.

The code I'm using is the following:

<script type="text/javascript" src="js/OpenLayers/OpenLayers.js"></script>
<script type="text/javascript">
var map;

function init() {

    map = new OpenLayers.Map("basicMap",{projection: new OpenLayers.Projection("EPSG:900913"),
    displayProjection: new OpenLayers.Projection("EPSG:4326"),isBaseLayer:false,visibility: true
    });

    var mapnik = new OpenLayers.Layer.OSM();

    var wms = new OpenLayers.Layer.WMS(
            "Marble Blue",
            "http://localhost:9999/geoserver/wms",
            {layers: 'comp5', transparent:true}//,
    );

     map.addLayer(wms);
     map.addLayer(mapnik);

    map.setCenter(new OpenLayers.LonLat(-46.69320,-23.64665) // Center of the map

        .transform(

      new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984

      new OpenLayers.Projection("EPSG:900913") // to Spherical Mercator Projection

     ), 11 // Zoom level

   );

  }
</script>

Thanks in advance for any help.

Vernei

asked 12 Aug '11, 02:37

vernei's gravatar image

vernei
1111
accept rate: 0%

edited 12 Aug '11, 09:11

RM87's gravatar image

RM87
3.3k23753


One Answer:

2

This question is OpenLayers realted and should go to OpenLayers mailing list or asked on IRC: irc://irc.freenode.net/#openlayers . You have a higher chance to get help from there.

answered 12 Aug '11, 09:17

RM87's gravatar image

RM87
3.3k23753
accept rate: 22%

edited 12 Aug '11, 09:20

Source code available on GitHub .