[Mapbender-dev] [Mapbender] #114: Problem adding WMS dynamically

Mapbender info at osgeo.org
Tue Oct 9 05:09:43 EDT 2007


#114: Problem adding WMS dynamically
----------------------------+-----------------------------------------------
 Reporter:  lieuwe          |       Owner:  mapbender_dev at lists.osgeo.org
     Type:  defect          |      Status:  new                          
 Priority:  major           |   Milestone:                               
Component:  administration  |     Version:  2.4.2                        
 Keywords:  add WMS         |  
----------------------------+-----------------------------------------------
 I have MapBender application where users can add WMS dynamically. Map
 files are generated from user input and geo-data in postgis.
 The MapBender gui is enclosed in a outer iframe (myFrame).
 Everything works ok in MapBender 2.1, but not anymore since we migrated to
 MapBender 2.4.2. We want to make use the extra functionality in MB 2.4.2.

 Here is the javascript code where the WMS is added.
 <script language="javascript">
 function addWMS(caps){
         var oMyFrame=parent.mainCenter.frames['myFrame'];
         var oLoadData=oMyFrame.self.frames['loadData'];
         var oTreeGDE=oMyFrame.self.frames['treeGDE'];
         var oMapframe=oMyFrame.self.frames['mapframe1'];
         url =
 "http://mxs092:8081/mapbender/php/mod_createJSObjFromXML.php?caps=" +
 escape(caps);
         oLoadData.document.location.href = url;
         oTreeGDE.document.location.reload();
         oMapframe.parent.mb_mapObjaddWMS['mapframe1'];
 }
 </script>

 The above code works ok in MB 2.1

 In MB 2.4.2 the following error appears "The property or method is not
 supported by this object".
 The error i think is caused by the call "parent.mod_addWMS_refresh();" in
 the MapBender module mod_createJSObjFromXML.php.
 The parent in this case is the outer iframe which encloses the MapBender
 gui. This iframe does not know the function mod_addWMS_refresh which is
 defined in the javascript mod_addWMSgeneralFunctions.js.
 The function mod_addWMS_refresh in turn calls another function
 mb_mapObjaddWMS defined in map.js, which i think does some housekeeping
 for adding WMS layers to an internal array of WMS objects.

 Can someone tell how i call the external java functions mod_addWMS_refresh
 and mb_mapObjaddWMS outside the MapBender context, for example in a php
 script, where a request is done like
 http://mxs092:8081/mapbender/php/mod_createJSObjFromXML.php?caps=" +
 escape(caps)

-- 
Ticket URL: <http://trac.osgeo.org/mapbender/ticket/114>
Mapbender <http://www.mapbender.org/>
Mapbender


More information about the Mapbender_dev mailing list