<div>Thanks for the information.</div>
<div> </div>
<div><em>>>>>1. Check if the image already exists in the cache.<br><br>>>>>>I believe this is handled by TileCache at the 'Service' level, depending<br>>>>>>on what you mean by 'cache'.
<br></em></div>
<div>Basically from the class MyDGLayer(Layer):<br> </div>
<div>I only want to "question" the service if I don't have the image cached on my disk already. What method would I call to check that? They don't have one call to question and retrieve. Basically you call one url to ask if they have an image then I will call the WMS service if they do. Their WMS service returns an image, right or wrong, always. So I could eliminate two hits on their server if I knew I had the image on disk already.
</div>
<div> </div>
<div>Thanks in advance,</div>
<div>Linda<br><br> </div>
<div><span class="gmail_quote">On 10/15/07, <b class="gmail_sendername">Christopher Schmidt</b> <<a href="mailto:crschmidt@metacarta.com">crschmidt@metacarta.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">On Mon, Oct 15, 2007 at 09:49:19AM -0600, Linda Rawson wrote:<br>> Basically I need to do the following:
<br>><br>> 1. Check if the image already exists in the cache.<br><br>I believe this is handled by TileCache at the 'Service' level, depending<br>on what you mean by 'cache'.<br><br>> 2. If not then check for the image with the provider by utilizing a url
<br>> that returns a value.<br>> 3. Check the value and If still no image then try another WMS service<br>> provider.<br>> 4. If still no image then return a noimage tile.<br><br>Right. You'll need to add something like:
<br><br>class MyDGLayer(Layer):<br> def renderTile(self: tile):<br> bbox = tile.bbox()<br> u = urllib.urlopen('<a href="http://digitalglobe.com/tile?bbox=%s">http://digitalglobe.com/tile?bbox=%s</a>' % bbox)
<br> tile.data = u.read()<br> if not tile.data:<br> u = urllib.urlopen('<a href="http://wms.example.com/tile?bbox=%s">http://wms.example.com/tile?bbox=%s</a>' % bbox)<br> tile.data =
u.read()<br> if not tile.data:<br> tile.data = open("/my/local/no_image.png").read()<br> return tile.data<br><br>> Can you direct me to the best python resource for these things?<br><br>
You'll probably just want to look at basic Python documentation for<br>'loading data from remote servers' or 'loading data over http' or<br>something like that. I never looked at any resources other than Google
<br>for learning Python, so I can't help specifically.<br><br>Sticking that at the end of the Layer.py file, and then creating a:<br><br>[digitalglobe]<br>type=MyDGLayer<br><br>Should get you started.<br><br>Regards,<br>
--<br>Christopher Schmidt<br>MetaCarta<br></blockquote></div><br>