[Tilecache] ImageLayer and ArcXML errors in trunk - was Caching a raster saved on the local disk

Simone Gadenz simone.gadenz at jrc.it
Tue May 6 10:13:24 EDT 2008


Ok, I installed the trunk version. Still getting errors using ImageLayer and
ArcXML layer type.

1 - The ImageLayer is defined as:

[etland]
type=ImageLayer
filebounds=6.23,42.52,8.24,44.58
file=C:/MapData/TestLargeRaster/prova.jpg

and it throws now the following error:

C:\Inetpub\wwwroot\ts\TileCache>tilecache_seed.py
"http://139.191.1.147/ts/tilec
ache/tilecache.cgi?" etland 0 2
###### (0, 0, 0), (2, 1, 0)
C:\Python25\lib\site-packages\PIL\Image.py:1702: DeprecationWarning: integer
arg
ument expected, got float
  return Image()._new(core.new(mode, size))
Traceback (most recent call last):
  File "C:\Inetpub\wwwroot\ts\TileCache\tilecache_seed.py", line 9, in
<module>
    TileCache.Client.main()
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Client.py", line 106, in
main
    seed(svc, base, layer, map(int, sys.argv[3:]))
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Client.py", line 92, in
seed
    svc.renderTile(tile)
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Service.py", line 134, in
rend
erTile
    data = layer.render(tile)
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Layer.py", line 361, in
render

    return self.renderTile(tile)
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Layers\Image.py", line 51,
in
renderTile
    sub = self.image.transform(crop_size, PILImage.EXTENT, (min_x, min_y,
max_x,
 max_y))
  File "C:\Python25\lib\site-packages\PIL\Image.py", line 1570, in transform
    im = new(self.mode, size, None)
  File "C:\Python25\lib\site-packages\PIL\Image.py", line 1702, in new
    return Image()._new(core.new(mode, size))
MemoryError

2- the ArcXMl is defined as:

[dma_inf_sm]
type=ArcXML
url=http://139.191.254.26/servlet/com.esri.esrimap.Esrimap?ServiceName=dma_i
nf_sm&ClientVersion=9.2
layers=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,2
6,27,28,29,30,31,32,33,34,35,36,37,38,39a,39b,39c,39d,40,41,42,43,44,45,46,4
7
bbox=-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892

and it throws the error below. The ArcXMl is correct because if posted
directly at the same address specified in config produce the correct result.

C:\Inetpub\wwwroot\ts\TileCache>tilecache_seed.py
"http://139.191.1.147/ts/tilec
ache/tilecache.cgi?" dma_inf_sm 0 2
###### (0, 0, 0), (1, 1, 0)
Traceback (most recent call last):
  File "C:\Inetpub\wwwroot\ts\TileCache\tilecache_seed.py", line 9, in
<module>
    TileCache.Client.main()
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Client.py", line 106, in
main
    seed(svc, base, layer, map(int, sys.argv[3:]))
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Client.py", line 92, in
seed
    svc.renderTile(tile)
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Service.py", line 134, in
rend
erTile
    data = layer.render(tile)
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Layer.py", line 361, in
render

    return self.renderTile(tile)
  File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Layers\ArcXML.py", line
45, in
 renderTile
    raise TileCacheException("Error fetching URL. Exception was: %s\n Input
XML:
\n %s " % (E, xml))
TileCache.Service.TileCacheException: Error fetching URL. Exception was:
('http
error', 401, 'Unauthorized', <httplib.HTTPMessage instance at 0x021698A0>)
 Input XML:
 <?xml version="1.0" encoding="UTF-8" ?>
<ARCXML version="1.1">
<REQUEST>
<GET_IMAGE>
<PROPERTIES>
<FEATURECOORDSYS
string="PROJCS[&quot;GoogleSphere&quot;,GEOGCS[&quot;GoogleSphe
reCS&quot;,DATUM[&quot;&lt;custom&gt;&quot;,SPHEROID[&quot;&lt;custom&gt;&qu
ot;,
6378137.0,0.0]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.
0174
532925199433]],PROJECTION[&quot;Mercator&quot;],PARAMETER[&quot;False_Eastin
g&qu
ot;,0.0],PARAMETER[&quot;False_Northing&quot;,0.0],PARAMETER[&quot;Central_M
erid
ian&quot;,0.0],PARAMETER[&quot;standard_parallel_1&quot;,0.0],UNIT[&quot;Met
er&q
uot;,1.0]]" />
<FILTERCOORDSYS
string="PROJCS[&quot;GoogleSphere&quot;,GEOGCS[&quot;GoogleSpher
eCS&quot;,DATUM[&quot;&lt;custom&gt;&quot;,SPHEROID[&quot;&lt;custom&gt;&quo
t;,6
378137.0,0.0]],PRIMEM[&quot;Greenwich&quot;,0.0],UNIT[&quot;Degree&quot;,0.0
1745
32925199433]],PROJECTION[&quot;Mercator&quot;],PARAMETER[&quot;False_Easting
&quo
t;,0.0],PARAMETER[&quot;False_Northing&quot;,0.0],PARAMETER[&quot;Central_Me
ridi
an&quot;,0.0],PARAMETER[&quot;standard_parallel_1&quot;,0.0],UNIT[&quot;Mete
r&qu
ot;,1.0]]" />
<ENVELOPE minx="-20037508.3428" miny="-20037508.3428" maxx="20037508.3428"
maxy=
"20037508.3428" />
<IMAGESIZE height="256" width="256" />
<LAYERLIST >
<LAYERDEF id="0" visible="true" />
<LAYERDEF id="1" visible="true" />
<LAYERDEF id="2" visible="true" />
<LAYERDEF id="3" visible="true" />
<LAYERDEF id="4" visible="true" />
<LAYERDEF id="5" visible="true" />
<LAYERDEF id="6" visible="true" />
<LAYERDEF id="7" visible="true" />
<LAYERDEF id="8" visible="true" />
<LAYERDEF id="9" visible="true" />
<LAYERDEF id="10" visible="true" />
<LAYERDEF id="11" visible="true" />
<LAYERDEF id="12" visible="true" />
<LAYERDEF id="13" visible="true" />
<LAYERDEF id="14" visible="true" />
<LAYERDEF id="15" visible="true" />
<LAYERDEF id="16" visible="true" />
<LAYERDEF id="17" visible="true" />
<LAYERDEF id="18" visible="true" />
<LAYERDEF id="19" visible="true" />
<LAYERDEF id="20" visible="true" />
<LAYERDEF id="21" visible="true" />
<LAYERDEF id="22" visible="true" />
<LAYERDEF id="23" visible="true" />
<LAYERDEF id="24" visible="true" />
<LAYERDEF id="25" visible="true" />
<LAYERDEF id="26" visible="true" />
<LAYERDEF id="27" visible="true" />
<LAYERDEF id="28" visible="true" />
<LAYERDEF id="29" visible="true" />
<LAYERDEF id="30" visible="true" />
<LAYERDEF id="31" visible="true" />
<LAYERDEF id="32" visible="true" />
<LAYERDEF id="33" visible="true" />
<LAYERDEF id="34" visible="true" />
<LAYERDEF id="35" visible="true" />
<LAYERDEF id="36" visible="true" />
<LAYERDEF id="37" visible="true" />
<LAYERDEF id="38" visible="true" />
<LAYERDEF id="39a" visible="true" />
<LAYERDEF id="39b" visible="true" />
<LAYERDEF id="39c" visible="true" />
<LAYERDEF id="39d" visible="true" />
<LAYERDEF id="40" visible="true" />
<LAYERDEF id="41" visible="true" />
<LAYERDEF id="42" visible="true" />
<LAYERDEF id="43" visible="true" />
<LAYERDEF id="44" visible="true" />
<LAYERDEF id="45" visible="true" />
<LAYERDEF id="46" visible="true" />
<LAYERDEF id="47" visible="true" />

</LAYERLIST>
</PROPERTIES>
</GET_IMAGE>
</REQUEST>
</ARCXML>

Thanks for any help.

Simone

-----Original Message-----
From: Christopher Schmidt [mailto:crschmidt at metacarta.com] 
Sent: martedì 6 maggio 2008 13.48
To: Simone Gadenz
Cc: tilecache at openlayers.org
Subject: Re: [Tilecache] Caching a raster saved on the local disk

On Tue, May 06, 2008 at 10:18:42AM +0200, Simone Gadenz wrote:
> Following the current post I tried to cache a local image using the image
> layer. I had exactly the same problem showed in this post at the beginning
> of this year:
> http://openlayers.org/pipermail/tilecache/2008-January/000686.html.
> 
> Doing some investigation it turned out that the line that fails is the 
> 
> self.image = Image.open(self.file)
> 
> into the Image.py file.

TC 2.01 is broken; use SVN. (I'll push out a new release sometime later
this week.)

> I am not a pyton programmer at all, I did a simple test that was to run
the
> followung code into a single file and then to include the same code into
the
> Image.py. 
> 
> import sys
> import Image
> 
> for infile in sys.argv[1:]:
>     try:
>         im = Image.open(infile)
>         print infile, im.format, "%dx%d" % im.size, im.mode
>     except IOError:
>         pass
> 
> 
> It worked as single file but it failed into the Image.py
> What I find really strange is that also the other layers defined in the
> config file that were working before the introduction of the new
imagelayer
> definition stopped working.
> The error is not demepnding on the layer called and it is:
> 
> 
> C:\Inetpub\wwwroot\ts\TileCache>tilecache_seed.py
> "http://139.191.1.147/ts/tile
> ache/tilecache.cgi?" simone 0 6
> C:/MapData/TestLargeRaster/prova.jpg
> Traceback (most recent call last):
>   File "C:\Inetpub\wwwroot\ts\TileCache\tilecache_seed.py", line 9, in
> <module>
>     TileCache.Client.main()
>   File "C:\Inetpub\wwwroot\ts\TileCache\TileCache\Client.py", line 96, in
> main
>     layer = svc.layers[sys.argv[2]]
> KeyError: 'simone'
> 
> 
> Ideas?
> 
> 
> Simone
> 
> 
> -----Original Message-----
> From: fredrik.lundh at gmail.com [mailto:fredrik.lundh at gmail.com] On Behalf
Of
> Fredrik Lundh
> Sent: lunedì 5 maggio 2008 14.18
> To: Simone Gadenz
> Subject: Re: [Tilecache] Caching a raster saved on the local disk
> 
> > is it possible to create a cache structure for an image stored on the
> local
> > disk? In case what would be the best strategy to integrate this
> > functionalities into the existing scripts? Would be possible to reuse
> > functions for cutting metatiles?
> 
> sounds like the ImageLayer handler is what you want; see the first two
> configurations on this page for examples:
> 
> http://svn.tilecache.org/tags/tilecache/release-2.01/docs/EXAMPLES.txt
> 
> </F>
> 
> _______________________________________________
> Tilecache mailing list
> Tilecache at openlayers.org
> http://openlayers.org/mailman/listinfo/tilecache

-- 
Christopher Schmidt
MetaCarta




More information about the Tilecache mailing list