<html><head></head><body>Hi,<br>
<br>
I guess you have a projection issue since the default of an OpenLayers map is EPSG:4326 but you need EPSG:900913 to use OSM. Be sure to set the projection property on your map.<br>
Do you have any error messages in your console (hitting F12 key in your browser)? Please add them to your posts, so it is easier to check what your problem could be.<br>
<br>
Cheers,<br>
Chris?<br>
-- <br>
Christian Mayer, Dipl.-Ing. (FH)<br>
GIS-Spezialist & Softwareentwickler<br>
<br>
<a href="http://meggsimum.de">meggsimum.de</a><br>
Hauptstraße 165a<br>
67125 Dannstadt-Schauernheim<br>
Mail: chris@meggsimum.de<br>
Web: <a href="http://www.meggsimum.de">www.meggsimum.de</a><br><br><div class="gmail_quote">Am 16. Mai 2015 01:59:22 MESZ, schrieb ELKHATTABI Imane <imanekhtb@gmail.com>:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div dir="ltr">Thank you so much Chris for replying.<div>These samples work fine with my wms layer.</div><div><br /></div><div>However, I'm using GeoExlporer.js that creates the mapLayout with the layers and other functionalities.</div><div>Is there a way I can define a base map like OSM with this structure :</div><div><br /></div><div><div style="font-size:12.8000001907349px"><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:12px;vertical-align:baseline;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;word-wrap:normal;color:rgb(51,51,51);line-height:18px;background-color:rgb(238,238,238)"><code style="margin:0px;padding:0px;border:0px;vertical-align:baseline;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans
Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;color:rgb(34,34,34);white-space:inherit">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",
"<a href="http://localhost:8080/geoserver/wms">http://localhost:8080/geoserver/wms</a>", {
layers: "dw1:dim_bts_geo",
transparent: true,
format: "image/gif"
}, {
isBaseLayer: false,
buffer: 0,
visibility: false
}
)
]
});</code></pre><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:12px;vertical-align:baseline;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;word-wrap:normal;line-height:18px"><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;white-space:normal;background-color:rgb(255,255,255)"><font color="#000000">Now that I replaced the basemap by OSM base layer . No map component is showing anymore. the page is just empty. Is there something wrong with the OSM basemap definition?</font></span><font color="#333333"><br /></font></pre><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:12px;vertical-align:baseline;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida
Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;word-wrap:normal;line-height:18px"><span style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;white-space:normal;background-color:rgb(255,255,255)"><font color="#000000"><br /></font></span></pre><pre style="margin-top:0px;margin-bottom:10px;padding:5px;border:0px;font-size:12px;vertical-align:baseline;overflow:auto;width:auto;max-height:600px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,serif;word-wrap:normal;line-height:18px"><br /></pre></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px; max-height:0px;"
src="https://mailfoogae.appspot.com/t?sender=aaW1hbmVraHRiQGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=db68eb2b-3b2f-41a7-a90d-e932796d5ced" /><font color="#ffffff" size="1">ᐧ</font></div></div><div class="gmail_extra"><br /><div class="gmail_quote">2015-05-15 20:49 GMT+02:00 Christian Mayer <span dir="ltr"><<a href="mailto:chris@meggsimum.de" target="_blank">chris@meggsimum.de</a>></span>:<br /><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div>
<div>
Hi,
</div>
<div>
</div>
<div>
please check the OpenLayers examples [1] and [2] which show the integration of Google Maps or OSM to your map.
</div>
<div>
</div>
<div>
Cheers,
</div>
<div>
Chris
</div>
<div>
</div>
<div>
[1] <a href="http://dev.openlayers.org/examples/google.html" target="_blank">http://dev.openlayers.org/examples/google.html</a>
</div>
<div>
[2] <a href="http://dev.openlayers.org/examples/osm.html" target="_blank">http://dev.openlayers.org/examples/osm.html</a>
</div>
<div>
</div>
<div>
</div>
<div>
ELKHATTABI Imane <<a href="mailto:imanekhtb@gmail.com" target="_blank">imanekhtb@gmail.com</a>> hat am 15. Mai 2015 um 11:37 geschrieben:
</div>
<div><div><div class="h5">
<br />
<div dir="ltr">
Hello everyone,
<div>
</div>
<div>
I'd like to know how to define 'Open Street Map' as basemap in the function GeoExplorer.js
</div>
<div>
</div>
<div>
<div style="font-size:12.8000001907349px">
<div>
<span style="color:#0b5394">createLayout:function(){</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>this.map=new OpenLayers.Map({</span>
</div>
<div>
<span><span style="color:#0b5394"> ....</span></span>
</div>
<div>
<span style="color:#0b5394"><span> </span>});</span>
</div>
<div>
</div>
<div>
<span style="color:#0b5394"><span> </span>layers: [</span>
</div>
<div>
</div>
<div>
<span style="color:#0b5394"><span> </span>//=========base layer</span>
</div>
<div>
</div>
<div>
<span style="color:#0b5394"><span> </span>new OpenLayers.Layer.WMS(</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>"Global Imagery (vmap) [Online]",</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>"<a href="http://labs.metacarta.com/wms/vmap0" target="_blank">http://labs.metacarta.com/wms/vmap0</a>",</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>{</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>layers: "basic",</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>transparent: "true",</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>format: "image/png"</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>},</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>{isBaseLayer: true, visibility: false}</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>),</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>new OpenLayers.Layer.WMS("Global Imagery (OpenGeo) [Online]",</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>"<a href="http://maps.opengeo.org/geowebcache/service/wms" target="_blank">http://maps.opengeo.org/geowebcache/service/wms</a>", {</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>layers: "bluemarble"</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>},{</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>//buffer: 0,</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>isBaseLayer: true,</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>visibility: false</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>}</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>)</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>]</span>
</div>
<div>
<span style="color:#0b5394"><span> </span>});</span>
</div>
<div>
<span style="color:#0b5394"> </span>
</div>
<div>
<span style="color:#0b5394"> </span>
</div>
<div>
<span style="font-size:12.8000001907349px">Instead of 'Global Imagery' base map, I'd like to use 'OpenStreetMap' or 'Google Maps'.</span>
<span style="color:#0b5394"><br /></span>
</div>
<div>
<span style="font-size:12.8000001907349px"> </span>
</div>
<div>
<span style="font-size:12.8000001907349px">Any hint or help would be highly apreciated.</span>
</div>
<div>
<span style="font-size:12.8000001907349px">Thanks in advance</span>
</div>
</div>
</div>
<div style="max-height:1px">
<img src="https://mailfoogae.appspot.com/t?sender=aaW1hbmVraHRiQGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=768ef2c0-3c9c-4441-bfa0-f731e6a89a27" border="0" />
<span style="color:#ffffff;font-size:xx-small">ᐧ</span>
</div>
</div></div></div> _______________________________________________
<br />Users mailing list
<br /><a href="mailto:Users@geoext.org" target="_blank">Users@geoext.org</a>
<br /><a href="http://www.geoext.org/cgi-bin/mailman/listinfo/users" target="_blank">http://www.geoext.org/cgi-bin/mailman/listinfo/users</a>
</div>
<div>
<br />
</div>
</div></blockquote></div><br /></div>
</blockquote></div></body></html>