champagne anarchist | armchair activist

Embedding tweets in Leaflet popups

I just created a map showing where so-called Biro’s (small cars) are parked on the pavement and annoying people. Twitter has quite a few photos of the phenomenon. In some cases, finding their location took a bit of detective work.

First you’ll need the embed code for the tweet. You can get it manually from the Twitter website, but if you want to automate your workflow, use a url like the one below. It’ll download a bit of json containing the embed code:

https://publish.twitter.com/oembed?url=https://twitter.com/nieuwsamsterdam/status/958761072214896640

When trying to embed the tweets in Leaflet popups, I ran into a few problems:

  • When popups open, the markers didn’t properly move down. As a result, most of the popup would be outside the screen. The problem and how to solve it are described here.
  • Twitter embed code contains a script tag to load a widget. Apparently you can’t execute javascript by adding it directly to the html for the popup content, but you can add it using a selector (cf here).

Here’s the code that’ll solve both problems:

map.on('popupopen', function(e) {
    $.getScript("https://platform.twitter.com/widgets.js");
    var px = map.project(e.popup._latlng); 
    px.y -= e.popup._container.clientHeight;
    map.panTo(map.unproject(px),{animate: true});
});

You may also want to do something about the width of the popups, because otherwise they will obscure most of the map on mobile screens and it will be difficult to close a popup (which you can normally do by clicking outside of the popup). You can change the width of embedded tweets, but this will not change the width of the popup itself. A simple solution is to give popups a maxWidth of 215 (.bindPopup(html, {maxWidth: 215})).

Of course, you could also vary maxWidth depending on screen width, but I think 215px works well on all screens. Further, embedded tweets appear to have a minimum width of about 200px, so if you want popups narrower than 215px you’ll have to figure out a way to fix that.

If you embed tweets, Twitter can track people who visit your webpage. Add <meta name="twitter:dnt" content="on"> to your page and Twitter promises they won’t track your visitors. I wasn’t sure whether this should be put in the web page itself or in the html content of the popups (I opted for both).

If the popups have a somewhat spartan look and do not contain photos: Good for you! You’re probably using something like Firefox with tracking protection enabled. This blocks sites which have been identified as ‘engaging in cross-site tracking of users’ - including, apparently, platform.twitter.com.

New Year - time to delete your Facebook account?

Around New Year, people turn to Google for advice on how to accomplish their New Year’s resolutions. The chart below (an update of one I created earlier) illustrates this.

Around New Year, there’s is a peak in people googling ‘quit smoking’, but it appears that even more people to try to figure out how to delete their Facebook account. The parallel is not entirely surprising, given claims that platforms like Facebook are designed to be addictive.

Chart updated 1 January 2018

Tags: 

Амстердам, mapped by the Soviet Union

For fifty years, the Soviet Union had an ambitious military programme to map large parts of the world. Two collectors, John Davies and Alexander Kent, have written a great book about the secret maps that resulted from this programme.

Most of the maps in their book are of the US and the UK. Their descriptions are so intriguing that I had to find out whether Amsterdam has also been mapped. It turns out it has: on Ebay, I found a reproduction offered for sale by the Jana Seta Map Shop in Riga.

The map consists of four sheets, each more than a metre wide and 90cm high. The left margin of the fourth sheet contains the following text:

If I’m not mistaken, this text contains the following information: the scale of the map; the name of the city; the reference numbers of the 1:100,000 maps with the location of the city; the sheet number (4/4); the status of the map (SECRET) and the year of publication.

So it appears that the map was published in 1985, but that’s not the whole story. At the bottom of sheet 4, the following text is printed:

Sometimes, this text would contain the names of the people who had created the map (frequently women), but that’s not the case here. I think it says here that the map was compiled in 1972 and updated with material from 1980. By the way, a description of Amsterdam printed next to the map also refers to demographic information from 1981.

To check how recent the material is, I created a map of Amsterdam with buildings from 1980 and 1981 colour-coded. This shows that in those years, most construction took place to the south-east of the city, beyond the Bijlmer neighbourhood. The fragment below shows the area between the Academic Medical Centre and the Gaasperplas (click on the image to open it in a new screen).

For comparison, here’s roughly the same area from the Soviet map.

Generally, buildings from 1980 (orange) and before are shown on the Soviet map, while buildings from 1981 (red) are not. This seems to confirm that the map was updated with material from 1980.

The cartographers who created the maps used satellite images, local maps and other public sources, and sometimes information collected on the ground.

Some maps show new buildings but without the corresponding street names. The explanation may be that cartographers had access to recent satellite images showing the buildings, but no local maps were available yet from which the street names could be taken, Davies and Kent explain.

Something similar may apply to the Bijlmerbajes, a former prison which now houses a refugee centre.

The Bijlmerbajes opened in 1978. The map shows the prison buildings: they are east of the tracks, with a ditch in between. However, there’s no explanatory text: the only text is the name of metro station Spaklerweg. It appears that the cartographers did have access to recent satellite images showing the buildings, but no information about their function.

I don’t know whether any Dutch maps which identify the Bijlmerbajes existed in 1980. The Dutch Land Registry has a handy website with historical maps. It contains a map from 1981 identifying the Bijlmerbajes as gevangenis (prison).

The prettiest parts of the map are the harbours, that have been mapped in great detail. That’s not the case for Schiphol Airport, shown below.

The maps used a uniform colour coding. Simply put, green represented objects of military or strategic interest; purple, public institutions and black, manufacturing. Schiphol-Centrum (to the left) and Schiphol-Oost, with an aircraft repair shop (top right) have been marked as objects of strategic interest. Black blocks refer to the now closed Fokker factory, where military aircraft were produced

It’s striking how ‘empty’ Schiphol is. To some extent this is understandable: asphalt and wasteland make up a large part of any airport. However, it also appears that the cartographers didn’t have all that much information about Schiphol. For example, there used to be a depot for jet fuel (which was still delivered in barges) at Schiphol-Oost. If the cartographers had been aware of this, they would probably have included that information in the map.

Moving on to the harbours, here’s a part of the Western Harbour Area.

The Western Harbour Area contains one of the largest petrol harbours of the world. The green objects suggest the cartographers were rather interested in fuel infrastructure.

And here’s part of the Eastern Harbour Area.

There’s a lot to see here. The green triangle with number 29 represents the naval complex at Kattenburg (it has recently been abandoned by the Navy and will be converted into offices and housing). Interestingly, the square at the bottom of the triangle has also been marked as object of strategic interest. In the past this used to be a Navy warehouse, but it was turned into a Maritime Museum in 1973.

Other green objects include the Oranje-Nassau barracks at the Sarphatistraat (number 30, still in use by the army at the time) and the former location of the Nautical College (number 301).

There’s also a little green block between the Waterlooplein and the Nieuwe Amstelstraat (number 5 to the left of the photo). According to the map index, this is an арсенал or arsenal. In a way, that’s correct: the buildings name is Arsenal. The name refers to the fact that the building has been used to store arms in the past, but since 1946 it houses the Academy of Architecture.

Lovers of detail may want to zoom in to the Czaar Peterstraat. Soviet army maps used to write names phonetically, following the local pronunciation. The fact that this streets name has a Russian origin doesn’t change that: the tsar’s name is spelled Peter (Петер), not Pyotr (Пётр).

And here’s yet another strategic location, near the Museumplein.

Objects in this fragment include the American Consulate (number 166, but in a different building than where you’d expect it to be) and a bus stop where KLM busses to Schiphol Airport used to depart (number 187).

Of interest is number 250, located next to the Zuiderbad indoor swimming pool. The object is green, therefore deemed of strategic interest. The description says Служба безопасности or security service, according to Google Translate. That’s intriguing. Could it be that the map reveals an unknown location of the national security service BVD?

Not quite. This used to be the address of a precursor of the Dutch NIA (now part of TNO), an institute that dealt with workplace health and safety. Its former name was Veiligheidsinstituut or Safety Institute. However, the Dutch word veiligheid can mean both safety and security, which explains how the Soviet cartographers could have mistaken the Veiligheidsinstituut for a security service.

Details about Amsterdam

The Soviet city plans come with a general description of the city. To give an idea of the contents, here are some elements from the description of Amsterdam:

  • Because of dikes, rivers and canals and because of the viscous soil, movement of vehicles outside of the roads is almost impossible.
  • The destruction of hydraulic structures can cause catastrophic flooding of the terrain.
  • Along the roadside there are bicycle paths with a width of up to 2m.
  • All nearby settlements are electrified, provided with telephone communication, and have running water and gas.
  • From the air, Amsterdam is easily recognisable by its large size and its location between the IJsselmeer and the North Sea.
  • On some canals, there are many floating houses.
  • The metro lines have a length of 18 km (3.5 of which are underground) and number 20 stations, including 5 underground ones; the distance between underground stations is 0.8 - 0.9 km, between ground stations - 1.1–1.3 km

In addition, the text contains detailed information about manufacturing, research, administration and other topics.

Method

I once started to learn Russian, but I never progressed much beyond я не говорю по-русски. To decipher Russian texts on the map, I used the Cyrillic keyboard of my iPhone for typing short pieces of text, and I scanned longer ones with the FineScanner app, which offers OCR for Cyrillic (this works as long as the text has a white background, but not with texts printed on the map itself). I used Google Translate to translate the texts. The result may not be perfect, but it appears to work pretty well.

I created the map with construction dates using Qgis and Open Street Maps map data, which contains data from the Land Registry (Kadaster).

I can’t rule out that my interpretation of the map (and the Russian texts on it) contains errors. If you have any comments, please let me know.

John Davies en Alexander J Kent, The Red Atlas: How the Soviet Union Secretly Mapped the World. University of Chicago Press, 2017.

Maps of other Dutch cities and detailed information here.

Swearing will boost your cycling speed

In an experiment, scientists had people ride an excercise bicycle for 30 seconds. Every three seconds they had to either say a swearword, or say a neutral word. When swearing, participants produced an average power of 429W (peak power 570W), compared to 417W (peak power 545W) for the participants in the control condition.

However, participants in the swearing condition also were more fatigued. It appears that swearing will help you ride a bit faster, but only for a short while.

And 429W, is that a lot? I wouldn’t know, but here are some figures for comparison. According to Cyclist, German sprinter André Greipel can keep up over 1,000W for 30 seconds, while Cyclist’s resident crit racer can do 600W. For what it’s worth; this page has people bragging about producing more than 900W for 30 seconds.

Back to the experiment: with a topic like this, you want to know how the research was done. Especially which swearwords were used, but that’s not reported. Participants were asked for a word they might use when they bang their head accidentally. In the control condition, they were asked for a word they would use to describe a table.

Participants were instructed not to shout, but to use a ‘strong and clear voice’, and to remain seated in the saddle during the entire test. During the test, participants were encouraged by research staff.

You’d expect this to be a fun experiment to take part in, but apparently it wasn’t for everybody. Out of 35 original participants, six dropped out: two were unable to finish the protocol, one was taken ill and three withdrew.

Richard Stephens, David K. Spierer, en Emmanuel Katehis, Effect of swearing on strength and power performance. Psychology of Sport & Exercise 35:111–117. Due for publication March 2018.

Tags: 

Ice-cream parlours, cheese stores and bicycle rentals

The centre of Amsterdam has 177 businesses targeting tourists and shops selling food and drinks for immediate consumption. Those include at least 23 ice-cream parlours, 24 cheese stores and 31 bicycle rentals, according to a list (pdf) published by the Amsterdam Municipality.

According to the Accounting Office, there were only 8 ice-cream parlours, 9 cheese stores and 13 bicycle rentals in 2008. After a peak in 2015, the number of tourist businesses seems to have declined a little, although it’s also possible that a stricter definition has been used in the latest count.

The list published by the municipality includes not only shops, but also tacky tourist attractions. Or, as the municipality defines them, facilities «targeting the desire of visitors for a (taste) experience, sensation and/or (group) entertainment, in which the possible artistic, historic or educational character is secondary and that are characterised by a for-profit operation». Examples are the Sex Museum, Madame Tussaud, various marihuana museums and BODY WORLDS.

In October, the municipality has decided not to allow any new tourist businesses in the city centre. The city says the quality of the centre as a retail location as well as its liveability are decreasing. Council members Jorrit Nuijens (GroenLinks) and Tiers Bakker (SP) had urged the municipality to take measures.

Tags: 

Pages