Re: [OSM-talk] [OSM-dev] Online/offline slippy map finished.

2008-05-09 Thread Andy Allan
On Fri, May 9, 2008 at 12:01 PM, Sebastian Spaeth [EMAIL PROTECTED] wrote:
 Frustrated by the lack of a nice map viewing tool for my eee pc, I have
 written my own hack. It's a local OpenLayers installation that is served
 by a python script (stock python, no additional libs). If the tile does
 not exist yet, it will be downloaded from the OSM tile server and be
 stored locally, so those tiles will be available for offline viewing.
 Tiles will be downloaded and stored in a directory called 'tiles' in the
 pyweb directory. If anybody finds it useful that is cool, otherwise I
 have just scratched my itch.

I'll need to check this out - I've found it frustrating trying to demo
the map even if I'm carrying my laptop around. On the vague chance
that there's wireless available, all I get is ooh, that's really
slow when it's the crappy wireless that's the problem :-) Simple
local caching sounds good.

Cheers,
Andy

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] [OSM-dev] Online/offline slippy map finished.

2008-05-09 Thread Nick Black
Great idea - this could be really useful.

I get lots of errors running on OS X 10.5.2 though:



Exception happened during processing of request from ('127.0.0.1', 63833)
Traceback (most recent call last):
  File 
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py,
line 222, in handle_request
  File 
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py,
line 241, in process_request
  File 
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py,
line 254, in finish_request
  File 
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/SocketServer.py,
line 522, in __init__
  File 
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/BaseHTTPServer.py,
line 316, in handle
  File 
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/BaseHTTPServer.py,
line 310, in handle_one_request
  File ./pymap, line 47, in do_GET
if e.errno == os.errno.ENOENT:
AttributeError: 'module' object has no attribute 'errno'


$ python --version
Python 2.5

Any ideas?

Cheers,







On Fri, May 9, 2008 at 12:34 PM, Andy Allan [EMAIL PROTECTED] wrote:
 On Fri, May 9, 2008 at 12:01 PM, Sebastian Spaeth [EMAIL PROTECTED] wrote:
 Frustrated by the lack of a nice map viewing tool for my eee pc, I have
 written my own hack. It's a local OpenLayers installation that is served
 by a python script (stock python, no additional libs). If the tile does
 not exist yet, it will be downloaded from the OSM tile server and be
 stored locally, so those tiles will be available for offline viewing.
 Tiles will be downloaded and stored in a directory called 'tiles' in the
 pyweb directory. If anybody finds it useful that is cool, otherwise I
 have just scratched my itch.

 I'll need to check this out - I've found it frustrating trying to demo
 the map even if I'm carrying my laptop around. On the vague chance
 that there's wireless available, all I get is ooh, that's really
 slow when it's the crappy wireless that's the problem :-) Simple
 local caching sounds good.

 Cheers,
 Andy

 ___
 dev mailing list
 [EMAIL PROTECTED]
 http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev




-- 
Nick Black

http://www.blacksworld.net

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] [OSM-dev] Online/offline slippy map finished.

2008-05-09 Thread Sebastian Spaeth
Nick Black wrote:
 Great idea - this could be really useful.
 
 I get lots of errors running on OS X 10.5.2 though:

   File ./pymap, line 47, in do_GET
 if e.errno == os.errno.ENOENT:
 AttributeError: 'module' object has no attribute 'errno'
 

I guess this should work on all (unixy) OS then:

-import urllib,re,os,sys,stat
+import urllib,re,os,sys,stat,errno
- if e.errno != os.errno.EEXIST
+ if e.errno != errno.EEXIST
-   if e.errno == os.errno.ENOENT
+   if e.errno == errno.ENOENT


I updated the tar ball on dev.openstreetmap.org as well.

spaetz

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] [OSM-dev] Online/offline slippy map finished.

2008-05-09 Thread Nick Black
Cool - its all working now.

Is there any cache expiry for tiles or is it a case of deleting the
tile directory?

Cheers,



On Fri, May 9, 2008 at 1:01 PM, Sebastian Spaeth [EMAIL PROTECTED] wrote:
 Nick Black wrote:
 Great idea - this could be really useful.

 I get lots of errors running on OS X 10.5.2 though:

   File ./pymap, line 47, in do_GET
 if e.errno == os.errno.ENOENT:
 AttributeError: 'module' object has no attribute 'errno'
 

 I guess this should work on all (unixy) OS then:

 -import urllib,re,os,sys,stat
 +import urllib,re,os,sys,stat,errno
 - if e.errno != os.errno.EEXIST
 + if e.errno != errno.EEXIST
 -   if e.errno == os.errno.ENOENT
 +   if e.errno == errno.ENOENT


 I updated the tar ball on dev.openstreetmap.org as well.

 spaetz




-- 
Nick Black

http://www.blacksworld.net

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] [OSM-dev] Online/offline slippy map finished.

2008-05-09 Thread Sebastian Spaeth
Andy Allan wrote:
 I'll need to check this out - I've found it frustrating trying to demo
 the map even if I'm carrying my laptop around. On the vague chance
 that there's wireless available, all I get is ooh, that's really
 slow when it's the crappy wireless that's the problem :-) Simple
 local caching sounds good.

Last public post on this toy, I promise.
Some people thought it might be useful so it's here now:
http://svn.openstreetmap.org/applications/viewer/pymap

I haven't tested how well it performs (Simplicity was the first goal),
but it will certainly be better than a crappy wlan. It would also be
trivial to make it update old local tiles on demand.

I agree that this would be ideal to showcase OSM maps e.g. at
conferences where WLAN is existent but horrible.

spaetz

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] [OSM-dev] Online/offline slippy map finished.

2008-05-09 Thread Sebastian Spaeth
Nick Black wrote:
 Cool - its all working now.
 
 Is there any cache expiry for tiles or is it a case of deleting the
 tile directory?

No expiry so far, but it would be easy to make it so. All the pieces are
ready, basically.

Until then, just deleting old tiles must do.
find tiles -mtime 30 -exec rm {} \;
will delete all tiles that are older than 30 days, for example. Use that
command with great care.

Sebastian

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] [OSM-dev] Online/offline slippy map finished.

2008-05-09 Thread Christopher Schmidt
On Fri, May 09, 2008 at 04:09:28PM +0200, Juan Lucas Dominguez Rubio wrote:
 lol, thank you Sebastian for that code. I have tested it on Windows XP and 
 the only problem is that images are not shown, everything else seems to be in 
 place. I don't think it's because of using / instead of \. Apparently the 
 HttpServer only delivers the first bytes of the PNG files, and then closes 
 the connection. I have tried to add the file length and proper file type in 
 the header but it still closes the connection too soon.
  
 wget.exe is unable to get the whole image file either.
 I'll keep on trying, lol

On Windows, all Python read/writes have to be opened with rb/rw instead
of r/w. Changing Line 36 to:

f = open(installpath + path, rb)

Might do it.

Regards,
-- 
Christopher Schmidt
MetaCarta

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk


Re: [OSM-talk] [OSM-dev] Online/offline slippy map finished.

2008-05-09 Thread Raphael Studer
Hi Sebastian,

I get a lof of errors like that:


Exception happened during processing of request from ('192.168.23.5', 56424)
Traceback (most recent call last):
  File /usr/lib/python2.5/SocketServer.py, line 222, in handle_request
self.process_request(request, client_address)
  File /usr/lib/python2.5/SocketServer.py, line 241, in process_request
self.finish_request(request, client_address)
  File /usr/lib/python2.5/SocketServer.py, line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File /usr/lib/python2.5/SocketServer.py, line 522, in __init__
self.handle()
  File /usr/lib/python2.5/BaseHTTPServer.py, line 316, in handle
self.handle_one_request()
  File /usr/lib/python2.5/BaseHTTPServer.py, line 310, in handle_one_request
method()
  File ./pymap, line 50, in do_GET
self.return_file(self.path)
  File ./pymap, line 30, in return_file
self.send_response(200)
  File /usr/lib/python2.5/BaseHTTPServer.py, line 371, in send_response
self.send_header('Date', self.date_time_string())
  File /usr/lib/python2.5/BaseHTTPServer.py, line 376, in send_header
self.wfile.write(%s: %s\r\n % (keyword, value))
  File /usr/lib/python2.5/socket.py, line 262, in write
self.flush()
  File /usr/lib/python2.5/socket.py, line 249, in flush
self._sock.sendall(buffer)
error: (32, 'Broken pipe')


Does anyone know where they come from?

Regards
Raphael

___
talk mailing list
talk@openstreetmap.org
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk