[Users] BaseMap Definition in GeoExplorer

ELKHATTABI Imane imanekhtb at gmail.com
Mon May 18 14:11:37 CEST 2015


Thank you Christian for replying ,

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)

When I deleted the  'Global Imagery base map' and set my wms layer  in this
case as a base map  .it works fine.
However , as you mentioned OSM requiers EPSG:900913 , but my wms layers are
set in EPSG:4326.

Using the same structure  definition of the basemap layer in the code above
 (in  GeoExlporer.js) , Is there a way to reproject all the layers to 4326
and still work with OSM?

Thanks in advance
ᐧ

2015-05-18 8:41 GMT+02:00 Christian Mayer <chris at meggsimum.de>:

> Hi,
>
> 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.
> 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.
>
> Cheers,
> Chris?
> --
> Christian Mayer, Dipl.-Ing. (FH)
> GIS-Spezialist & Softwareentwickler
>
> meggsimum.de
> Hauptstraße 165a
> 67125 Dannstadt-Schauernheim
> Mail: chris at meggsimum.de
> Web: www.meggsimum.de
>
>
> Am 16. Mai 2015 01:59:22 MESZ, schrieb ELKHATTABI Imane <
> imanekhtb at gmail.com>:
>>
>> Thank you so much Chris for replying.
>> These samples work  fine with my wms layer.
>>
>> However, I'm using GeoExlporer.js that creates the mapLayout with the
>> layers and other functionalities.
>> Is there a way I can define a base map like OSM with this structure :
>>
>> 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
>>                     }
>>                 )
>>
>>
>>             ]
>>         });
>>
>> 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?
>>
>>
>>
>>>>
>> 2015-05-15 20:49 GMT+02:00 Christian Mayer <chris at meggsimum.de>:
>>
>>>   Hi,
>>>
>>>  please check the OpenLayers examples [1] and [2] which show the
>>> integration of Google Maps or  OSM to your map.
>>>
>>>  Cheers,
>>>  Chris
>>>
>>>  [1] http://dev.openlayers.org/examples/google.html
>>>  [2] http://dev.openlayers.org/examples/osm.html
>>>
>>>
>>>  ELKHATTABI Imane <imanekhtb at gmail.com> hat am 15. Mai 2015 um 11:37
>>> geschrieben:
>>>
>>>  Hello everyone,
>>>
>>>  I'd like to know how to define 'Open Street Map' as basemap in the
>>> function GeoExplorer.js
>>>
>>>   createLayout:function(){
>>>  this.map=new OpenLayers.Map({
>>>  ....
>>>  });
>>>
>>>  layers: [
>>>
>>>  //=========base layer
>>>
>>>  new OpenLayers.Layer.WMS(
>>>  "Global Imagery (vmap) [Online]",
>>>  "http://labs.metacarta.com/wms/vmap0",
>>>  {
>>>  layers: "basic",
>>>  transparent: "true",
>>>  format: "image/png"
>>>  },
>>>  {isBaseLayer: true, visibility: false}
>>>  ),
>>>  new OpenLayers.Layer.WMS("Global Imagery (OpenGeo) [Online]",
>>>  "http://maps.opengeo.org/geowebcache/service/wms", {
>>>  layers: "bluemarble"
>>>  },{
>>>  //buffer: 0,
>>>  isBaseLayer: true,
>>>  visibility: false
>>>  }
>>>  )
>>>  ]
>>>  });
>>>
>>>
>>>  Instead of 'Global Imagery' base map, I'd like to use 'OpenStreetMap'
>>> or 'Google Maps'.
>>>
>>>  Any hint or help would be highly apreciated.
>>>  Thanks in advance
>>>>>>  _______________________________________________
>>> Users mailing list
>>> Users at geoext.org
>>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>>
>>
>>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20150518/58ea44bc/attachment.htm 


More information about the Users mailing list