San Francisco Tree Census

All street trees in San Francisco as of April 26, 2015 recorded by Department of Public Works. Shades of green represent trees grouped by genus (legend below).

(Street trees set excludes parks, including Golden Gate and Presidio.) Data from SF Open Data. Map created with Tilemill and Mapbox Studio. Preview in iframe above, teasers in gallery below. See here for full-page map, and for isolated page. See the code.


Maple (acer)
Chestnut (Aesculus)
Willow (Agonis)
Pine (Araucaria)
Birch (Betula)
Palm (Brahea)
Bottlebrush (Callistemon)
Hornbeam (Carpinus)
Beefwood (Casurina)
Cedar (Cedrus)
Hackberry (Celtis)
Gum (Corymbia)
Hawthorn (Crataegus)
Carrotwood (Cupaniopsis)
Cypress (Cupressus)
Bush (Dodonaea)
Dragon Tree (Dracaena)
Loquat (Eriobotrya)
Beech (Fagus)
Fig (Ficus)
Ash (Fraxinus)
Australian Willow (Geijera)
Locust (Gleditsia)
Silk Oak (Grevillea)
Urchin/Hakea Tree (Hakea)
Sweet Shade (Hymenosporum)
Holly (Ilex)
Juniper (Juniperus)
Laurel (Laurus)
Tea Tree (Leptospermum)
Sweet Gum (Liquidambar)
Crabapple (Malus)
Olive (Olea europaea)
Cherry (Prunus)
Pear (Pyrus)
Oak (Quercus)
Elm (Ulmus)
Hawthorn (Rhaphiolepis)
Fan Palm (Washingtonia)
Yew (Taxus)

Clustering San Francisco Crime Data

I grabbed crimes from January 1, 2014 - Crime Incidents - Current Year - as a json and wrote a python script to use K-Means clustering to clean up and analyze the points. The clustering sorts the points around a centroid, so that every point is closer to that centroid than to any other. Crudely, it delineates clusters of points grouped around "hotspots." The map displays the generated centroids along with Police Districts and Neighborhoods.

Most reports in the city present crimes grouped by some other category: neighborhoods (orange) or police districts (green). Reporting crimes by natural groups of incidents reveals slightly more nuanced patterns.

For example, two of the crime "hotspots" that fall within the Tenderloin police district teeter on the border of the Southern police district and SOMA neighborhood. While crime reporting isolates Southern and SOMA crime, those incidents contribute (over 50%) to a crime pattern originating from the Tenderloin district. Additionally, the fourth largest hotspot, in Bayview (10288), compared to the largest, Tenderloin (18509), falls within the second largest police district (Bayview), whereas Tenderloin police district is the smallest of all. 

This is the first part of a larger series I'll be working on to evaluate the distribution of crime and police resources, as well as perceptions of crime and safety, in San Francisco.

See the code.

Three Months of Gun Violence in San Francisco

: 47
Friday: 55
Sunday: 46
Wednesday: 40
Tuesday: 40
Thursday: 34
Saturday: 30

Monday: 27

All of the gun-related crime in San Francisco over the past three months, mapped. Scroll over incidents for incident numbers, dates, descriptions, and resolution. Data extracted from Open Data SF, Map: Crime Incidents - Previous Three Months. Created with MapBox and TileMill.

Want to help efforts to get guns off the streets of San Francisco? Consider donating to Gunbygun - a San Francisco non-profit that crowdfunds for buyback events. They removed $20,000 of firearms from San Francisco streets last summer alone.

Like Gunbygun on Facebook.
Learn more about them.
Donate $50 to take a gun off the street.


Investigating Democratic Backslide Hungary

Earlier in 2014, I began looking into the causes of the "reforms" in Hungary, which I characterize as a backslide in civil liberties and democratic institutions. I had help translating Hungarian election blogs and polling data from a few dear Hungarians who prefer to remain anonymous. I also interviewed the Current Consul General of Hungary in New York, the former Minister of Development for Hungary, and the former Deputy Head of Strategic Communications for Hungary. The body of the essay - a narrative and empirical look at my four categories of analysis - is very long, but I am happy to share the full project and complete transcriptions of the interviews, if you contact me.


This project evaluates the factors that have amounted to the erosion of democratic institutions and civil liberties in Hungary, which is otherwise modern, in many ways socially progressive, and regionally and internationally connected through the European Union, NATO, and other formal alliances. It examines four levels of analysis to conclude which aspect was the greatest causal factor: economics, politico-structural features, civil society and social attitudes, or individual agency. Determining the relative causality of the factors that have caused a relapse in democratic institutions in Hungary, which was considered a principal successful story of post-Soviet democratic transition, has implications for other incidences of democratic consolidation.


Hungary’s democratic backslide is unique because increasingly conservative and repressive reforms are happening in the same country that fought vigorously for liberalization, democratic institutions, and transparency in 1989.{1} In the summer of 1989, as the Soviet empire fell, Hungarian opposition forces gathered to put pressure against the communist regime. Hungary, arguably the most liberal of the bloc states under communism, had tremendous popular support for free elections and liberalization. Like Czechoslovakia and Slovenia, Hungary adopted parliamentarism because, “[I]n the heat of revolution both citizens and emerging elites reached for the form of noncommunist regime they knew best from their countries’ precommunist pasts.”{2}

The first free elections of 1990 revealed little support for communist leaders, although most people believed that maintaining some continuity in government would have a stabilizing effect. Under this new mixed center-right government, Hungary drafted its first independent constitution, leaving room for adaptation and evolution of the new Hungary. For two decades power shifted back and forth between various parties, most with some communist representation and platforms, but no single party gained enough traction to rewrite the constitution. Liberal reforms occurred gradually, and the country experienced a tremendous economic opening to the rest of Europe. Unlike other bloc countries, Hungary experienced many aspects of liberalization even before its democratic transition. As a result, many analysts believed it would be the most stable and successful case of consolidation in Europe.{3} In 2004, Hungary joined the EU, which some interpreted as a signal that it had completed its democratic experiment.

In 2010, several scandals of corruption in government, most notably the charge that socialist leaders, including the Prime Minister, had disguised the relative bankruptcy of the country, amounted to a national determination for radical change. The Fidesz party, led by Victor Orbán, a reformer since the Soviet period, came to power and implemented dramatic measures. These changes, which can be characterized by a rollback in democratic institutions and civil liberties, were achieved through careful legislation and a massive rewrite of the country’s constitution.

Although the Fidesz party was legally elected to power, its subsequent changes to voting processes have made it extremely difficult for the party to lose a future election. Features such as the elimination of second round voting and turnout requirements have helped to maintain the Fidesz stronghold. In 2010, Fidesz won a legitimate majority (52%), which translated under the old system of representation into a two-thirds supermajority of Parliament (263 of 386 seats). In the 2014 elections, under the new constitution and with new electoral laws, Fidesz was able to maintain its parliamentary two-thirds supermajority, despite having only obtained 45% of the popular vote.

Gerrymandering and other legal tricks have allowed Fidesz to maintain complete control in Parliament. The districts were redrawn in 2010, according to Hungary’s Consul General in New York, Károly Dán, because:

The districts now, if you look at the number of voters for example, this is a much more balanced system then you used to have. The old system was supposed to be around 70,000 [voters per district], but in actuality they varied from 30,000 all the way to 100,000. We inherited these districts from the post-communist era... It’s pretty close [now], it’s about 70,000. This was one of the reasons why the system was changed.{4}

Despite the Consul General’s firm insistence that these changes were made in pursuit of balance, the variation in district sizes is still far more than what is typically accepted as a democratic standard. The Commission for Democracy through Law in the Venice Commission recommends no more than 10% variation in district size,{5} but the Hungarian system varies by 15% of the mean number of voters in each district – allowing substantially more variation (15% both above and below the mean) than the Commission deems appropriate.{6}

In addition to redrawing districts to emphasize votes for Fidesz, the new electoral system has several features that tweak the vote in favor of any large party just enough to maintain a supermajority in Parliament. For example, the new system includes “compensating the winner,” which is the practice of giving the winner of an election the “broken votes” of other smaller, losing parties, to artificially increase the size of the winning party’s mandate. A Budapest newspaper, The Budapest Beacon, calculated that without this practice Fidesz would only have secured 60% of the seats in Parliaments in the 2014 elections, and therefore not enough for a two-thirds supermajority.{7}

Hungarian officials are aware of the advantages that these features give to Fidesz. In an interview after the 2014 elections, former Minister of Development of Hungary Tamás Fellegi stated:

There is one element [of the electoral system] which I personally would never ever think of... that’s compensating the winner. This time, without that, Fidesz would not have had the super majority for sure. This special rule provided the extra four or five votes that they needed. Obviously, technically speaking, this was why Fidesz has a supermajority. I would never ever think of introducing such a measure.{8}

Interestingly, in the same interview, he stated, “I gave a talk recently in Florida, the tile was Villain or Hero. If you read The New York Times, with or without Kim Scheppele, he is a villain. But if you look at the elections results from 2014, I don’t think he is a villain. Who is in the best possible position to make this judgment if not the electorate?”{9} Clearly, some Hungarian officials, while dubious of specific mechanisms of the electoral system, still regard Fidesz’ maintenance of their supermajority in 2014 as a sign of confidence from the electorate.

A two-thirds supermajority in Parliament is sufficient for any number of measures, for example to “declare that the President of the Republic is incapable of fulfilling his or her duties,” (Legal Status of the President of the Republic, Article 12) and to elect new members for the 12-person Constitutional Court (the Constitutional Court – Article 24).{10} A subsequent clause of the Constitutional Court Article states, “Members of the Constitutional Court may not be members of a political party or engage in any political activities,” but when every member of the court is easily hand-selected by a Fidesz majority, the independence of the judiciary from political associations seems comic. In the next six months four judges will retire, and so the two-thirds majority will be a perfect opportunity for Orbán to select individuals who are sympathetic to him.{11}

There are other problematic aspects of the electoral system. In the 2014 elections the International Election Observer Mission of the Organization for Security and Cooperation in Europe concluded that, “The main governing party enjoyed an undue advantage because of restrictive campaign regulations, biased media coverage and campaign activities that blurred the separation between political party and the State.”{12} In addition, by granting citizenship to any ethnic Hungarians living outside of the country, Orbán and Fidesz were able to take advantage of 20,000 more voters, 95% of which (not surprisingly) supported the party.{13} Finally, independent election monitors found that government agencies tasked with supervising the fairness of the election had too many connections to the government itself, and were therefore biased in their assessment.{14}

Apart from electoral system changes, other undemocratic changes since 2010 have included rolling back freedoms of the press, religious and sexual freedoms, and other checks and balances. Minorities must now receive more votes to be represented in Parliament, or even to send a spokesman. Clauses have been added to the constitution that categorically state Hungarian nationalism is Christian – ignoring the many minorities represented within the country. Another clause carefully defines a family as the product of marriage between a man and a woman. The Constitutional Court is enfeebled by the reduction of ombudsmen – public advocates - from four to one, who is now appointed by none other than majority party Fidesz leadership.

In effect, Fidesz has created an extreme majoritarian system through heavy gerrymandering and other institutions such as “compensating the winner.” Hungarian officials justify the translation of the 2014 45% popular vote into a two-thirds majority in Parliament as an anomaly of a new and developing system, for example Ambassador Dán explains,

Right now, yes, 45% [of the popular vote] is enough [for a supermajority in Parliament]. But in ten years, it is not going to be enough, because you’ll have districts that are going to be leaning this way or that way... Getting a certain percent is only one thing – that’s just half of the seats. The other half comes from winning individual districts.{15}

The Hungarian explanation conveniently forgets that individual districts were redrawn precisely to distribute and maximize Fidesz support. These changes, in sum, solidify that the Fidesz party, under president Victor Orbán’s leadership, will be extraordinarily difficult to overcome in any future election, while minority rights continue to wane and an independent judiciary is replaced with hand-selected Fidesz supporters. Fidesz likely would have won a simple majority in Parliament regardless of its new electoral system, but their carefully engineered system has allowed a vastly disproportionate representation. It is no surprise that the 2014 elections went to Fidesz, which has claimed this fact as evidence of popular confidence in the direction that Hungary is moving.


Many scholars have devoted their work to explaining what factors lead to democratization and democratic consolidation. Democratization is the process of a country moving towards democratic institutions and processes, away from authoritarian ones. These works rely on various definitions of democracy. Most have their roots in the work of Robert Dahl, who described democracy as the product of contestation and participation in politics, with free and fair competition for votes.{16} Joseph Schumpeter built on this definition in Capitalism, Socialism and Democracy, in which he states, “The democratic method is that institutional arrangement for arriving at political decisions in which individuals acquire the power to decide by means of a competitive struggle for the people’s vote.”{17} This paper will favor a more liberal and demanding definition of democracy, to recognize that any democratic government must have certain commitments to, and protections of, individual freedoms and liberties. This can be expressed through any number of practices and institutions such as checks and balances on government power, fair enforcement of rule of law, protections of minorities, freedoms of speech and press, etc. Most importantly, according to this liberal definition, a democratic government must regard all individuals equally under the law.

Democratic consolidation is the process by which democratic transitions become solidified. This process can be expressed quantitatively, by how long a democratic regime lasts. It can also be expressed qualitatively, by what institutions, social processes, and psychosocial beliefs represent a lasting ingratiation of democratic beliefs and principles. For Linz and Stepan, consolidation involves the development of democratic legitimacy. They conclude, “Essentially, by a ‘consolidated democracy’ we mean a political regime in which democracy as a complex system of institutions, rules, and patterned incentives and disincentives has become, in a phrase, ‘the only game in town.’”{18}

Hungary, like all independent states that emerged from the Soviet bloc, underwent a democratic transition that defies most theories of democratization: rather than experiencing an emergence of revolutionary democratic forces from within, it was lifted free of an external authoritarian power. This paper, however, is not necessarily concerned with what factors contributed to the initial democratization of Hungary. Rather, it seeks to identify what factors prevented successful democratic consolidation, ultimately resulting in the recent authoritarian backslide. The Hungarian transition is also unique from most authoritarian backslides in that the current government received its power through legal processes, rather than hostile takeover. However, Linz and Stepan find that:

[N]o regime should be called a democracy unless its rulers govern democratically. If freely elected executives (no matter what the magnitude of their majority) infringe the constitution, violate the rights of individuals and minorities, impinge upon the legitimate functions of the legislature, and thus fail to rule within the bounds of a state of law, their regimes are not democracies.{19}

For these reasons, despite its legal ascent to power and its strong majority, the Fidesz party under Orbán can still be considered undemocratic.

Dankwart Rustow groups scholars who have written about the factors that enable democratic consolidation into three categories.{20} First, there is a body of scholarship that supports modernization theory, which argues that economic development and its results (greater urbanization, education, literacy, and quality of life) are most closely linked to successful democratic consolidation (Lipset, Geddes, Hubert, Rueshmeyer). Some proponents of modernization theory also argue its inverse: that periods of economic decline are closely linked to the erosion of democratic institutions. A second group of theorists have argued that successful democratic consolidation is consistently the result of defining structural features in a regime. These structural features build competition into the social framework by including society and its leaders in politically relevant associations where they are exposed to peaceful processes of conflict and reconciliation (Ljiphart, Gates et al). Finally, a body of scholarship supports the notion that successful democratic consolidation is primarily the result of strong civil society, social agreements, attitudes, and psychological beliefs shared by a population that legitimize democracy. (Almond and Verba, Dahl). This project will examine each of these potentially causal factors in Hungary (economic development, structural features, and civil society) to determine what has prevented Hungary from successfully consolidating. These categories of factors, while comprehensive, are mostly structural and social arguments. For the unique case of Hungary I have added a fourth category of analysis, individual agency, to assess whether or not Prime Minister Viktor Orbán has had a causal role in the reforms.{21}


Economic decline strongly correlates with the erosion of democratic features in Hungary. A comparison to Poland reveals that Hungary suffered disproportionately to its European Union and post-Soviet counterparts, and its return from decline has been slower. While a linear trend in GDP growth since 1980 shows consistent growth, it is likely that sudden and dramatic economic decline in 2006 mobilized existing social grievances and political aspirations. Despite the fact that other factors were important, economic decline provides the most convincing explanation of democratic decline in Hungary in 2010.

Structural weaknesses in post-Soviet Hungarian democracy provided institutional pathways for the elimination of democratic protections. Particularly, structural features that enable a single party to rewrite the constitution, favor large parties, allow a small majority to have disproportionate Parliamentary representation (and therefore drastically alter the political structure by redrawing districts), and under represent minorities, all rendered the pre-2010 Hungarian government inconsistent and democratically weak. These institutions, in sum, enabled the Fidesz party to come to power through entirely legal means, which certainly contributed to the erosion of democratic principles, but structural features alone were not sufficient to cause the relapse. It is also unclear if structural pathways and features were even a necessary condition in democratic backslide, because it is possible that Fidesz would have seized power illegally or through other legally-tricky mechanisms.

Social attitudes and civic culture were well aligned with democratic backslide in Hungary. A population that was disenfranchised from Soviet leadership, searching for unifying elements of national culture and pride, and regularly exposed to radical ring-wing and discriminatory sentiment, was well primed for movement towards authoritarianism. However, these preexisting social sentiments and cultural features were not sufficient to enact changes, elect Fidesz, or gain a majority to rewrite the constitution until 2010 in the post-recession period.

Similarly, Viktor Orbán’s personal agency and political savvy certainly catalyzed Fidesz’s ascent to power, but would not have been sufficient to instigate reform without other economic grievances, structural opportunities and social attitudes. In fact, his attempts at personal power grabs and national reform failed for two decades until economic structural factors opened the pathway for his nationalist rhetoric to be successful.

These changes in Hungary, primarily instigated by economic decline, will have dramatic future effects on party politics in the state and its relationship with the European Union, which has already provided a resolution demanding that Hungary address its concerns with the new constitution. Hungary’s relationship with the European Commission has been strained since September 2006, when then Prime Minister Gyurcsány was recorded lying about the state of the economy and the EU subsequently provided him with their formal support. Outrage that the Commission and EU were taking such a pointed interest in domestic affairs resulted in the first violent protests in Budapest, outside the Parliament building, in fifty years.{58} Hungary, which has been outwardly detached from the EU since the 2006 crisis, generally regards the EU’s interest in Hungarian laws as overwrought, unwelcome, and without precedent. According to Hungarian Consul General Károly Dán:

The European politicians are just equally politicians. They fight for their political future, they fight for their position, what they say is not always in, legal terms, correct or executable... A very small majority of the issues voiced against whatever we did was legally an issue.{59}

Furthermore the Hungarian government exhibits no interest in revaluating its constitution or laws, or heeling to EU criticism:

How could you anticipate any sort of criticism when you have a constitutional majority, and you change your constitution, and you have a European body that absolutely has nothing to do with it? There is a joke from Monty Python: One can never anticipate the Spanish Inquisition.{60}

Fidesz and Orban have not yet created total lasting power for themselves. As Felligi and Dán both pointed out, Fidesz’s ascent to power in 2010 and its maintenance of a majority in 2014 were dependent on the weakness of opposition parties – particularly the illegitimacy of the Socialist party, and subsequent unpopularity of the Democratic Coalition (DK) for its election of the shamed former Prime Minister Gyurcsany. However, the changes to constitution and electoral laws, and government media control, have amounted to a system that makes it exceedingly difficult for an opposition party to gain traction, and statistically favors larger parties for Parliament representation. Ultimately, while most Hungarian politicians recognize that their supermajoritarian system is unique, they reject external involvement in their domestic institutions, and to express good faith in their party leaders. According to Fellegi:

On the one hand, compared to the ideal type of democracy, it is less. But we still have checks and balances, if you read the Hungarian laws. I see why many people say that some of the institutions are not fully democratic, simply because they give more room for individual judgment of the authority itself... without necessarily the proper court control. That’s clear. At the same time, I don’t see it happening.{61}

{1} Brian J. Forest, "Viktor Orbán: Viktator or Visionary?" Diplomatic Courier 5 No. 2 (Spring 2011): 22-24.
{2} Richard D. Anderson, Jr., M. Steven Fish, Stephen E. Hanson, and Philip G. Roeder, Postcommunism and the Theory of Democracy (Princeton: Princeton University Press, 2001), 90.
{3} Jeffrey Kopstein, “Postcommunist Democracy: Legacies and Outcomes,” Comparative Politics 35 No. 2 (January 2003): 232.
{4} Interview of Károly Dán, Consul General of Hungary in New York, by the author, April 30, 2014, New York City.
{5} “Joint Opinion on the Act on the Elections of Members of Parliament of Hungary,” Venice Commission and OSCE Office for Democratic Institutions and Human Rights, adopted by the Council for Democratic Elections, June 14, 2012.
{6} Kim Scheppele, “Hungary, An Election in Question, Part 2,” The New York Times Blog, February 28, 2014.
{7} Richard Field, “Fidesz Would Have Won 60% of Seats in Parliament but for Dubious Practice of Compensating the Winner,” The Budapest Beacon, April 22, 2014.
{8-9} Interview of Tamás Fellegi, former Minister of National Development for Hungary and President of Hungary Initiatives Foundation, by the author, April 29, 2014, New York City.
{10} “Fundamental Law of Hungary: The State.” 
{11} Interview of Tamás Fellegi.
{12} “International Election Observation Mission: Hungary – Parliamentary Elections, 6 April 2014, Statement of Preliminary Findings and Conclusions,” Organization for Security and Cooperation in Europe, Parliamentary Assembly.
{14} Kim Scheppele, “Legal, But Not Fair (Hungary),” The New York Times Blog, April 13, 2014. 
{15} Interview of Károly Dán.
{58-60} Ibid.
{61} Interview of Tamás Fellegi.