[GRASS-SVN] r47858 - grass-addons/grass7/gui/wxpython/wx.wms
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Aug 23 16:56:12 EDT 2011
Author: sudeepsingh
Date: 2011-08-23 13:56:12 -0700 (Tue, 23 Aug 2011)
New Revision: 47858
Modified:
grass-addons/grass7/gui/wxpython/wx.wms/parse.py
grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py
Log:
BBOX paramter parsing added, paramter hardcoded for now
Modified: grass-addons/grass7/gui/wxpython/wx.wms/parse.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/parse.py 2011-08-23 18:58:55 UTC (rev 47857)
+++ grass-addons/grass7/gui/wxpython/wx.wms/parse.py 2011-08-23 20:56:12 UTC (rev 47858)
@@ -192,3 +192,13 @@
dfs(child, LayerTree, id)
return
+def parseGrass_Region(grassRegion, dir):
+ grassRegion = 'n-s resol: 26.266417; n-s resol3: 100; rows: 533; north: 4928000.0; t-b resol: 1; zone: 13; bottom: 0; rows3: 140; west: 590000.0; top: 1; cols: 698; cols3: 190; depths: 1; e-w resol: 27.220630; proj: 1; e-w resol3: 100; east: 609000.0; south: 4914000.0;'
+ width = '698'
+ Height = '533'
+ s = grassRegion.find(dir)
+ g = grassRegion[s:]
+ g = g.split()
+ g = g[1].strip(';')
+ print g
+ return float(g)
Modified: grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py 2011-08-23 18:58:55 UTC (rev 47857)
+++ grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py 2011-08-23 20:56:12 UTC (rev 47858)
@@ -21,7 +21,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# generated by wxGlade 0.6.3 on Mon Jul 11 04:58:20 2011
-
+import os
import wx
from wxPython.wx import *
from grass.script import core as grass
@@ -216,7 +216,10 @@
grass.warning(message)
print message
return
-
+ try:
+ self.epsgList.SetSelection(0)
+ except:
+ print 'epsg list is empty'
self.usernameInput.Enable()
self.passwordInput.Enable()
#Sudeep's Code Starts
@@ -338,11 +341,14 @@
return
+ bbox = self.getBBOXParameters()
+ bbox = '584344,397868,585500,398500'
self.url_in = self.selectedURL
getMap_request_url = self.url_in
getMap_request_url += '?service=WMS&request=GetMap&version=1.1.1&format=image/png&width=800&height=600&srs=EPSG:'+self.selectedEPSG+'&layers='
- getMap_request_url += self.layerName+'&bbox=584344,397868,585500,398500'
-
+ getMap_request_url += self.layerName+'&bbox='+bbox
+ #'584344,397868,585500,398500'
+ print bbox
print getMap_request_url
req = Request(getMap_request_url)
@@ -502,6 +508,7 @@
#self.layerName = self.LayerTree.GetItemText(event.GetItem())
#print "Event handler `OnLayerTreeSelChanged' not implemented"
self.epsgList.Clear()
+ self.epsgList.Append('')
self.selectedLayerList = []
keys =[]
self.layerName = ""
@@ -611,7 +618,29 @@
#print self.servers
return
+ def getBBOXParameters(self):
+ n=parseGrass_Region(None, 'north')
+ s=parseGrass_Region(None, 'south')
+ e=parseGrass_Region(None, 'east')
+ w=parseGrass_Region(None, 'west')
+ if(e<w):
+ minx = e
+ maxx = w
+ else:
+ minx = w
+ maxx = e
+
+ if(n<s):
+ miny = n
+ maxy = s
+ else:
+ miny = s
+ maxy = n
+
+ res = str(minx)+','+str(miny)+','+str(maxx)+','+str(maxy)
+ return res
+
'''f = open('serverList.txt','r')
lines = f.readlines()
self.servers = {}
More information about the grass-commit
mailing list