I'm looking to make maps for printing, but would need to have all names in english since some of our staff don't read arabic. I've looked around online, but I haven't found any (sufficiently easy) way of achieving this, and would really appreciate some pointers on which way to go. I've dabbled with different renderers, but the only one I've achieved a decent worklflow with is Maperetive. I run WinXP and have little experience with nix-commandline environments. asked 27 Feb '11, 08:48 riyaah |
You say you've tried Maperitive, but you don't explain why it didn't fit your needs. Making Maperitive render English names is really quite simple: add a new line in the default rules (under the "properties" section):
(make sure it's a tab indent and not spaces). This will ensure English names will be used as default ones (but you can override this in any rule later). If English name is not defined, it will look for international name or a default name (which would probably be in Arabic). answered 27 Feb '11, 17:18 Breki 2
To improve this, you could additionally render int_name if name:en is empty.
(27 Feb '11, 17:32)
dieterdreist
Thank you! I don't know why I didn't see this in the Maperetive book, I looked around for quite a while!
(27 Feb '11, 17:54)
riyaah
@dieterdreist good suggestion, I've updated my answer
(27 Feb '11, 19:37)
Breki
|
Another option would be to preprocess the data using Osmosis with the TagTransform plugin. eg you could write rules to copy anything in the name:en or int_name tag to the name tag. This can output in .osm format, which you can then use as input for any of the usual rendering software (Maperitive, Mapnik, Mkgmap etc), and you don't have to change any of the rendering rules. answered 27 Feb '11, 20:05 Vclaw |
I can tell you for mapnik: simply update your tables. First overwrite the name field in your database with int_name if it is not empty, this is a fallback: UPDATE planet_osm_point SET name=int_name WHERE int_name IS NOT NULL; then overwrite again with name:en where present: UPDATE planet_osm_point SET name="name:en" WHERE "name:en" IS NOT NULL; in order to be able to do this, you will have to add int_name and name:en before importing to standard.style in your osm2pgsql-folder. If you want to keep the original name field content you would have to make a copy of the column before (but your question doesn't sound like). Repeat this command for all 4 relevant tables (point, polygon, line, roads). Afterwards you might want to delete the now obsolete columns name_int and name:en to save space. This procedure is the simplest (especially if you are not planning to apply diffs) but of course you could also modify your rendering rules for every occurence of name. answered 27 Feb '11, 16:26 dieterdreist Personally, I would tend to add views using CASE WHEN or COALESCE statements (e.g., CREATE VIEW osm_planet_way_nameen AS SELECT a.*, CASE WHEN ... FROM osm_planet_way). It is not hugely difficult to d global search and replace for this type of change in the mapnik XML. I would also use the hstore option on osm2pgsql to make all tags available during the load. In this way the data can be refreshed without having to repeat DML statements like UPDATE.
(27 Feb '11, 18:05)
SK53 ♦
|