[Talk-us] Abbreviating names in tools

Michal Migurski mike at stamen.com
Sat Oct 6 22:04:57 BST 2012

On Oct 4, 2012, at 11:26 AM, andrzej zaborowski wrote:

> Hi,
> there's been a lot of talk at one point about abbreviating names in
> the OSM database vs. doing it when processing the data at consumers
> end.  Since mapnik now supports alternative label placements I gave
> rendering automatically abbreviated names a try.  This resulted in a
> (so far) tiny C library (https://github.com/balrog-kun/shrtnms) that
> abbreviates the names of map features that you give it.  It's very
> rough but it already handles a couple of the main corner cases.  It's
> just a start on collecting the list of all the abbreviations
> applicable in all the map languages.  Currently only has basic lists
> for Polish, Spanish and English, where the rules don't differ so much.
> As an example German is more tricky.
> I see two ways to use it for rendering:
> * inside mapnik stylesheets, perhaps by calling the C function from
> the SQL queries.  This would require adding the postgres bindings,
> something I've never done.
> * inside osm2pgsql so that the abbreviated names are stored in table columns.
> As a quick hack I went for the latter option.  It gets tricky with
> hstore and multilingual maps but it works as a first attempt.

I like the in-tool option as well. These days I prefer Imposm, so I wrote this abbreviator in Python:

	(code: http://teczno.com/s/cx2)

Only does U.S. streets so far. The abbr_name / short_name tags are a great hint, Dave and Peter!

michal migurski- mike at stamen.com

michal migurski- mike at stamen.com

More information about the Talk-us mailing list