From OpenStreetMap Wiki
Jump to navigation Jump to search

is posible a port for symbian nokia handhelds, they have python? Luisatala

Just try running it, see if anything works? Ojw 07:45, 20 August 2008 (UTC)

I tried out Rana and notices some issues. Where ist the best place to get more information about the development of Rana (and maybe submit patches)? Fredo

Ask here, or email ojwlists at gmail. If you have SVN access you could commit patches directly. Ojw 18:51, 15 November 2008 (UTC)
I don't have SVN access, and I don't think I need one. I just stubled upon some issues while trying out Rana. I could fix some of them, but the fixes might be too hackish to go into SVN without review. I'll just describe the issues and fixes here and you can see whether they are worth being committed.
tiledata2 not handlig unicode correctly: Rana/Maps states that "initialParse does not seem to handle utf8 properly". I think I was able to fix that with a quite simple change:
---	(Revision 11935)
+++	(Arbeitskopie)
@@ -213,7 +213,7 @@
   def packTag(self, type, tags, tag):
     string = tags.get(tag, None)
-      string = str(string)
+      string = string.encode('utf-8')
       return(type + struct.pack("H", len(string)) + string)
Missing enums.txt: Rana complained about not finding vector map data, which lead to an infinite loop. I first made the error message a bit more verbose and made rana quit on this error:
--- modules/	(Revision 11935)
+++ modules/	(Arbeitskopie)
@@ -85,7 +85,8 @@
         #print "%d = '%s'" % (k,v)
         self.enums[k] = v
     except IOError:
-      print "Couldn't find vector map data"
+      print "Couldn't find vector map data. Expected enum file in %s" % filename
+      sys.exit(-1)
   def setStyle(self, style, cr):
     styleDef = self.highways.get(style, None)
I could then fix the issue by copying the enums.txt from the tiledata2 source directory to the rana/data/tiledata directory. Maybe this file should be part of the svn tree of rana?
Missing distance information: When opening the places list, rana ran into another infinite loop. It seems to be because one city was missing appropriate distance information. I don't know why this occured and where to fix it, but I could make rana ignore this, so I was at least able to see the places list:
--- modules/	(Revision 11935)
+++ modules/	(Arbeitskopie)
@@ -46,10 +46,14 @@
     action += "|set:menu_poi_location:%f,%f" % (item['lat'], item['lon'])
     action += "|set:menu_poi_item:%d" % index
     action += "|set:menu:poi"
+    if 'd' in item:
+      distance = "%1.1f km away" % (item['d'])
+    else:
+      distance = ""
-      "%1.1f km away" % (item['d']),
+      distance,
   def describeCategory(self, item, category, index):
Parent menus scroll along with submenus: On some menus, for example the list of cities, I noticed that the parent menu (villages, towns, cities) scroll when the child menu is scrolled. So when I scroll two items down in the list of cities and then go back, I only see the third item of the parent menu (thus, "cities"). When scrolling down some more cities, I only see an empty parent menu when going back. This leaves the impression of a broken menu. I wasn't yet able to find a fix for this.
I hope this is of some help. Rana looks really promising to me, and I'd like to regularly use it, but there seem to be some issues that currently make it unreliable. I'm confident that this will get sorted out in the future.
--Fredo 12:28, 16 November 2008 (UTC)
Layer range error in initialParse: When indexing a Great Britain planet extract, it failed with this exception: "struct.error: byte format requires -128 <= number <= 127". Here is the patch to fix the problem:
---	(revision 15125)
+++	(working copy)
@@ -199,6 +199,8 @@
       layer = int(tags.get('layer',0))
     except ValueError:  # yeah thanks for whoever entered "=1" as a layer number...
       layer = 0
+    if layer < -128: layer = -128
+    if layer > 127: layer = 127
     data += struct.pack("b", layer)
     # Important tags
--Enrico 9:13, 21 May 2008 (UTC)