Custom Fonts in Open Street Map

The default font family used for rendering text labels on maps created by Mapnik (and the one shipped with it) is Deja Vu. Deja Vu Sans Book is a pretty nice font, and can be seen, for example, in all the labels used on Open Street Map:

image

So what if you want to render text onto a custom tile overlay using a different font?

  • Perhaps you’d like to create a custom tile layer using image labels to match Google Maps?
  • Or how about going for a Bing Maps feel with image labels?

To do so, first you need to register the location of the directory containing the fonts you want to use. For example, to make all the installed Windows fonts available to Mapnik, add the following to the top of your python render script:

mapnik.register_fonts('c:/windows/fonts/')

Mapnik needs to reference these fonts by their font name (not by filename, for example); To find out the correct name to use for each font, once you’ve registered your custom fonts directory you can call the following:

for face in mapnik.FontEngine.face_names(): print face

On a fairly vanilla installation of Window 7, this gave me a list of available fonts as follows:

  • Aharoni Bold
  • Andalus Regular
  • Andy Bold
  • Angsana New Bold
  • Angsana New Bold Italic
  • Angsana New Italic
  • Angsana New Regular
  • AngsanaUPC Bold
  • AngsanaUPC Bold Italic
  • AngsanaUPC Italic
  • AngsanaUPC Regular
  • Aparajita Bold
  • Aparajita Bold Italic
  • Aparajita Italic
  • Aparajita Regular
  • Arabic Typesetting Regular
  • Arial Black
  • Arial Bold
  • Arial Bold Italic
  • Arial Italic
  • Arial Regular
  • Browallia New Bold
  • Browallia New Bold Italic
  • Browallia New Italic
  • Browallia New Regular
  • BrowalliaUPC Bold
  • BrowalliaUPC Bold Italic
  • BrowalliaUPC Italic
  • BrowalliaUPC Regular
  • Buxton Sketch Regular
  • Calibri Bold
  • Calibri Bold Italic
  • Calibri Italic
  • Calibri Regular
  • Candara Bold
  • Candara Bold Italic
  • Candara Italic
  • Candara Regular
  • Comic Sans MS Bold
  • Comic Sans MS Regular
  • Consolas Bold
  • Consolas Bold Italic
  • Consolas Italic
  • Consolas Regular
  • Constantia Bold
  • Constantia Bold Italic
  • Constantia Italic
  • Constantia Regular
  • Corbel Bold
  • Corbel Bold Italic
  • Corbel Italic
  • Corbel Regular
  • Cordia New Bold
  • Cordia New Bold Italic
  • Cordia New Italic
  • Cordia New Regular
  • CordiaUPC Bold
  • CordiaUPC Bold Italic
  • CordiaUPC Italic
  • CordiaUPC Regular
  • Courier New Bold
  • Courier New Bold Italic
  • Courier New Italic
  • Courier New Regular
  • DFKai-SB Regular
  • DRMS T1 Regular
  • DaunPenh Regular
  • David Bold
  • David Regular
  • DengXian Bold
  • DengXian Regular
  • DilleniaUPC Bold
  • DilleniaUPC Bold Italic
  • DilleniaUPC Italic
  • DilleniaUPC Regular
  • DokChampa Regular
  • Ebrima Bold
  • Ebrima Regular
  • Estrangelo Edessa Regular
  • EucrosiaUPC Bold
  • EucrosiaUPC Bold Italic
  • EucrosiaUPC Italic
  • EucrosiaUPC Regular
  • Euphemia Regular
  • FangSong Regular
  • FrankRuehl Regular
  • Franklin Gothic Medium Italic
  • Franklin Gothic Medium Regular
  • FreesiaUPC Bold
  • FreesiaUPC Bold Italic
  • FreesiaUPC Italic
  • FreesiaUPC Regular
  • Gabriola Regular
  • Gautami Bold
  • Gautami Regular
  • Georgia Bold
  • Georgia Bold Italic
  • Georgia Italic
  • Georgia Regular
  • Gisha Bold
  • Gisha Regular
  • Impact Regular
  • IrisUPC Bold
  • IrisUPC Bold Italic
  • IrisUPC Italic
  • IrisUPC Regular
  • Iskoola Pota Bold
  • Iskoola Pota Regular
  • JasmineUPC Bold
  • JasmineUPC Bold Italic
  • JasmineUPC Italic
  • JasmineUPC Regular
  • Jing Jing Regular
  • KaiTi Regular
  • Kalinga Bold
  • Kalinga Regular
  • Kartika Bold
  • Kartika Regular
  • Khmer UI Bold
  • Khmer UI Regular
  • KodchiangUPC Bold
  • KodchiangUPC Bold Italic
  • KodchiangUPC Italic
  • KodchiangUPC Regular
  • Kokila Bold
  • Kokila Bold Italic
  • Kokila Italic
  • Kokila Regular
  • Kootenay Regular
  • Lao UI Bold
  • Lao UI Regular
  • Latha Bold
  • Latha Regular
  • Leelawadee Bold
  • Leelawadee Regular
  • Levenim MT Bold
  • Levenim MT Regular
  • LilyUPC Bold
  • LilyUPC Bold Italic
  • LilyUPC Italic
  • LilyUPC Regular
  • Lindsey Regular
  • Lucida Console Regular
  • Lucida Sans Unicode Regular
  • MV Boli Regular
  • Malgun Gothic Bold
  • Malgun Gothic Regular
  • Mangal Bold
  • Mangal Regular
  • Marlett Regular
  • Microsoft Himalaya Regular
  • Microsoft JhengHei Bold
  • Microsoft JhengHei Regular
  • Microsoft MHei Bold
  • Microsoft MHei Regular
  • Microsoft NeoGothic Bold
  • Microsoft NeoGothic Regular
  • Microsoft New Tai Lue Bold
  • Microsoft New Tai Lue Regular
  • Microsoft PhagsPa Bold
  • Microsoft PhagsPa Regular
  • Microsoft Sans Serif Regular
  • Microsoft Tai Le Bold
  • Microsoft Tai Le Regular
  • Microsoft Uighur Regular
  • Microsoft YaHei Bold
  • Microsoft YaHei Regular
  • Microsoft Yi Baiti Regular
  • Miramonte Bold
  • Miramonte Regular
  • Miriam Fixed Regular
  • Miriam Regular
  • Moire Bold
  • Moire ExtraBold
  • Moire Light
  • Moire Regular
  • Mongolian Baiti Regular
  • MoolBoran Regular
  • Motorwerk Regular
  • Narkisim Regular
  • Nina Bold
  • Nina Regular
  • Nyala Regular
  • Palatino Linotype Bold
  • Palatino Linotype Bold Italic
  • Palatino Linotype Italic
  • Palatino Linotype Regular
  • Pericles Light
  • Pericles Regular
  • Pescadero Bold
  • Pescadero Regular
  • Plantagenet Cherokee Regular
  • Raavi Bold
  • Raavi Regular
  • Rod Regular
  • Sakkal Majalla Bold
  • Sakkal Majalla Regular
  • Segoe Condensed Bold
  • Segoe Condensed Regular
  • Segoe Marker Regular
  • Segoe Print Bold
  • Segoe Print Regular
  • Segoe Script Bold
  • Segoe Script Regular
  • Segoe UI Bold
  • Segoe UI Bold Italic
  • Segoe UI Italic
  • Segoe UI Light
  • Segoe UI Regular
  • Segoe UI Semibold
  • Segoe UI Symbol Regular
  • Segoe WP Black
  • Segoe WP Bold
  • Segoe WP Light
  • Segoe WP Regular
  • Segoe WP SemiLight
  • Segoe WP Semibold
  • Shonar Bangla Bold
  • Shonar Bangla Regular
  • Shruti Bold
  • Shruti Regular
  • SimHei Regular
  • SimSun-ExtB Regular
  • Simplified Arabic Bold
  • Simplified Arabic Fixed Regular
  • Simplified Arabic Regular
  • SketchFlow Print Regular
  • Sylfaen Regular
  • Symbol Regular
  • Tahoma Bold
  • Tahoma Regular
  • Times New Roman Bold
  • Times New Roman Bold Italic
  • Times New Roman Italic
  • Times New Roman Regular
  • Traditional Arabic Bold
  • Traditional Arabic Regular
  • Transport Medium
  • Trebuchet MS Bold
  • Trebuchet MS Bold Italic
  • Trebuchet MS Italic
  • Trebuchet MS Regular
  • Tunga Bold
  • Tunga Regular
  • Utsaah Bold
  • Utsaah Bold Italic
  • Utsaah Italic
  • Utsaah Regular
  • Vani Bold
  • Vani Regular
  • Verdana Bold
  • Verdana Bold Italic
  • Verdana Italic
  • Verdana Regular
  • Vijaya Bold
  • Vijaya Regular
  • Vrinda Bold
  • Vrinda Regular
  • Webdings Regular
  • Wingdings Regular
  • Yu Gothic Bold
  • Yu Gothic Regular

To use one of these fonts, set the TextSymbolizer face_name attribute in the style applied to your layer to the name of whatever font you want.

For example, here’s a style with default Deja Vu Sans Book text labels:


and this is the map it creates:

image

And here’s the same map rendered with, oh I don’t know, say Comic Sans MS Regular style (don’t ever, ever do this! Maybe unless you’re creating a map of how to get to a children’s party…)

which leads to this:

image

London Riots Map: Visualising correlations on maps

Correlation is a statistical technique very often used in data analysis. It can show whether and how strongly pairs of variables are related. It normally involves lots of mathematical calculations but a quick insight into the phenomenon under investigation can be gained by simply superimposing the data on a map, if both datasets have a common spatial component (eg. location).

Take, for example, a case of recent London riots, mapped on MapTube. Overlaying locations of civil commotions with Index of Deprivation (ie. a measure of poverty) allows drawing a hypothesis that poverty and propensity to violent demonstrations are related. The correlation may not necessary be obvious when analysing each dataset in isolation and in a numerical form.

A point to note however is that, if the two variables are said to be correlated they may or may not be the cause of one another. In other words, correlation does not imply causality. The correlation phenomena could be caused by a third, previously unconsidered phenomenon, called a lurking variable or confounding variable. For this reason, there is no way to immediately infer the existence of a causal relationship between the two variables. Hence, one should not jump to the conclusion that “poverty is a major factor contributing to London riots” without examining the phenomenon in more detail.

As a side note, I am very surprised to see so much “red” on the London map, implying that the majority of central suburbs are poverty stricken areas – with only a few pockets of wealth on the city fringes. This picture is in big contrast to Sydney where underprivileged areas are concentrated mainly in the south-western part of the city and, most importantly, account only for roughly a quarter of the overall metropolitan area. Australia indeed seems to be a very lucky country…

London Riots Map first spotted on Google Maps Mania

Some Changes in Google Places and Reviews

Google Places has once again “mixed it up” in the review arena. They are no longer showing the count for 3rd party reviews on the main search page and they are only displaying the count for Google reviews. They are still showing the link the to main 3rd party review sites on the main search results page but have removed the review snippets on all businesses except restaurants and hotels. Some businesses, Demand Force clients for example, will have seen a huge drop in the review count. You can bet that DF’s phones will be ringing of the hook with questions about the change.

On the Places page itself, Google is now highlighting with bold, bright red the option to leave a review, they no longer show 3rd party review snippets and the have pushed 3rd party review links well down the page and below the fold. And I for one will not miss the wildly weird review snippets that they often chose.

Google is clearly reducing their reliance on third party reviews and increasing the prominence of their own reviews. That is obvious and it makes sense from their self interested point of view now that they are garnering adequate volumes of reviews on their own.

Minimally it signals that Google thinks that they now have a large enough and useful review corpus that will provide consumers with a decent idea of the quality of the business they are looking at. Google will have more control and better insight over their reviews than those from other sites. It also seems to signal that they think that they are getting their review spam under control….although that remains to be seen.

This move will certainly change the relative importance and value of 3rd party review sites AND of 3rd party review management companies (like Demand Force) in the mix of things. The review sites and review providers will still have good links on the main search results page. That should mean that their traffic will not be negatively affected as most traffic likely comes from the main serps and significantly less from the Places Page. That being said I think this is a shot across their bows that all of them will hear. Review sites and review management companies alike will need to think about how it impacts their business plans.

In terms of Places rank and location prominence, it may reflect an update to the algo or perhaps signal a change of emphasis…. although that is much harder to say and much harder to track if that is in fact the case. If I were to be a betting man I might say that it signals less importance on total quantity of reviews but more on review site diversity and quality. But that is just a guess and is really nothing different than I would have said last week.

Does it mean you or your client should use just Google as a review platform? NO! Putting all of your eggs in one basket was short sighted and will continue to be. If you have a short memory it was but a few days ago that they managed to misplace many of their reviews and have done so regularly in the past.

It does though point out why any business should take a long term balanced approach to review management…. lots of sources; Google, Yelp, demand review sites, CitySearch, industry specific sites etc, It is always best to have a balanced portfolio as the winds could change. They have changed before and they will change again. Truth be told we don’t really know what the winds signify anyways. If you were only getting reviews from one source (like Demand Force) you really need to assess your practices and develop a plan to compliment their services. You should have been doing that already anyways.

You need to be where you clients are, you need to make it easy for the client to leave reviews, you need to feed Google’s algo the diversity it is looking for  and you need to protect yourselves as best you can against the vagaries of a crazy industry.

And that means that you still need to be at Yelp and Trip Advisor and Citysearch and Yahoo and Google and where ever and will continue to need to do so.