Index: trunk/gui/scripts/map.tcl
===================================================================
--- trunk/gui/scripts/map.tcl	(revision 5818)
+++ trunk/gui/scripts/map.tcl	(revision 5872)
@@ -214,5 +214,5 @@
         set wfs [$layers element -as type $layer.wfs]
         if { $wfs != "" } {
-            foreach key { url typename outputformat maxfeatures request_buffer } {
+            foreach key { url typename format maxfeatures request_buffer } {
                 set value [$layers get $layer.wfs.$key]
                 $_tree set $child "wfs.$key" $value
Index: trunk/gui/scripts/mapviewer.tcl
===================================================================
--- trunk/gui/scripts/mapviewer.tcl	(revision 5818)
+++ trunk/gui/scripts/mapviewer.tcl	(revision 5872)
@@ -270,4 +270,5 @@
         grid-type              "geodetic"
         legend                 1
+        terrain-ambient        0.03
         terrain-edges          0
         terrain-lighting       0
@@ -367,7 +368,9 @@
         [itcl::code $this EventuallyResize %w %h]
 
+    set _useServerManip 1
     EnablePanningMouseBindings
     EnableRotationMouseBindings
     EnableZoomMouseBindings
+    set _useServerManip 0
 
     if {$_useServerManip} {
@@ -1215,5 +1218,5 @@
                 SetTerrainStyle $_mapsettings(style)
             } else {
-                InitSettings terrain-edges terrain-lighting \
+                InitSettings terrain-ambient terrain-edges terrain-lighting \
                     terrain-vertscale terrain-wireframe
             }
@@ -1450,6 +1453,6 @@
 
 itcl::body Rappture::MapViewer::MouseMotion {} {
-    #SendCmd "mouse motion $_motion(x) $_motion(y)"
-    SendCmd "map pin hover $_motion(x) $_motion(y)"
+    SendCmd "mouse motion $_motion(x) $_motion(y)"
+    #SendCmd "map pin hover $_motion(x) $_motion(y)"
     set _motion(pending) 0
 }
@@ -1745,4 +1748,8 @@
             SendCmd "camera throw $bool"
         }
+        "terrain-ambient" {
+            set val $_settings($what)
+            SendCmd "map terrain ambient $val"
+        }
         "terrain-edges" {
             set bool $_settings($what)
@@ -1855,4 +1862,18 @@
     }
 
+    itk_component add ambient_l {
+        label $inner.ambient_l -text "Ambient min." -font "Arial 9"
+    } {
+        ignore -font
+    }
+    itk_component add ambient {
+        ::scale $inner.ambient -from 0 -to 1.0 -orient horizontal \
+            -resolution 0.01 \
+            -variable [itcl::scope _settings(terrain-ambient)] \
+            -width 10 \
+            -showvalue on \
+            -command [itcl::code $this AdjustSetting terrain-ambient]
+    }
+
     blt::table $inner \
         0,0 $inner.posdisp   -cspan 2 -anchor w -pady 2 \
@@ -1861,9 +1882,11 @@
         3,0 $inner.lighting  -cspan 2 -anchor w -pady 2 \
         4,0 $inner.time_l    -cspan 2 -anchor w -pady 2 \
-        4,1 $inner.time      -cspan 2 -fill x   -pady 2
+        4,1 $inner.time      -cspan 2 -fill x   -pady 2 \
+        5,0 $inner.ambient_l -cspan 2 -anchor w -pady 2 \
+        5,1 $inner.ambient   -cspan 2 -fill x   -pady 2
 #        4,0 $inner.edges     -cspan 2  -anchor w -pady 2
 
     blt::table configure $inner r* c* -resize none
-    blt::table configure $inner r5 c1 -resize expand
+    blt::table configure $inner r6 c1 -resize expand
 }
 
@@ -2263,8 +2286,9 @@
 itcl::body Rappture::MapViewer::SetTerrainStyle { style } {
     array set settings {
+        -ambient 0.03
         -color white
         -edgecolor black
         -edges 0
-        -lighting 0
+        -lighting 1
         -linewidth 1.0
         -vertscale 1.0
@@ -2273,4 +2297,6 @@
     array set settings $style
 
+    SendCmd "map terrain ambient $settings(-ambient)"
+    set _settings(terrain-ambient) $settings(-ambient)
     SendCmd "map terrain edges $settings(-edges)"
     set _settings(terrain-edges) $settings(-edges)
@@ -2382,8 +2408,34 @@
             set _opacity($layer) [expr $settings(-opacity) * 100]
             foreach {r g b} [Color2RGB $settings(-color)] {}
-            if {[info exists settings(-minrange)] && [info exists settings(-maxrange)]} {
-                SendCmd [list map layer add $layer line $info(ogr.url) $r $g $b $settings(-width) $settings(-minrange) $settings(-maxrange)]
-            } else {
-                SendCmd [list map layer add $layer line $info(ogr.url) $r $g $b $settings(-width)]
+            switch -- $info(driver)  {
+                "ogr" {
+                    if {[info exists settings(-minrange)] && [info exists settings(-maxrange)]} {
+                        SendCmd [list map layer add $layer line ogr {} {} $info(ogr.url) $r $g $b $settings(-width) $settings(-minrange) $settings(-maxrange)]
+                    } else {
+                        SendCmd [list map layer add $layer line ogr {} {} $info(ogr.url) $r $g $b $settings(-width)]
+                    }
+                }
+                "tfs" {
+                    set format "json"
+                    if {[info exists info(tfs.format)]} {
+                        set format $info(tfs.format)
+                    }
+                    if {[info exists settings(-minrange)] && [info exists settings(-maxrange)]} {
+                        SendCmd [list map layer add $layer line tfs $format {} $info(tfs.url) $r $g $b $settings(-width) $settings(-minrange) $settings(-maxrange)]
+                    } else {
+                        SendCmd [list map layer add $layer line tfs $format {} $info(tfs.url) $r $g $b $settings(-width)]
+                    }
+                }
+                "wfs" {
+                    set format "json"
+                    if {[info exists info(wfs.format)]} {
+                        set format $info(wfs.format)
+                    }
+                    if {[info exists settings(-minrange)] && [info exists settings(-maxrange)]} {
+                        SendCmd [list map layer add $layer line wfs $format $info(wfs.typename) $info(wfs.url) $r $g $b $settings(-width) $settings(-minrange) $settings(-maxrange)]
+                    } else {
+                        SendCmd [list map layer add $layer line wfs $format $info(wfs.typename) $info(wfs.url) $r $g $b $settings(-width)]
+                    }
+                }
             }
             SendCmd "map layer opacity $settings(-opacity) $layer"
@@ -2404,5 +2456,62 @@
             set _opacity($layer) [expr $settings(-opacity) * 100]
             foreach {r g b} [Color2RGB $settings(-color)] {}
-            SendCmd [list map layer add $layer point $info(ogr.url) $r $g $b $settings(-size)]
+            switch -- $info(driver)  {
+                "ogr" {
+                    SendCmd [list map layer add $layer point ogr {} {} $info(ogr.url) $r $g $b $settings(-size)]
+                }
+                "tfs" {
+                    set format "json"
+                    if {[info exists info(tfs.format)]} {
+                        set format $info(tfs.format)
+                    }
+                    SendCmd [list map layer add $layer point tfs $format {} $info(ogr.url) $r $g $b $settings(-size)]
+                }
+                "wfs" {
+                    set format "json"
+                    if {[info exists info(wfs.format)]} {
+                        set format $info(wfs.format)
+                    }
+                    SendCmd [list map layer add $layer point wfs $format $info(wfs.typename) $info(ogr.url) $r $g $b $settings(-size)]
+                }
+            }
+            SendCmd "map layer opacity $settings(-opacity) $layer"
+        }
+        "icon" {
+            array set settings {
+                -align "center_bottom"
+                -declutter 1
+                -heading {}
+                -icon pin
+                -minbias 1000
+                -opacity 1.0
+                -placement "vertex"
+                -scale {}
+            }
+            if { [info exists info(style)] } {
+                array set settings $info(style)
+            }
+            if { [info exists info(opacity)] } {
+                set settings(-opacity) $info(opacity)
+            }
+            set _opacity($layer) [expr $settings(-opacity) * 100]
+            switch -- $info(driver)  {
+                "ogr" {
+                    SendCmd [list map layer add $layer icon ogr {} {} $info(ogr.url) $settings(-icon) $settings(-scale) $settings(-heading) $settings(-declutter) $settings(-placement) $settings(-align)]
+                }
+                "tfs" {
+                    set format "json"
+                    if {[info exists info(tfs.format)]} {
+                        set format $info(tfs.format)
+                    }
+                    SendCmd [list map layer add $layer icon tfs $format {} $info(tfs.url) $settings(-icon) $settings(-scale) $settings(-heading) $settings(-declutter) $settings(-placement) $settings(-align)]
+                }
+                "wfs" {
+                    set format "json"
+                    if {[info exists info(wfs.format)]} {
+                        set format $info(wfs.format)
+                    }
+                    SendCmd [list map layer add $layer icon wfs $format $info(wfs.typename) $info(wfs.url) $settings(-icon) $settings(-scale) $settings(-heading) $settings(-declutter) $settings(-placement) $settings(-align)]
+                }
+            }
             SendCmd "map layer opacity $settings(-opacity) $layer"
         }
@@ -2421,5 +2530,23 @@
             set _opacity($layer) [expr $settings(-opacity) * 100]
             foreach {r g b} [Color2RGB $settings(-color)] {}
-            SendCmd [list map layer add $layer polygon $info(ogr.url) $r $g $b]
+            switch -- $info(driver)  {
+                "ogr" {
+                    SendCmd [list map layer add $layer polygon ogr {} {} $info(ogr.url) $r $g $b]
+                }
+                "tfs" {
+                    set format "json"
+                    if {[info exists info(tfs.format)]} {
+                        set format $info(tfs.format)
+                    }
+                    SendCmd [list map layer add $layer polygon tfs $format {} $info(tfs.url) $r $g $b]
+                }
+                "wfs" {
+                    set format "json"
+                    if {[info exists info(wfs.format)]} {
+                        set format $info(wfs.format)
+                    }
+                    SendCmd [list map layer add $layer polygon wfs $format $info(wfs.typename) $info(wfs.url) $r $g $b]
+                }
+            }
             SendCmd "map layer opacity $settings(-opacity) $layer"
         }
@@ -2437,4 +2564,6 @@
                 -opacity 1.0
                 -removedupes 1
+                -xoffset 0
+                -yoffset 0
             }
             if { [info exists info(style)] } {
@@ -2453,8 +2582,34 @@
             foreach {fgR fgG fgB} [Color2RGB $settings(-color)] {}
             foreach {bgR bgG bgB} [Color2RGB $settings(-halocolor)] {}
-            if {[info exists settings(-minrange)] && [info exists settings(-maxrange)]} {
-                SendCmd [list map layer add $layer text $info(ogr.url) $contentExpr $priorityExpr $fgR $fgG $fgB $bgR $bgG $bgB $settings(-halowidth) $settings(-fontsize) $settings(-removedupes) $settings(-declutter) $settings(-align) $settings(-minrange) $settings(-maxrange)]
-            } else {
-                SendCmd [list map layer add $layer text $info(ogr.url) $contentExpr $priorityExpr $fgR $fgG $fgB $bgR $bgG $bgB $settings(-halowidth) $settings(-fontsize) $settings(-removedupes) $settings(-declutter) $settings(-align)]
+            switch -- $info(driver)  {
+                "ogr" {
+                    if {[info exists settings(-minrange)] && [info exists settings(-maxrange)]} {
+                        SendCmd [list map layer add $layer text ogr {} {} $info(ogr.url) $contentExpr $priorityExpr $fgR $fgG $fgB $bgR $bgG $bgB $settings(-halowidth) $settings(-fontsize) $settings(-removedupes) $settings(-declutter) $settings(-align) $settings(-xoffset) $settings(-yoffset) $settings(-minrange) $settings(-maxrange)]
+                    } else {
+                        SendCmd [list map layer add $layer text ogr {} {} $info(ogr.url) $contentExpr $priorityExpr $fgR $fgG $fgB $bgR $bgG $bgB $settings(-halowidth) $settings(-fontsize) $settings(-removedupes) $settings(-declutter) $settings(-align) $settings(-xoffset) $settings(-yoffset)]
+                    }
+                }
+                "tfs" {
+                    set format "json"
+                    if {[info exists info(tfs.format)]} {
+                        set format $info(tfs.format)
+                    }
+                    if {[info exists settings(-minrange)] && [info exists settings(-maxrange)]} {
+                        SendCmd [list map layer add $layer text tfs $format {} $info(tfs.url) $contentExpr $priorityExpr $fgR $fgG $fgB $bgR $bgG $bgB $settings(-halowidth) $settings(-fontsize) $settings(-removedupes) $settings(-declutter) $settings(-align) $settings(-xoffset) $settings(-yoffset) $settings(-minrange) $settings(-maxrange)]
+                    } else {
+                        SendCmd [list map layer add $layer text tfs $format {} $info(tfs.url) $contentExpr $priorityExpr $fgR $fgG $fgB $bgR $bgG $bgB $settings(-halowidth) $settings(-fontsize) $settings(-removedupes) $settings(-declutter) $settings(-align) $settings(-xoffset) $settings(-yoffset)]
+                    }
+                }
+                "wfs" {
+                    set format "json"
+                    if {[info exists info(wfs.format)]} {
+                        set format $info(wfs.format)
+                    }
+                    if {[info exists settings(-minrange)] && [info exists settings(-maxrange)]} {
+                        SendCmd [list map layer add $layer text wfs $format $info(wfs.typename) $info(wfs.url) $contentExpr $priorityExpr $fgR $fgG $fgB $bgR $bgG $bgB $settings(-halowidth) $settings(-fontsize) $settings(-removedupes) $settings(-declutter) $settings(-align) $settings(-xoffset) $settings(-yoffset) $settings(-minrange) $settings(-maxrange)]
+                    } else {
+                        SendCmd [list map layer add $layer text wfs $format $info(wfs.typename) $info(wfs.url) $contentExpr $priorityExpr $fgR $fgG $fgB $bgR $bgG $bgB $settings(-halowidth) $settings(-fontsize) $settings(-removedupes) $settings(-declutter) $settings(-align) $settings(-xoffset) $settings(-yoffset)]
+                    }
+                }
             }
             SendCmd "map layer opacity $settings(-opacity) $layer"
