Changeset 3483 for TI05-delivery/ows_framework
- Timestamp:
- 21/02/08 11:50:46 (13 years ago)
- Location:
- TI05-delivery/ows_framework/trunk/ows_server/ows_server
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/discovery.py
r3472 r3483 229 229 action='index'))) 230 230 231 return render_response('results')231 return Response(render('results')) 232 232 233 233 except ValueError,e: -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/selectedItems.py
r3472 r3483 34 34 35 35 elif 'PlotSelectedInConTerra' in self.inputs: 36 # TODO: not yet implemented36 # get all selected selections 37 37 self.getSelectedItems() 38 39 # ensure selections have been made 40 if 'selectedItems' in session: 41 wmcURLs = [] 42 for item in session['selectedItems']: 43 if (item.wmcURL): 44 wmcURLs.append(item.wmcURL) 45 return getConTerraDoc(wmcURLs) 38 46 39 47 else: 48 # Check to see if individual con terra plots have been requested 40 49 for input in self.inputs: 41 50 if str(input).startswith('PlotConTerra____'): 42 51 # if here a WMC has been requested to be plotted 43 52 # - get the URL and plot 44 dummy, url= str(input).split('____')53 dummy, wmcURL = str(input).split('____') 45 54 # NB, the image key that we're parsing has either .x or .y at the end 46 url = url[0:len(url)-2]47 urls = [url]48 return getConTerraDoc( urls)55 wmcURL = wmcURL[0:len(wmcURL)-2] 56 wmcURLs = [wmcURL] 57 return getConTerraDoc(wmcURLs) 49 58 50 59 return Response(render('selectedItems'), code=200) … … 70 79 if selection.entryID in entryID: 71 80 newSelection = copy.deepcopy(selection) 81 # NB, cope with multiple WMC/KML urls by splitting these 82 # into multiple rows and redefining the selection item URL appropriately 72 83 url = None 73 84 if len(selection.kmlList) > i: -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/wmc_util.py
r3473 r3483 12 12 from ows_server.models.DocumentRetrieve import genericHTTP 13 13 from ows_server.models.ETxmlView import loadET,et2text, nsdumb 14 #import urllib2 15 16 try: #python 2.5 17 from xml.etree import ElementTree as ET 18 except ImportError: 19 try: 20 # if you've installed it yourself it comes this way 21 import ElementTree as ET 22 except ImportError: 23 # if you've egged it this is the way it comes 24 from elementtree import ElementTree as ET 14 from ows_server.models.WMC import WMC 25 15 26 16 def getWMCDocLayer(url): … … 52 42 x=genericHTTP(proxyServer='http://wwwcache3.rl.ac.uk:8080/') 53 43 wmcDoc = x.get(url) #urllib2.urlopen(url) 54 # wmcTree = loadET(wmcDoc) 55 wmcTree = ET.fromstring(wmcDoc) 56 # wmcTree = nsdumb(wmcTree) 57 # self.metadataType='DIF' 58 # if helper.strip(self.tree.tag)!=self.metadataType: 59 # self.tree=helper.find(self.tree,self.metadataType) 60 # if self.tree is None: 61 # raise ValueError, 'DIF input does not include a DIF element:\n%s'%self.xml 44 wmcTree = loadET(wmcDoc) 62 45 63 46 return wmcTree 64 47 65 def getConTerraDoc( urls):48 def getConTerraDoc(wmcURLs): 66 49 """ 67 50 Uses an array of WMC URLs to construct an aggregation to allow the data 68 51 to be plotted in Con Terra 69 52 """ 70 session['wmcURLs'] = urls 53 c.wmcDocs = [] 54 for wmcURL in wmcURLs: 55 c.wmcDocs.append(WMC(wmcURL)) 71 56 session.save() 72 57 -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/conterra_aggregate.kid
r3472 r3483 1 <?xml version="1.0" encoding="UTF-8" py:extends="'icmap_elements.kid'" standalone="yes"?>1 <?xml version="1.0" encoding="UTF-8" ?> 2 2 <?python 3 3 from ows_server.lib.wmc_util import * 4 4 ?> 5 <ViewContext id="Conterra_MapClient" version="1.1.0" xmlns="http://www.opengis.net/context" xmlns:py="http://purl.org/kid/ns#" >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 6 <General> 7 7 <Window height="570" width="714"/> … … 23 23 </ns2:node> 24 24 </ns2:tcHierarchy> 25 <ns3:IMCMapLayerConfig xmlns:ns2="http://www.conterra.de/mapclient/businesstier/configuration/layer"> 26 <!-- NB, don't forget to include the following: 27 <ns3:IMCDatasource ClassName="de.conterra.suite.adapter.wms.WMSDatasource" ID="1" PooledConnections="0"> 28 <ns3:IMC_URL_Connection URL="http://www2.demis.nl/mapserver/Request.asp?"/> 29 </ns3:IMCDatasource> 30 --> 31 <span py:for="i,d in enumerate(c.difs)" py:replace="createICMAPElement(i,d)"/> 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"/> 32 27 33 <!-- not sure if we need to get the SRS value here -->28 <!-- not sure if we need to get the correct SRS value here --> 34 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> 35 39 36 <ns2:IMCMapContentElement ID="1" NameKey="Countries " canSetVisible="true" legendGraphic="" legendVisible="false" persistentToWMC="false" showInContent="true" showInLegend="true" visible="true"> 37 <ns2:IMCLayer ClassName="de.conterra.suite.adapter.wms.WMSLayer" CoverFileWorkerID="-1" ID="1" LayerID="Countries" LegendVisibility="false" MapServiceID="1" Visibility="true"/> 38 </ns2:IMCMapContentElement> 39 <ns2:IMCMapContentElement ID="2" NameKey="Great Britain" canSetVisible="true" legendGraphic="" legendVisible="false" persistentToWMC="false" showInContent="true" showInLegend="true" visible="true"> 40 <ns2:IMCLayer ClassName="de.conterra.suite.adapter.wms.WMSLayer" CoverFileWorkerID="-1" ID="2" LayerID="GreatBritain" LegendVisibility="false" MapServiceID="1" Visibility="true"/> 41 </ns2:IMCMapContentElement> 42 <ns2:IMCMapContentElement ID="4" NameKey="Settlements" canSetVisible="true" legendGraphic="" legendVisible="false" persistentToWMC="false" showInContent="true" showInLegend="true" visible="true"> 43 <ns2:IMCLayer ClassName="de.conterra.suite.adapter.wms.WMSLayer" CoverFileWorkerID="-1" ID="4" LayerID="Settlements" LegendVisibility="false" MapServiceID="1" Visibility="true"/> 44 </ns2:IMCMapContentElement> 45 <ns2:IMCInitialExtent MaxX="5.704144788849584" MaxY="62.34738779056453" MinX="-12.465118369045149" MinY="47.8425138409847"/> 46 <ns2:IMCFullExtent MaxX="180.0" MaxY="85.0" MinX="-184.0" MinY="-90.0"/> 47 </ns2:IMCMap> 48 <ns2:IMCOverviewMap visible="true" ImageFormat="image/png" SRS="EPSG:4326" SRSList="EPSG:4326,EPSG:27700"> 49 <ns2:IMCMapContentElement ID="5" NameKey="Countries " canSetVisible="true" legendVisible="false" persistentToWMC="false" showInContent="true" showInLegend="true" visible="true"> 50 <ns2:IMCLayer ClassName="de.conterra.suite.adapter.wms.WMSLayer" CoverFileWorkerID="-1" ID="5" LayerID="Countries" LegendVisibility="true" MapServiceID="1" Visibility="true"/> 51 </ns2:IMCMapContentElement> 52 <ns2:IMCMapContentElement ID="6" NameKey="Great Britain" canSetVisible="true" legendVisible="false" persistentToWMC="false" showInContent="true" showInLegend="true" visible="true"> 53 <ns2:IMCLayer ClassName="de.conterra.suite.adapter.wms.WMSLayer" CoverFileWorkerID="-1" ID="6" LayerID="GreatBritain" LegendVisibility="true" MapServiceID="1" Visibility="true"/> 54 </ns2:IMCMapContentElement> 55 <ns2:IMCInitialExtent MaxX="180.0" MaxY="143.61267605633805" MinX="-184.0" MinY="-148.61267605633805"/> 56 <ns2:IMCFullExtent MaxX="180.0" MaxY="85.0" MinX="-184.0" MinY="-90.0"/> 57 </ns2:IMCOverviewMap> 58 </ns2:IMCMapLayerConfig> 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> 59 48 </ns1:IMCWmcExtension> 60 49 </Extension> 61 50 </General> 62 51 <LayerList> 63 <for py:for="url in session['wmcURLs']" py:strip="True">64 ${XML(getWMCDocLayer(url))}52 <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"/> 65 54 </for> 66 55 </LayerList> -
TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/icmap_elements.kid
r3472 r3483 1 1 <!-- This is a bunch of named functions for use when creating input files for Con Terra --> 2 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"> 2 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" 3 xmlns:ns3="http://www.conterra.de/mapclient/businesstier/configuration/layer" 4 xmlns:ns2="http://www.conterra.de/mapclient/businesstier/configuration/hierarchy"> 3 5 4 <span py:def="createICMAPElement(i,d)"> 5 <ns2:IMCMapContentElement ID="${i}" NameKey="BGS Bedrock Lithostratigraphy" canSetVisible="true" showInLegend="true" visible="false"> 6 <ns2:IMCLayer ClassName="de.conterra.suite.adapter.wms.WMSLayer" ID="4" LayerID="bedrock_lithostratigraphy" LegendVisibility="true" MapServiceID="2" Visibility="true"/> 7 <ns2:IMCIdentify ChainID="0" ClassName="de.conterra.mapclient.businesstier.mapprocessing.query.IMCMapQueryElement" DatasourceID="2" IMCLayerID="4" MaxResults="10" NameKey="BGS Bedrock Lithostratigraphy" action="IdentifyResultClick"> 6 <span py:def="createIMCDatasourceElement(i,wmc)" py:strip="True"> 7 <ns3:IMCDatasource ClassName="de.conterra.suite.adapter.wms.WMSDatasource" ID="${i}" PooledConnections="0"> 8 <ns3:IMC_URL_Connection URL="${wmc.url}" /> 9 </ns3:IMCDatasource> 10 <ns3:IMCMapService Alias="${wmc.title}" DatasourceID="${i}" ID="${i}" Name="${wmc.title}" Opacity="100" RGBTranscolor="255,255,255" Type="Image" showInContent="true" treeNodeID="32807" visible="true"/> 11 </span> 12 13 <span py:def="createICMAPContentElement(i,layer)" py:strip="True"> 14 <ns2:IMCMapContentElement ID="${i}" NameKey="layer.title" canSetVisible="true" showInLegend="true" visible="false"> 15 <ns2:IMCLayer ClassName="de.conterra.suite.adapter.wms.WMSLayer" ID="${i}" LayerID="layer.name" LegendVisibility="true" MapServiceID="${i}" Visibility="true"/> 16 <ns2:IMCIdentify ChainID="0" ClassName="de.conterra.mapclient.businesstier.mapprocessing.query.IMCMapQueryElement" DatasourceID="${i}" IMCLayerID="${i}" MaxResults="10" NameKey="layer.title" action="IdentifyResultClick"> 8 17 <ns2:IMCDataBaseKeyField OperatorList="0" AliasKey="dummy" Name="dummy" Type="String"> 9 18 <ns2:IMCDataBaseResultField AliasKey="dummy" Name="dummy" Type="String"/> … … 12 21 </ns2:IMCMapContentElement> 13 22 </span> 14 15 <span py:def="createIMCDatasourceElement(i,j,url,name)">16 <ns3:IMCDatasource ClassName="de.conterra.suite.adapter.wms.WMSDatasource" ID="${i}" PooledConnections="0">17 <ns3:${url}"/>18 </ns3:IMCDatasource>19 <ns3:IMCMapService Alias="${name}" DatasourceID="${i}" ID="${j}" Name="${name}" Opacity="100" RGBTranscolor="255,255,255" Type="Image" showInContent="true" treeNodeID="32807" visible="true"/>20 </span>21 22 23 23 24 24 </html>
Note: See TracChangeset
for help on using the changeset viewer.