Changeset 3648 for TI05-delivery/ows_framework
- Timestamp:
- 19/03/08 14:21:57 (13 years ago)
- Location:
- TI05-delivery/ows_framework/trunk/ows_server/ows_server
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/wmc_util.py
r3647 r3648 14 14 from ows_server.models.WMC import WMC 15 15 from ows_common import exceptions 16 import urllib2 17 18 def getWMCDocLayer(url): 19 """ 20 Retrieves a WMC document, then strips out and returns the layer info 21 - this is used in the conterra_aggregate to produce the input file for 22 Con Terra 23 """ 24 wmcTree = getWMCDoc(url) 25 helper = nsdumb(wmcTree) 26 27 layersTree = helper.find(wmcTree, 'LayerList') 28 if layersTree is None: 29 return '' 30 31 # add each of the layer elements 32 layers = layersTree.getchildren() 33 layersData = [] 34 for child in layers: 35 layersData.append(ET.tostring(child)) 36 37 return ''.join(layersData) 38 39 40 def getWMCDoc(url): 41 """ 42 Gets a wmc from the specified url 43 """ 44 x=genericHTTP(proxyServer='http://wwwcache3.rl.ac.uk:8080/') 45 wmcDoc = x.get(url) 46 wmcTree = loadET(wmcDoc) 47 48 return wmcTree 16 import urllib2, urllib 49 17 50 18 def getConTerraDoc(wmcURLs): … … 57 25 c.wmcDocs.append(WMC(wmcURL)) 58 26 session.save() 27 28 # need to send the aggregated data as POST data - so change the request method 29 request.method = "POST" 30 31 # now add the required data, using the aggregate template 32 request.POST.add('xmlConfig', render('conterra_aggregate', format='xml')) 33 print "BBBBaaa", request.POST 34 h.redirect_to('http://www.conterra.de/mapclient/businesstier/configuration/postinit') 35 59 36 60 37 response.headers['Content-Type'] = 'text/xml' … … 95 72 filehandle = urllib2.urlopen(endpoint) 96 73 except IOError: 97 raise exceptions.URLUnavailable, "Could not access WM Cendpoint: %s" % endpoint74 raise exceptions.URLUnavailable, "Could not access WMS endpoint: %s" % endpoint 98 75 99 76 response.headers['Content-Type'] = 'text/xml' -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/WMC.py
r3536 r3648 37 37 if layersTree: 38 38 # add each of the layer elements 39 self.layers = layersTree.getchildren() 39 layerElements = layersTree.getchildren() 40 for layer in layerElements: 41 self.layers.append(WMCLayer(layer)) 40 42 41 42 43 44 43 def getAllLayers(): 45 44 layersData = [] … … 47 46 layersData.append(ET.tostring(child)) 48 47 return ''.join(layersData) 48 49 50 class WMCLayer: 51 ''' Simple representation of a WMC layer ''' 52 def __init__(self, layerXML): 53 54 self.xml = layerXML 55 56 # Now extract the basic layer info - for easy retrieval in kid template 57 helper=nsdumb(self.xml) 58 self.name = helper.getText(self.xml, 'Name') 59 49 60 50 61 -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/conterra_aggregate.kid
r3483 r3648 1 <?xml version="1.0" encoding="UTF-8" ?> 2 <?python 3 from ows_server.lib.wmc_util import * 4 ?> 5 <ViewContext id="Conterra_MapClient" version="1.1.0" xmlns="http://www.opengis.net/context" xmlns:py="http://purl.org/kid/ns#" py:extends="'icmap_elements.kid'"> 6 <General> 7 <Window height="570" width="714"/> 8 <BoundingBox SRS="EPSG:4326" maxx="5.7041447888495842022393844672478735446929931640625" maxy="62.34738779056453239491020212881267070770263671875" minx="-12.4651183690451485830408273614011704921722412109375" miny="47.84251384098470083472420810721814632415771484375"/> 9 <Title>WMS Context generated by conterra sdi-suite mapClient 2.0 (http://www.conterra.de)</Title> 10 <KeywordList> 11 <Keyword>conterra GmbH</Keyword> 12 <Keyword>conterra sdi suite mapClient 2.0</Keyword> 13 <Keyword>http://www.conterra.de</Keyword> 14 <Keyword>http://www.sdi-suite.de</Keyword> 15 </KeywordList> 16 <Extension> 17 <ns1:IMCWmcExtension xmlns:ns1="http://www.conterra.de/mapclient/businesstier/configuration/wmcextension"> 18 <ns2:tcHierarchy xmlns:ns2="http://www.conterra.de/mapclient/businesstier/configuration/hierarchy"> 19 <ns2:node showInContent="true" visible="true"> 20 <ns2:id>0</ns2:id> 21 <ns2:name>Root</ns2:name> 22 <ns2:value/> 23 </ns2:node> 24 </ns2:tcHierarchy> 25 <ns3:IMCMapLayerConfig xmlns:ns3="http://www.conterra.de/mapclient/businesstier/configuration/layer"> 26 <span py:for="i, wmc in enumerate(c.wmcDocs)" py:replace="createIMCDatasourceElement(i,wmc)" py:strip="True"/> 27 28 <!-- not sure if we need to get the correct SRS value here --> 29 <ns3:IMCMap ImageFormat="image/png" SRS="EPSG:4326" SRSList="EPSG:4326"> 30 <!-- NB, don't forget to include the following: 31 <ns3:IMCDatasource ClassName="de.conterra.suite.adapter.wms.WMSDatasource" ID="1" PooledConnections="0"> 32 <ns3:IMC_URL_Connection URL="http://www2.demis.nl/mapserver/Request.asp?"/> 33 </ns3:IMCDatasource> 34 --> 35 <for py:for="i,wmc in enumerate(c.wmcDocs)" py:strip="True"> 36 <span py:for="j,layer in enumerate(wmc.layers)" py:replace="createICMAPContentElement(i,layer)" py:strip="True"/> 37 </for> 38 </ns3:IMCMap> 39 40 <ns3:IMCOverviewMap visible="true" ImageFormat="image/png" SRS="EPSG:4326" SRSList="EPSG:4326"> 41 <ns3:IMCMapContentElement ID="3" NameKey="Countries " canSetVisible="true" legendVisible="false" persistentToWMC="false" showInContent="true" showInLegend="true" visible="true"> 42 <ns3:IMCLayer ClassName="de.conterra.suite.adapter.wms.WMSLayer" CoverFileWorkerID="-1" ID="3" LayerID="Countries" LegendVisibility="true" MapServiceID="1" Visibility="true"/> 43 </ns3:IMCMapContentElement> 44 <ns3:IMCInitialExtent MaxX="180.0" MaxY="115.37564766839378" MinX="-184.0" MinY="-120.37564766839378"/> 45 <ns3:IMCFullExtent MaxX="180.0" MaxY="85.0" MinX="-184.0" MinY="-90.0"/> 46 </ns3:IMCOverviewMap> 47 </ns3:IMCMapLayerConfig> 48 </ns1:IMCWmcExtension> 49 </Extension> 50 </General> 51 <LayerList> 1 <?xml version='1.0' encoding='UTF-8'?> 2 <pos:IMCPostConfig SRS='EPSG:4326' xmlns:pos='http://www.conterra.de/mapclient/businesstier/configuration/postinit' xmlns:py="http://purl.org/kid/ns#" > 3 <pos:Map ImageFormat='image/png'> 52 4 <for py:for="i,wmc in enumerate(c.wmcDocs)" py:strip="True"> 53 <span py:for="j,layer in enumerate(wmc.layers)" py:replace="layer" py:strip="True"/> 54 </for> 55 </LayerList> 56 </ViewContext> 5 <pos:WMService url="${wmc.url}"> 6 </pos:WMService> 7 <pos:InitialExtent MinX='-180' MinY='-90' MaxX='180' MaxY='90'> 8 </pos:InitialExtent> 9 </for> 10 </pos:Map> 11 <pos:OverviewMap ImageFormat='image/png'> 12 <for py:for="i,wmc in enumerate(c.wmcDocs)" py:strip="True"> 13 <pos:WMService url="${wmc.url}"> 14 <for py:for="j,layer in enumerate(wmc.layers)" py:strip="True"> 15 <pos:AddLayer visible='true'>${layer.name}</pos:AddLayer> 16 </for> 17 </pos:WMService> 18 </for> 19 </pos:OverviewMap> 20 </pos:IMCPostConfig>
Note: See TracChangeset
for help on using the changeset viewer.