Thank you Stefano,
The code works perfectly with my layer , I set the url path and the center
and it displays my wms layer on the osm basemap.

As for OL version , I'm using OL 2.13 aswell .

Using JS console , I got these bugs :

1- OpenLayers.js: 1052     ->  Uncaught TypeError: Cannot read property '0'
of undefined

Line 1052 containing the error  :


 return
newBounds;},CLASS_NAME:"OpenLayers.Bounds"});OpenLayers.Bounds.fromString=function(str){var
bounds=str.split(",");return
OpenLayers.Bounds.fromArray(bounds);};OpenLayers.Bounds.fromArray=function(bbox){return
new
OpenLayers.Bounds(parseFloat(bbox[0]),parseFloat(bbox[1]),parseFloat(bbox[2]),parseFloat(bbox[3]));};OpenLayers.Bounds.fromSize=function(size){return
new
OpenLayers.Bounds(0,size.h,size.w,0);};OpenLayers.Bounds.oppositeQuadrant=function(quadrant){var
opp="";opp+=(quadrant.charAt(0)=='t')?'b':'t';opp+=(quadrant.charAt(1)=='l')?'r':'l';return
opp;};OpenLayers.Lang={code:null,defaultCode:"en",getCode:function(){if(!OpenLayers.Lang.code){OpenLayers.Lang.setCode();}


2- GET http://localhost:8080/myapp/openlayers/lib/img/blank.gif 404
(Introuvable)

Even if I delete the 'Global Imagery base map' and set my wms in this case
as a base map, I still get the same bugs.

ᐧ

2015-05-15 19:00 GMT+02:00 Stefano Costa <stefano.co...@geo-solutions.it>:

>  Could you try with this minimal code and see if it works?
>
> mappanel-div.html:
>
> <html>
>     <head>
>         <title>GeoExt MapPanel Example</title>
>
>         <script type="text/javascript" src="
> http://extjs.cachefly.net/ext-3.4.0/adapter/ext/ext-base.js";></script>
>         <script type="text/javascript" src="
> http://extjs.cachefly.net/ext-3.4.0/ext-all.js";></script>
>         <link rel="stylesheet" type="text/css" href="
> http://extjs.cachefly.net/ext-3.4.0/resources/css/ext-all.css"; />
>         <link rel="stylesheet" type="text/css" href="
> http://extjs.cachefly.net/ext-3.4.0/examples/shared/examples.css"; />
>         <script src="http://www.openlayers.org/api/2.13/OpenLayers.js
> "></script>
>         <script type="text/javascript" src="./script/GeoExt.js"></script>
>
>         <script type="text/javascript" src="mappanel-div.js"></script>
>
>     </head>
>     <body>
>         <h1>GeoExt.MapPanel with an Existing OpenLayers.Map</h1>
>         <p>This example shows the how to create a MapPanel with a map that
> has
>         already been created.<p>
>         <p>The js is not minified so it is readable. See <a
> href="mappanel-div.js">mappanel-div.js</a>.</p>
>         <div id="mappanel"></div>
>     </body>
> </html>
>
>
> mappanel-div.js:
>
> var mapPanel;
>
> Ext.onReady(function() {
>     var osmLayer = new OpenLayers.Layer.OSM();
>     var overlayLayer = new OpenLayers.Layer.WMS("Overlay",
>  "http://localhost:8080/geoserver/wms";, {
>      layers: "topp:states",
>      transparent: true,
>      format: "image/gif"
>  }, {
>      isBaseLayer: false,
>      visibility: true
>  }
>         );
>
>     var map = new OpenLayers.Map({
>  projection: "EPSG:3857",
>  layers: [osmLayer, overlayLayer]
>     });
>
>     mapPanel = new GeoExt.MapPanel({
>         title: "GeoExt MapPanel",
>         renderTo: "mappanel",
>         height: 400,
>         width: 600,
>         map: map,
>         center: new OpenLayers.LonLat(-87.6315625,
> 41.884362).transform(new OpenLayers.Projection("EPSG:4326"), new
> OpenLayers.Projection("EPSG:3857")),
>         zoom: 3
>     });
> });
>
> You will need to adjust the path to GeoExt.js in the HTML file and the
> layer name in the JS file (and probably the map center coordinates). Please
> note I'm linking OpenLayers 2.13: I initially tried with OL 2.11 but had
> several issues (what version of OL are you using?).
>
> You still didn't tell me if you see any error in the JS console: without
> this info, it is very difficult to tell whether this issue is related to
> GeoServer  or rather to OpenLayers/GeoExt (which I suspect is the case).
>
> --S
>
>
> Il giorno ven, 15/05/2015 alle 15.18 +0200, ELKHATTABI Imane ha scritto:
>
> Thanks Stefano for replying.
>
>
>
>  The Global Imagery base map is showing even if its visibility is false.
> However when I check my wms layer to be displayed on top of it . I get the
> pink tiled image.
>
>  I'm using the projection EPSG:4326.
>
>
>
>  On the other hand , Ideleted the preview base layer and replaced it with
>   OpenStreetMap as a base layer defined like this :
>
>
>
>  this.mapPanel=new GeoExt.MapPanel({
>
>  layout:"anchor",border:true,region:"center",
>
>  map:this.map,
>
>  center:mapConfig.center&&new
> OpenLayers.LonLat(mapConfig.center[0],mapConfig.center[1]),
>
>  zoom:mapConfig.zoom,
>
>  items:[{
>
>  xtype:"gx_zoomslider",
>
>  vertical:true,height:100,
>
>  plugins:new GeoExt.ZoomSliderTip({template:"<div>Zoom Level:
> {zoom}</div>"})},
>
>  this.createMapOverlay()
>
>  ],
>
>  layers: [
>
>
>
>
>
>  //====base layer=====
>
>  new OpenLayers.Layer.OSM("OpenLayers"),
>
>  //=====overlays=====
>
>
>
>  new OpenLayers.Layer.WMS("dim_bts_geo",
>
>  "http://localhost:8080/geoserver/wms";, {
>
>  layers: "dw1:dim_bts_geo",
>
>  transparent: true,
>
>  format: "image/gif"
>
>  }, {
>
>  isBaseLayer: false,
>
>  buffer: 0,
>
>  visibility: false
>
>  }
>
>  )
>
>
>
>  ]
>
>  });
>
>
>
>
>
>  However, No map Component is showing. The page is just empty .
>
>  ᐧ
>
>
>
>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to