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's gravatar image

riyaah
51116
accept rate: 0%


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):

text : @any([[name:en]], int_name, name)

(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).

http://maperitive.net/docs/manual/Properties/Text.html

permanent link

answered 27 Feb '11, 17:18

Breki's gravatar image

Breki
2.0k51743
accept rate: 10%

edited 27 Feb '11, 19:36

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.

permanent link

answered 27 Feb '11, 20:05

Vclaw's gravatar image

Vclaw
9.1k891140
accept rate: 22%

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.

permanent link

answered 27 Feb '11, 16:26

dieterdreist's gravatar image

dieterdreist
3.6k113466
accept rate: 3%

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 ♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×369
×61
×1

question asked: 27 Feb '11, 08:48

question was seen: 5,701 times

last updated: 27 Feb '11, 20:05

powered by OSQA