← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4280: (GIS) WMS overlay functionality and GUI implemented.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 4280 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-08-11 23:16:48 +0200
message:
  (GIS) WMS overlay functionality and GUI implemented.
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/baselayer.png
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java
  dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml
  dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java
  dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java	2010-11-15 16:26:51 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapLayer.java	2011-08-04 12:28:58 +0000
@@ -39,9 +39,9 @@
 
     private String type;
 
-    private String mapSource;
+    private String url;
     
-    private String layer;
+    private String layers;
 
     private String fillColor;
 
@@ -55,13 +55,13 @@
     {
     }
 
-    public MapLayer( String name, String type, String mapSource, String layer, String fillColor,
+    public MapLayer( String name, String type, String url, String layers, String fillColor,
         double fillOpacity, String strokeColor, int strokeWidth )
     {
         this.name = name;
         this.type = type;
-        this.mapSource = mapSource;
-        this.layer = layer;
+        this.url = url;
+        this.layers = layers;
         this.fillColor = fillColor;
         this.fillOpacity = fillOpacity;
         this.strokeColor = strokeColor;
@@ -135,24 +135,24 @@
         this.type = type;
     }
 
-    public String getMapSource()
-    {
-        return mapSource;
-    }
-
-    public void setMapSource( String mapSource )
-    {
-        this.mapSource = mapSource;
-    }
-
-    public String getLayer()
-    {
-        return layer;
-    }
-
-    public void setLayer( String layer )
-    {
-        this.layer = layer;
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public void setUrl( String url )
+    {
+        this.url = url;
+    }
+
+    public String getLayers()
+    {
+        return layers;
+    }
+
+    public void setLayers( String layers )
+    {
+        this.layers = layers;
     }
 
     public String getFillColor()

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java	2011-07-13 21:01:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java	2011-08-04 12:28:58 +0000
@@ -159,7 +159,7 @@
 
     void updateMapLayer( MapLayer mapLayer );
 
-    void addOrUpdateMapLayer( String name, String type, String mapSource, String layer, String fillColor,
+    void addOrUpdateMapLayer( String name, String type, String url, String layers, String fillColor,
         double fillOpacity, String strokeColor, int strokeWidth );
 
     void deleteMapLayer( MapLayer mapLayer );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2011-08-04 10:06:15 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java	2011-08-04 12:29:20 +0000
@@ -122,6 +122,9 @@
         executeSql( "ALTER TABLE map DROP COLUMN latitude" );
         executeSql( "ALTER TABLE map DROP COLUMN zoom" );
         executeSql( "ALTER TABLE maplayer DROP CONSTRAINT maplayer_mapsource_key" );
+        executeSql( "ALTER TABLE maplayer DROP COLUMN mapsource" );
+        executeSql( "ALTER TABLE maplayer DROP COLUMN mapsourcetype" );
+        executeSql( "ALTER TABLE maplayer DROP COLUMN layer" );
 
         // extended data element
         executeSql( "ALTER TABLE dataelement DROP CONSTRAINT fk_dataelement_extendeddataelementid" );

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2011-07-13 21:01:29 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java	2011-08-04 12:28:58 +0000
@@ -647,7 +647,7 @@
         mappingStore.updateMapLayer( mapLayer );
     }
 
-    public void addOrUpdateMapLayer( String name, String type, String mapSource, String layer, String fillColor,
+    public void addOrUpdateMapLayer( String name, String type, String url, String layers, String fillColor,
         double fillOpacity, String strokeColor, int strokeWidth )
     {
         MapLayer mapLayer = mappingStore.getMapLayerByName( name );
@@ -656,8 +656,8 @@
         {
             mapLayer.setName( name );
             mapLayer.setType( type );
-            mapLayer.setMapSource( mapSource );
-            mapLayer.setLayer( layer );
+            mapLayer.setUrl( url );
+            mapLayer.setLayers( layers );
             mapLayer.setFillColor( fillColor );
             mapLayer.setFillOpacity( fillOpacity );
             mapLayer.setStrokeColor( strokeColor );
@@ -667,7 +667,7 @@
         }
         else
         {
-            addMapLayer( new MapLayer( name, type, mapSource, layer, fillColor, fillOpacity, strokeColor, strokeWidth ) );
+            addMapLayer( new MapLayer( name, type, url, layers, fillColor, fillOpacity, strokeColor, strokeWidth ) );
         }
     }
 

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml'
--- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml	2011-05-28 21:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLayer.hbm.xml	2011-08-04 12:28:58 +0000
@@ -14,9 +14,9 @@
 
     <property name="type" column="type" />
 
-    <property name="mapSource" column="mapsource" />
+    <property name="url" column="url" type="text" />
 
-    <property name="layer" column="layer" />
+    <property name="layers" column="layers" type="text" />
 
     <property name="fillColor" column="fillcolor" />
 

=== modified file 'dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java'
--- dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java	2011-07-13 17:28:22 +0000
+++ dhis-2/dhis-services/dhis-service-mapping/src/test/java/org/hisp/dhis/mapping/MappingServiceTest.java	2011-08-11 21:14:57 +0000
@@ -501,11 +501,5 @@
 
         assertEquals( baseLayers, mappingService.getMapLayersByType( MappingService.MAP_LAYER_TYPE_BASELAYER ) );
         assertEquals( overlayLayers, mappingService.getMapLayersByType( MappingService.MAP_LAYER_TYPE_OVERLAY ) );
-
-        assertEquals( mappingService.getMapLayer( idA ), mappingService.getMapLayerByMapSource( "mapSourceA" ) );
-        assertEquals( mappingService.getMapLayer( idB ), mappingService.getMapLayerByMapSource( "mapSourceB" ) );
-        assertEquals( mappingService.getMapLayer( idC ), mappingService.getMapLayerByMapSource( "mapSourceC" ) );
-        assertEquals( mappingService.getMapLayer( idD ), mappingService.getMapLayerByMapSource( "mapSourceD" ) );
-
     }
 }

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/baselayer.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/baselayer.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/baselayer.png	2011-08-04 13:36:50 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java	2010-05-25 16:45:28 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddOrUpdateMapLayerAction.java	2011-08-04 12:28:58 +0000
@@ -67,18 +67,18 @@
         this.type = type;
     }
     
-    private String mapSource;
+    private String url;
     
-    public void setMapSource( String mapSource )
+    public void setUrl( String url )
     {
-        this.mapSource = mapSource;
+        this.url = url;
     }
     
-    private String layer;
+    private String layers;
     
-    public void setLayer( String layer )
+    public void setLayers( String layers )
     {
-        this.layer = layer;
+        this.layers = layers;
     }
     
     private String fillColor;
@@ -115,7 +115,7 @@
 
     public String execute()
     {
-        mappingService.addOrUpdateMapLayer( name, type, mapSource, layer, fillColor, fillOpacity, strokeColor, strokeWidth );
+        mappingService.addOrUpdateMapLayer( name, type, url, layers, fillColor, fillOpacity, strokeColor, strokeWidth );
         
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties	2011-07-06 19:35:22 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/org/hisp/dhis/mapping/i18n_module.properties	2011-08-11 20:49:21 +0000
@@ -130,7 +130,8 @@
 error_while_saving_data				= Error while saving data
 is_saved_as_map_source				= is saved as map source
 is_already_selected					= is already selected
-overlays							= Overlays
+overlays_							= Overlays
+overlays                            = overlays
 was_registered						= was registered
 is_already_in_use					= is already in use
 new_overlay							= New overlay
@@ -290,4 +291,6 @@
 set_thematic_map_date_type			= Set thematic map date type
 date								= Date
 legend_symbolizer					= Symbolizer
-image								= Image
\ No newline at end of file
+image								= Image
+register_new_wms_overlay            = Register new WMS overlay
+register_new_vector_overlay         = Register new vector overlay
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm	2011-07-06 19:35:22 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/i18n.vm	2011-08-11 20:49:21 +0000
@@ -131,7 +131,8 @@
     was_saved_as_base_coordinate: '$encoder.jsEscape($i18n.getString( 'was_saved_as_base_coordinate' ) , "'")',
     error_while_saving_data: '$encoder.jsEscape($i18n.getString( 'error_while_saving_data' ) , "'")',
     is_saved_as_map_source: '$encoder.jsEscape($i18n.getString( 'is_saved_as_map_source' ) , "'")',
-    is_already_selected: '$encoder.jsEscape($i18n.getString( 'is_already_selected' ) , "'")',	
+    is_already_selected: '$encoder.jsEscape($i18n.getString( 'is_already_selected' ) , "'")',
+    overlays_: '$encoder.jsEscape($i18n.getString( 'overlays_' ) , "'")',
     overlays: '$encoder.jsEscape($i18n.getString( 'overlays' ) , "'")',
     was_registered: '$encoder.jsEscape($i18n.getString( 'was_registered' ) , "'")',
     is_already_in_use: '$encoder.jsEscape($i18n.getString( 'is_already_in_use' ) , "'")',
@@ -301,5 +302,7 @@
     set_thematic_map_date_type: '$encoder.jsEscape($i18n.getString( 'set_thematic_map_date_type' ) , "'")',
     date: '$encoder.jsEscape($i18n.getString( 'date' ) , "'")',
     legend_symbolizer: '$encoder.jsEscape($i18n.getString( 'legend_symbolizer' ) , "'")',
-    image: '$encoder.jsEscape($i18n.getString( 'image' ) , "'")'
+    image: '$encoder.jsEscape($i18n.getString( 'image' ) , "'")',
+    register_new_wms_overlay: '$encoder.jsEscape($i18n.getString( 'register_new_wms_overlay' ) , "'")',
+    register_new_vector_overlay: '$encoder.jsEscape($i18n.getString( 'register_new_vector_overlay' ) , "'")'    
 };
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm	2011-06-08 13:52:49 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonInitialize.vm	2011-08-04 13:36:50 +0000
@@ -1,3 +1,4 @@
+#set( $baseLayersSize = $baseLayers.size() )
 #set( $overlaysSize = $overlays.size() )
 {
   "mapView": { 
@@ -40,15 +41,25 @@
     "infrastructuralDataElements": "$!{infrastructuralDataElements.id}",
     "infrastructuralPeriodType": "$!{infrastructuralPeriodType.name}"
   },
+  "baseLayers": [
+#foreach( $baseLayer in $baseLayers )
+    {
+      "data": {
+        "id": "$!{baseLayer.id}",
+        "name": "$!encoder.jsonEncode( ${baseLayer.name} )",
+        "url": "$!encoder.jsonEncode( ${baseLayer.url} )",
+        "layers": "$!encoder.jsonEncode( ${baseLayer.layers} )"
+      }
+    }#if( $velocityCount < $baseLayersSize ),#end
+#end
+  ],
   "overlays": [
 #foreach( $overlay in $overlays )
     {
       "data": {
         "id": "$!{overlay.id}",
         "name": "$!encoder.jsonEncode( ${overlay.name} )",
-        "type": "$!encoder.jsonEncode( ${overlay.type} )",
-        "mapSource": "$!encoder.jsonEncode( ${overlay.mapSource} )",
-        "layer": "$!encoder.jsonEncode( ${overlay.layer} )",
+        "url": "$!encoder.jsonEncode( ${overlay.url} )",
         "fillColor": "$!encoder.jsonEncode( ${overlay.fillColor} )",
         "fillOpacity": "$!{overlay.fillOpacity}",
         "strokeColor": "$!encoder.jsonEncode( ${overlay.strokeColor} )",

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css	2011-07-03 18:52:18 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css	2011-08-04 13:36:50 +0000
@@ -226,6 +226,9 @@
 .x-btn .icon-exit {
 	background-image:url('../../../images/exit2.png');
 }
+.x-btn .icon-baselayer {
+	background-image:url('../../../images/baselayer.png');
+}
 .x-btn .icon-overlay {
 	background-image:url('../../../images/overlay.png');
 }
@@ -325,6 +328,12 @@
 	font:bold 11px arial;
 	color:#111;
 }
+#window-baselayer-title {
+	padding:0 0 3px 21px;
+	background:url('../../../images/baselayer.png') no-repeat 0 0 transparent;
+	font:bold 11px arial;
+	color:#111;
+}
 #window-maplayer-title {
 	padding:0 0 3px 21px;
 	background:url('../../../images/overlay.png') no-repeat 0 0 transparent;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2011-07-13 21:01:29 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/global.js	2011-08-11 20:25:06 +0000
@@ -359,7 +359,21 @@
     getTransformedPoint: function(p) {
         return p.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
     },
-		
+    
+    createWMSLayer: function(name, url, layer) {
+        return new OpenLayers.Layer.WMS(name, url, 
+            {
+                layers: layer,
+                transparent: true,
+                format: 'image/png'
+            },
+            {
+                isBaseLayer: false,
+                buffer: 0,
+                ratio: 1
+            }
+        );
+    },
     
     createOverlay: function(name, fillColor, fillOpacity, strokeColor, strokeWidth, url) {
         return new OpenLayers.Layer.Vector(name, {

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js	2011-07-25 19:09:57 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/javascript/index.js	2011-08-11 21:00:43 +0000
@@ -6,7 +6,8 @@
     
 	G.vars.map = new OpenLayers.Map({
         controls: [new OpenLayers.Control.MouseToolbar()],
-        displayProjection: new OpenLayers.Projection("EPSG:4326")
+        displayProjection: new OpenLayers.Projection("EPSG:4326"),
+        maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)
     });
     
     G.vars.mask = new Ext.LoadMask(Ext.getBody(),{msg:G.i18n.loading,msgCls:'x-mask-loading2'});
@@ -19,6 +20,7 @@
         success: function(r) {
             var init = Ext.util.JSON.decode(r.responseText);
             G.vars.parameter.mapView = init.mapView;
+            G.user.initBaseLayers = init.baseLayers;
             G.user.initOverlays = init.overlays;
             G.user.isAdmin = init.security.isAdmin;
             G.system.aggregationStrategy = init.systemSettings.aggregationStrategy;
@@ -214,11 +216,24 @@
         }
     });
     
+    var baseLayerStore = new Ext.data.JsonStore({
+        url: G.conf.path_mapping + 'getMapLayersByType' + G.conf.type,
+        baseParams: {type: G.conf.map_layer_type_baselayer},
+        root: 'mapLayers',
+        fields: ['id', 'name', 'url', 'layers'],
+        sortInfo: {field: 'name', direction: 'ASC'},
+        autoLoad: false,
+        isLoaded: false,
+        listeners: {
+            'load': G.func.storeLoadListener
+        }
+    });    
+    
     var overlayStore = new Ext.data.JsonStore({
         url: G.conf.path_mapping + 'getMapLayersByType' + G.conf.type,
         baseParams: {type: G.conf.map_layer_type_overlay},
         root: 'mapLayers',
-        fields: ['id', 'name', 'type', 'mapSource', 'layer', 'fillColor', 'fillOpacity', 'strokeColor', 'strokeWidth'],
+        fields: ['id', 'name', 'type', 'url', 'fillColor', 'fillOpacity', 'strokeColor', 'strokeWidth'],
         sortInfo: {field: 'name', direction: 'ASC'},
         autoLoad: false,
         isLoaded: false,
@@ -280,6 +295,7 @@
         organisationUnitsAtLevel: organisationUnitsAtLevelStore,
         geojsonFiles: geojsonFilesStore,
         overlay: overlayStore,
+        baseLayer: baseLayerStore,
         groupSet: groupSetStore,
         groupsByGroupSet: groupsByGroupSetStore,
         mapLegendTypeIcon: mapLegendTypeIconStore
@@ -360,7 +376,7 @@
     });
     
     centroidLayer.layerType = G.conf.map_layer_type_thematic;
-    G.vars.map.addLayer(centroidLayer);
+    G.vars.map.addLayer(centroidLayer);    
     
     /* Init base layers */
     if (window.google) {
@@ -383,6 +399,30 @@
     osm.layerType = G.conf.map_layer_type_baselayer;
     G.vars.map.addLayer(osm);
     
+    /* Init base layers */
+	function addBaseLayersToMap(init) {
+        function add(r) {
+            if (r.length) {                
+                for (var i = 0; i < r.length; i++) {
+                    var baseLayer = G.util.createWMSLayer(r[i].data.name, r[i].data.url, r[i].data.layers);                    
+                    baseLayer.layerType = G.conf.map_layer_type_baselayer;
+                    baseLayer.setVisibility(false);                    
+                    G.vars.map.addLayer(baseLayer);
+                }
+            }
+        }
+        
+        if (init) {
+            add(G.user.initBaseLayers);
+        }
+        else {
+            G.stores.baseLayer.load({callback: function(r) {
+                add(r);
+            }});
+        }
+	}
+	addBaseLayersToMap(true);
+    
     /* Init overlays */
 	function addOverlaysToMap(init) {
         function add(r) {
@@ -390,7 +430,7 @@
                 for (var i = 0; i < r.length; i++) {
                     var overlay = G.util.createOverlay(
                         r[i].data.name, r[i].data.fillColor, 1, r[i].data.strokeColor, parseFloat(r[i].data.strokeWidth),
-                        G.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + r[i].data.mapSource
+                        G.conf.path_mapping + 'getGeoJsonFromFile.action?name=' + r[i].data.url
                     );
                     
                     overlay.layerType = G.conf.map_layer_type_overlay;
@@ -1585,7 +1625,7 @@
                     },
                     {
                         id: 'help5',
-                        title: '<span class="panel-tab-title">' + G.i18n.overlays + '</span>'
+                        title: '<span class="panel-tab-title">' + G.i18n.overlays_ + '</span>'
                     },
                     {
                         id: 'help6',
@@ -1596,10 +1636,140 @@
         ]
     });
 
+    /* Section: base layers */
+	var baseLayersWindow = new Ext.Window({
+        id: 'baselayers_w',
+        title: '<span id="window-baselayer-title">WMS ' + G.i18n.overlays + '</span>',
+		layout: 'fit',
+        closeAction: 'hide',
+        height: 230,
+		width: G.conf.window_width,
+        items: [
+            {
+                xtype: 'form',
+                bodyStyle: 'padding:8px',
+                labelWidth: G.conf.label_width,
+                items: [
+                    {html: '<div class="window-info">' + G.i18n.register_new_wms_overlay + '</div>'},
+                    {
+                        xtype: 'textfield',
+                        id: 'baselayername_tf',
+                        emptytext: G.conf.emptytext,
+                        labelSeparator: G.conf.labelseparator,
+                        fieldLabel: G.i18n.display_name,
+                        width: G.conf.combo_width_fieldset,
+                        autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '50'}
+                    },
+                    {
+                        xtype: 'textfield',
+                        id: 'baselayerurl_tf',
+                        emptytext: G.conf.emptytext,
+                        labelSeparator: G.conf.labelseparator,
+                        fieldLabel: G.i18n.url,
+                        width: G.conf.combo_width_fieldset
+                    },
+                    {
+                        xtype: 'textfield',
+                        id: 'baselayerlayer_tf',
+                        emptytext: G.conf.emptytext,
+                        labelSeparator: G.conf.labelseparator,
+                        fieldLabel: G.i18n.layer,
+                        width: G.conf.combo_width_fieldset
+                    },
+                    {html: '<div class="window-p"></div>'},
+                    {html: '<div class="window-info">' + G.i18n.delete_ + ' WMS ' + G.i18n.overlay + '</div>'},
+                    {
+                        xtype: 'combo',
+                        id: 'baselayer_cb',
+                        editable: false,
+                        valueField: 'id',
+                        displayField: 'name',
+                        mode: 'remote',
+                        forceSelection: true,
+                        triggerAction: 'all',
+                        emptytext: G.conf.emptytext,
+                        labelSeparator: G.conf.labelseparator,
+                        fieldLabel: G.i18n.overlay_,
+                        width: G.conf.combo_width_fieldset,                
+                        store: G.stores.baseLayer
+                    }
+                ]
+            }
+        ],
+        bbar: [
+            '->',
+            {
+                xtype: 'button',
+                id: 'newbaselayer_b',
+                text: 'Register',
+                iconCls: 'icon-add',
+                handler: function() {
+                    var bln = Ext.getCmp('baselayername_tf').getRawValue();
+                    var blu = Ext.getCmp('baselayerurl_tf').getRawValue();
+                    var bll = Ext.getCmp('baselayerlayer_tf').getRawValue();
+                    
+                    if (!bln || !blu || !bll) {
+                        Ext.message.msg(false, G.i18n.form_is_not_complete);
+                        return;
+                    }
+                    
+                    Ext.Ajax.request({
+                        url: G.conf.path_mapping + 'addOrUpdateMapLayer' + G.conf.type,
+                        method: 'POST',
+                        params: {name: bln, type: G.conf.map_layer_type_baselayer, url: blu, layers: bll},
+                        success: function(r) {
+                            Ext.message.msg(true, 'WMS ' + G.i18n.overlay + ' <span class="x-msg-hl">' + bln + '</span> ' + G.i18n.registered);
+                            G.stores.baseLayer.load();
+                            
+                            if (G.vars.map.getLayersByName(bln).length) {
+                                G.vars.map.getLayersByName(bln)[0].destroy();
+                            }
+                            
+                            var baselayer = G.util.createWMSLayer(bln, blu, bll);  
+                            baselayer.layerType = G.conf.map_layer_type_baselayer;
+                            baselayer.setVisibility(false);                            
+                            G.vars.map.addLayer(baselayer);
+                            
+                            Ext.getCmp('baselayername_tf').reset();
+                        }
+                    });
+                }
+            },
+            {
+                xtype: 'button',
+                id: 'deletebaselayer_b',
+                text: G.i18n.delete_,
+                iconCls: 'icon-remove',
+                handler: function() {
+                    var bl = Ext.getCmp('baselayer_cb').getValue();
+                    var bln = Ext.getCmp('baselayer_cb').getRawValue();
+                    
+                    if (!bl) {
+                        Ext.message.msg(false, G.i18n.please_select_a_baselayer);
+                        return;
+                    }
+                    
+                    Ext.Ajax.request({
+                        url: G.conf.path_mapping + 'deleteMapLayer' + G.conf.type,
+                        method: 'POST',
+                        params: {id: bl},
+                        success: function(r) {
+                            Ext.message.msg(true, 'WMS ' + G.i18n.overlay + ' <span class="x-msg-hl">' + bln + '</span> '+ G.i18n.deleted);
+                            G.stores.baseLayer.load();
+                            Ext.getCmp('baselayer_cb').clearValue();
+                        }
+                    });
+                    
+                    G.vars.map.getLayersByName(bln)[0].destroy();
+                }
+            }
+        ]
+    });
+
     /* Section: overlays */
 	var overlaysWindow = new Ext.Window({
         id: 'overlays_w',
-        title: '<span id="window-maplayer-title">' + G.i18n.overlays + '</span>',
+        title: '<span id="window-maplayer-title">Vector ' + G.i18n.overlays + '</span>',
 		layout: 'fit',
         closeAction: 'hide',
         height: 307,
@@ -1610,7 +1780,7 @@
                 bodyStyle: 'padding:8px',
                 labelWidth: G.conf.label_width,
                 items: [
-                    {html: '<div class="window-info">Register new overlay</div>'},
+                    {html: '<div class="window-info">' + G.i18n.register_new_vector_overlay + '</div>'},
                     {
                         xtype: 'textfield',
                         id: 'maplayername_tf',
@@ -1693,11 +1863,11 @@
                         }
                     },
                     {html: '<div class="window-p"></div>'},
-                    {html: '<div class="window-info">Delete overlay</div>'},
+                    {html: '<div class="window-info">' + G.i18n.delete_ + ' vector ' + G.i18n.overlay + '</div>'},
                     {
                         xtype: 'combo',
                         id: 'maplayer_cb',
-                        editable:false,
+                        editable: false,
                         valueField: 'id',
                         displayField: 'name',
                         mode: 'remote',
@@ -1705,9 +1875,9 @@
                         triggerAction: 'all',
                         emptytext: G.conf.emptytext,
                         labelSeparator: G.conf.labelseparator,
-                        fieldLabel: G.i18n.overlays,
+                        fieldLabel: G.i18n.overlay_,
                         width: G.conf.combo_width_fieldset,                
-                        store:G.stores.overlay
+                        store: G.stores.overlay
                     }
                 ]
             }
@@ -1735,9 +1905,9 @@
                     Ext.Ajax.request({
                         url: G.conf.path_mapping + 'addOrUpdateMapLayer' + G.conf.type,
                         method: 'POST',
-                        params: {name: mln, type: 'overlay', mapSource: mlmsf, fillColor: mlfc, fillOpacity: 1, strokeColor: mlsc, strokeWidth: mlsw},
+                        params: {name: mln, type: 'overlay', url: mlmsf, fillColor: mlfc, fillOpacity: 1, strokeColor: mlsc, strokeWidth: mlsw},
                         success: function(r) {
-                            Ext.message.msg(true, 'Overlay <span class="x-msg-hl">' + mln + '</span> ' + G.i18n.registered);
+                            Ext.message.msg(true, 'Vector ' + G.i18n.overlay + ' <span class="x-msg-hl">' + mln + '</span> ' + G.i18n.registered);
                             G.stores.overlay.load();
                             
                             if (G.vars.map.getLayersByName(mln).length) {
@@ -1780,7 +1950,7 @@
                         method: 'POST',
                         params: {id: ml},
                         success: function(r) {
-                            Ext.message.msg(true, 'Overlay <span class="x-msg-hl">' + mln + '</span> '+ G.i18n.deleted);
+                            Ext.message.msg(true, 'Vector ' + G.i18n.overlay + ' <span class="x-msg-hl">' + mln + '</span> '+ G.i18n.deleted);
                             G.stores.overlay.load();
                             Ext.getCmp('maplayer_cb').clearValue();
                         }
@@ -2257,8 +2427,18 @@
         bbar: [
             {
                 xtype: 'button',
+                id: 'baselayers_b',
+                text: 'WMS ' + G.i18n.overlay,
+                iconCls: 'icon-baselayer',
+                handler: function() {
+                    Ext.getCmp('baselayers_w').setPagePosition(Ext.getCmp('east').x - (Ext.getCmp('overlays_w').width + 15), Ext.getCmp('center').y + 41);
+                    Ext.getCmp('baselayers_w').show();
+                }
+            },
+            {
+                xtype: 'button',
                 id: 'overlays_b',
-                text: 'Overlays',
+                text: 'Vector ' + G.i18n.overlay,
                 iconCls: 'icon-overlay',
                 handler: function() {
                     Ext.getCmp('overlays_w').setPagePosition(Ext.getCmp('east').x - (Ext.getCmp('overlays_w').width + 15), Ext.getCmp('center').y + 41);