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.3k23553


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.

permanent link

answered 12 Aug '11, 09:17

RM87's gravatar image

RM87
3.3k23553
accept rate: 22%

edited 12 Aug '11, 09:20

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×115

question asked: 12 Aug '11, 02:37

question was seen: 4,037 times

last updated: 12 Aug '11, 09:20

powered by OSQA