From jeff at jsintl.org Wed Aug 25 01:54:55 2010 From: jeff at jsintl.org (Jeff Haack) Date: Wed, 25 Aug 2010 09:54:55 +0400 Subject: [Osmlib-user] osmexport question with translations Message-ID: Hi, I'm no Ruby expert, but I've been playing around with osmexport for awhile and trying to export various osm data to shapefiles. The biggest problem I face is when I want to export the names of objects in a language different from that with the tag "name", because no matter what I do the colon in "name:en" doesn't work in Ruby. ways do if highway :road << {:Type => highway, :Name => name:en, :Surface => surface} end end Of course this doesn't work. It looks like I should do something like: ways do if tags['name:en'] ... end end But I still don't understand how to get the value of the "name:en" tag into the Name field. Help? Jeff -------------- next part -------------- An HTML attachment was scrubbed... URL: From numenor at ancalime.de Wed Aug 25 16:58:23 2010 From: numenor at ancalime.de (Holger =?iso-8859-15?q?Sch=F6ner?=) Date: Wed, 25 Aug 2010 22:58:23 +0200 Subject: [Osmlib-user] osmexport question with translations In-Reply-To: References: Message-ID: <201008252258.25168.numenor@ancalime.de> Hi Jeff, Am Mi, 25. August 2010 schrieb Jeff Haack: > Of course this doesn't work. It looks like I should do something like: > > ways do > if tags['name:en'] > ... > end > end > > But I still don't understand how to get the value of the "name:en" tag > into the Name field. Help? I might be misunderstanding you, and I do not have much experience with osmlib myself, but have you tried something like: ways do if tags['name:en'] tags['name'] = tags['name:en'] end end The methods like "highway", ... do not exist, but are actually syntactic sugar and are mapped in the OSMObject#method_missing method to the tags['highway'], ... hash access. So in case a key is not a valid ruby identifier, you can use that syntax directly. This also works for assignments to the key. Yours, -- Holger Schoener numenor at ancalime.de