I need to generate maps with labels in multiple languages. Currently I have already imported the osm data into postgis and pusblish it with geoserver, but apparently after querying the feature (using the geoserver preview layer feature), I only see one column with name 'name'.

How can I import and then publish labels in multiple languages in the same layer. The result should be that for a given feature the label in the concatenation of the OSM tags values 'name' and 'name:en' (if the later exists, some features are missing this).

Update: For further reference. After searching more I found that the way you filter what gets imported into the db is using the 'style' file (defaults to default.style). In that file one need to add the second of the following lines to also import the name of a feature in English:

node,way    name    text    linear
node,way    name:en    text    linear

This tells osm2pgsql to create another column named 'name:en' of type text and store in it the values of the tags with key 'name:en'.

  • 1
    Have you imported the "name:en" data into the database as an attribute?
    – user30184
    Aug 12, 2016 at 6:19
  • @user30184 After a little more of searching I found that the 'default.style' used to import isn't actually a 'style' but rather a filter on what to import.... Yes know I have two columns, 'name' and 'name:en'.
    – Javier Mr
    Aug 12, 2016 at 6:29
  • 1
    Easiest would be to concatenate the fields in the database but you can also publish data with GeoServer through the SQL View system. There are a few alternatives for concatenation stackoverflow.com/questions/19942824/….
    – user30184
    Aug 12, 2016 at 6:50
  • @user30184, when you say 'SQL View system' are you referring to create a view in the db or some options inside geosever?
    – Javier Mr
    Aug 12, 2016 at 6:54
  • 1
    I rmean this GeoServer feature docs.geoserver.org/stable/en/user/data/database/sqlview.html.
    – user30184
    Aug 12, 2016 at 7:06

1 Answer 1


First thing to do is to make sure that osm2pgsql is converting the name:en tag into the PostGIS database. The default style https://github.com/openstreetmap/osm2pgsql/blob/master/default.style does not import it before adding a new line for "name:en" as

# OsmType Tag DataType Flags
node,way name:en text linear

Once the "name:en" data are in PostGIS you can concatenate them after the "name" tag with SQL. A few alternative ways for that can be found from the answers of https://stackoverflow.com/questions/19942824/how-to-concatenate-columns-in-a-postgres-select.

For publishing the concatenated tags you have also some alternatives:

  1. Alter table and add a new column for concatenated names
  2. Make a view into the database which includes a new, concatenated column, and publish this view with GeoServer
  3. Utilize the SQL View method with GeoServer and configure the SQL query on the GeoServer side by following the documentation http://docs.geoserver.org/stable/en/user/data/database/sqlview.html.

Note: If you want to publish OSM data also through WFS service you must rename all the attributes which contain colon in the name because they are invalid in GML. For example "name:en" is not valid as an attribute name but "name_en" is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.