Are there any available tools or a recommend methods for displaying a tag or word cloud (also know as wordle) onto a world map, much like in this example: Map: United States of surnames? (There may be other examples on the NY Times.)

Note that that in the example above, word are located by fixed coordinates, whereas text clouding might be implemented with the wordle algorithm (as described on SO) in an automatic manner. So, is there a software that let you put words at random on a given country, or do you think it's best to tweak the wordle original algorithm (e.g., by adding constraints based on predefined frontiers)?

  • possible duplicate of spatial tag clouds - "tag maps" – underdark Feb 2 '11 at 9:00
  • @underdark Thanks for pointing out that thread. However, it seems to me more related to geotagging, whereas I am looking for a solution where we don't have to associate known spatial coordinates (e.g., town or counties) to each word. In other words, let the layout of words into a country be free of constraints other than its actual frontiers. If others feel it is really a duplicate, I can remove it without any prob. – chl Feb 2 '11 at 9:41
  • @chl: So the location of words inside the boundaries has no meaning? Then it's no duplicate. – underdark Feb 2 '11 at 9:58
  • @underdark Yes, exactly. The main idea of wordle is trying to find a good-looking spatial layout with words sized by their relative frequencies. Then, I just want to constraint the choice of possible (x,y) coordinates on the "borders". – chl Feb 2 '11 at 10:32
  • There are a few tag/cloud threads here in GSE. gis.stackexchange.com/search?q=tag+cloud It seems that there should be some effort (perhaps initiated by the stack exchange community) to differentiate cloud from tag/cloud. Even with tag in my search I got "it looks like" all of the cloud threads returned. Maybe we could start a thread on meta to discuss. Or maybe it doesn't bother anyone else. ??? – Brad Nesom Feb 2 '11 at 13:43

It would take very little tweaking: approximate the polygon boundary by isothetic lines (that is, horizontal and vertical segments) and, as initial conditions, place boxes (with blank content) aligned along those lines in the exterior of the polygon and in the interior of the polygon's bounding box. At this point the configuration would look exactly as if the Wordle algorithm had been going for a while and had happened to place the first words around the perimeter of the bounding box. Let the algorithm take over from there.

In effect, this amounts to representing the polygon with a quadtree from the outset and otherwise exactly reproducing the Wordle algorithm.

If you're not placing thousands of words into the polygon and if you have a little computing time to spare, you don't have to code a spatial index at all: you can perform collision detection using brute-force all-pairs comparisons of the bounding boxes. With a tiny bit more work you can maintain lists of the word locations sorted by x- and y-coordinates and exploit these lists to streamline the collision detection algorithm.


Very trick. I'm trying to do something like that myself, but to produce typographic maps like this one from Axis Maps.

enter image description here

You can try something with qgis or mapnik, the basics would be:
1)Count the words and generate a weight by the number of occurrences.
2)generate random points inside a poligon.
3)for each point upload a word and it's weight to attibute table.
4)Draw the text with font size based on the weight.

You can also add a random rotation and colors to the table.

  • (+1) Thanks for pointing out typographic maps. It reminds me that I came across cool stuff some months ago. I'll give it a try but I was wondering whether the available Python code contributed by @aeby on SO would not be helpful too, providing I add contraints on country boundaries. I'm not familiar enough with QGis but I will try to learn it. – chl Feb 2 '11 at 19:01
  • Placing words at uniformly random points will generally produce many overlaps. If the words are uniformly scaled to almost fill the polygon--which in most cases is the desirable situation--then using random points is certain not to work. It would be a good start for a spatial simulated annealing algorithm, though :-). – whuber Feb 3 '11 at 16:44
  • They wont overlap because qgis and mapnik have collision detectors. But some words will be suppressed. There are many other problems, like, how many words would you need depending on the polygon size? – Pablo Feb 3 '11 at 17:37
  • @whuber, Following your ideia, Maybe instead of random points, the algorithm may start filling the polygon with other polygons with the word size from top left until botton right. then label these polygons. – Pablo Feb 3 '11 at 17:45

Tagxedo looks good. Too bad it uses Silverlight.

  • (+1) Looks good, though it would be best not to rely on Silverlight. – chl Feb 2 '11 at 10:35

This might be useful: A Constructive Genetic Approach to Point-Feature Cartographic Label Placement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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