Category: Web Applications

Automatically post your Flickr photos to your Mastodon account

One process I’ve relied on in the past to keep my Twitter postings fresh is automatically cross-posting photos that I upload to Flickr to Twitter. This is done through Zapier and inspired by this answer in their forums.

Zapier currently doesn’t have any Mastodon integrations, but it’s possible to use Mastodon’s API and Zapier’s webhook function to notice your newly-uploaded photos from Zapier’s Flickr integration and “toot” them to your Mastodon account.

Note: I originally set this up as an RSS feed to Mastodon Zap before realizing that Zapier already has a Flickr integration.

First, to prepare for creating a Zap later, you’ll need to create an app in your Mastodon server. You can create an app by going to edit your profile and then opening the “Development” tab.

Select the “New application” button, give it a name, change the privileges, and use “http://zapier.com” as the only Redirect URI. Then check the appropriate boxes so that only a single privilege is checked: “write:statuses”.

Give your application a name, enter https://zapier.com as the Redirect URI, and check only the box next to “write:statuses”.

Want to get more advanced? Read the Mastodon API docs.

Mastodon will create a token for you to insert at the end of this URL that Zapier needs: https://mastodon.social/api/v1/statuses?access_token=INSERT_YOUR_ACCESS_TOKEN

If your Mastodon account is on a different server, then replace “mastodon.social” with the domain name of the server where your Mastodon account is.

Secondly, go to your Zapier account and create a new Zap. Search for the trigger app “Flickr” and then connect Zapier to your Flickr account if not already connected. The trigger should be something like what you see in the screenshot below.

When you make a new zap, use these settings: “Connect this app…Flickr…with this one…Webhooks by Zapier”. Then, “When this happens…New Photo…then do this! POST”. Zapier will automatically give it a name that you can try later and then you can select the “Try it” button to get stated and customize.


You’ll need to customize the action that Zapier takes each time there’s a new photo. Until there’s an integration with Mastodon there’s a little complexity to defining the webhook action that Zapier will do.

The type of webhook you’ll create is a “POST” and you only need to add one field to the payload that’s sent from Zapier to your Mastodon: “status”. The value of “status” can be whatever combination of text and fields that Zapier pulls from your Flickr.

The minimum field to insert is the link to the Flickr photo page. Mastodon will need this to generate a rich media preview to add to the Toot (since it’s not possible to send image attachments).

You can start your Zap now! And follow me on Mastodon.

Want to use RSS instead?

Here are some loose instructions on how to set up the RSS feed that your Flickr account produces.

Insert your Flickr ID (not your username or email, find it here) into this URL which will be the RSS URL for Zapier to check:

https://www.flickr.com/services/feeds/photos_public.gne?id=INSERT_FLICKR_ID&lang=en-us&format=atom

Chicago Crash Browser is back

ChicagoCrashes dot org was, for many years, the only source for people to get information about traffic crashes in Chicago. I started it in 2011.

Chicago Crash Browser v0.2
A screenshot of Chicago Crash Browser v0.2 showing what the website looked like on December 30, 2011.

It was updated annually with data from two years ago, because of how the Illinois Department of Transportation processed the reports from all over the state. I shut it down because it had outdated code, I was maintaining it in my free time, and I didn’t want to update the code or spend all the time every year integrating the new data.

In 2015, the Chicago Police Department started testing an electronic crash reporting system in some districts that meant police officers could write reports and they would immediately show up in a public database (in the city’s data portal). The CPD expanded this to all districts in September 2017. (A big caveat to using the new dataset is that it has citywide data for only four and a half years.)

Since then, whenever someone asked me for crash data (mostly from John to illustrate Streetsblog Chicago articles), I would head to the data portal and grab data from just the block or intersection where someone had recently been injured or killed. I would load the traffic crash data into QGIS and visualize it. I found this also to be painstaking.

Now, with renewed attention on the common and unfixed causes of KSIs (“industry” term for killed or seriously injured) that we’re seeing repeatedly across Chicago – read about the contributing cause of Gerardo Marciales’s death – I decided to relaunch a version of Chicago Crash Browser.

The new version doesn’t have a name, because it’s part of the “Transportation Snapshot” in Chicago Cityscape, the real estate information platform I operate. It’s also behind a paywall, because that’s how Chicago Cityscape is built.

I wanted to make things a lot easier for myself this round and it comes with a lot of benefits:

  • Explore all crash reports in a given area, whether that’s one you draw yourself or predefined in the Cityscape database.
  • Quickly filter by crash type (bicyclist, pedestrian, etc.) and injury severity.
  • Download the data for further analysis.
A screenshot of a map and data table visualizing and describing traffic crash reports in Columbus Park.
What the crash data looks like within Chicago Cityscape.

How to access the Chicago Crash Browser

The crash data requires a Cityscape membership. I created a new tier of membership that cannot be signed up – I must grant it to you. It will give you access only to Transportation Snapshots.

  • Create a free account on Chicago Cityscape. The site uses only social networks for creating accounts.
  • Mention or DM me on Twitter, @stevevance, saying you’d like access to the crash data. Tell me what your email you used to create an account on Chicago Cityscape.
  • I’ll modify your membership to give you access to the “transportation tier” and tell you to sign out and sign back in to activate it.

Once you’re in, this video shows you how to draw a “Personal Place” and explore the traffic crash data there. Text instructions are below.

  1. From the Chicago Cityscape homepage, click on “Maps” in the menu bar and then click “Draw your own map”.
  2. On the “Personal Place” page that appears with a large map, decide which shape you’d like to draw: a circle with a radius that you specify (good for intersections), a square or rectangle (good for street blocks), or an arbitrary polygon (good for winding streets in parks). Click the shape and draw it according to the onscreen instructions. For intersections I recommend making the circle 150 feet for small intersections and 200 feet for long intersections; this is because intersections have an effect on driving beyond the box.
  3. Once you’ve completed drawing the shape, a popup window appears with the button to “view & save this Personal Place”. Click that button and a new browser tab will open with something called a “Place Snapshot”.
  4. In the Place Snapshot enter a name for your Personal Place and click the “Save” button.
  5. Scroll down and, under the “Additional Snapshots” heading, click the link for “Transportation & Jobs Snapshot”; a new browser tab will open.
  6. In Transportation Snapshot, scroll down and look for “Traffic crashes”. You’ve made it to the new Chicago Crash Browser.

Inclusionary zoning calculator will tell you how many units a developer can afford to make “affordable”

An “inclusionary zoning” calculator can help you determine how much affordable housing your town should require that developers build in their new construction residential buildings.

I learned about Grounded Solutions Network’s Inclusionary Housing Calculator at the second-ever YIMBYtown conference in Oakland, California, two weeks ago.

YIMBY (yes in my back yard) is a movement to reduce barriers to building more housing in order to be able to house everyone at a level they can afford. It’s a movement for other things, and it means a lot of different things to a lot of different people but the end result is that more housing needs to be built.

An interested person inputs a lot of values relevant to their local housing market into the IHC and it will calculate the cost of construction per unit and the rental income from those units, and then will figure the profit margin for the developer. What makes this “inclusionary” is that one also needs to enter the desired portion of units that are set aside as “affordable” (to people making a certain income) and subsidized by the developer’s rental income.

I put the IHC through a real world exercise by inputting as much data as I knew about a rejected proposal in Pilsen.

The first proposal from Property Markets Group had 500 units, and 16 percent of them were set aside (news on this and their subsequent proposals) [I cannot find the source of the “16 percent on-site” factor]. Chicago’s Affordable Requirements Ordinance, or ARO, requires that 10 percent of the units are affordable, and that 25 percent of those 10 percent must be built on site. The other 75 percent can be built on site, or the developer can pay an in-lieu fee per unit.

Needless to say, 16 percent on-site is much, much higher than 25 percent of 10 percent. A neighborhood organization, the Pilsen Land Use Committee, however, requires 21 percent in the area, and the city council member, Danny Solis, 25th Ward, adheres to.

PMG said they couldn’t go that high, and that’s what I wanted to test.

According to this Inclusionary Housing Calculator, could the developer make enough profit (considered as 10 percent) if the building had 21 percent of units as affordable?

In this exercise, the answer was “no, PMG could not make a profit if they had to set aside 21 percent of the units as affordable.”

But the calculator showed that they could earn a 12 percent profit if 16 percent of the units were affordable. 

Some of the inputs are actual, like the sale price of the land (found in the Illinois Department of Revenue’s transactions database), but I had to make up some inputs, including the apartments’ bedroom mix, and the future rental prices of those apartments.

Further reading

  • It’s tough for people to move into one of these set-aside apartments in Chicago (DNAinfo Chicago, July 28, 2017)
  • Inclusionary zoning cannot create enough affordable units (City Observatory, February 11, 2016)
  • Other housing cost calculators like this one (City Observatory, July 26, 2016)

The U.S. DOT should collaborate with existing “National Transit Maps” makers

The U.S. DOT demonstrated one idea for how a National Transit Map might look and work at a conference in February.

The Washington Post reported this month that the United States Department of Transportation is going to develop a “National Transit Map” because, frankly, one doesn’t exist. The U.S. DOT said such a map could reveal “transit deserts” (the screen capture above shows one example from Salt Lake City, discussed below).

Secretary Anthony Foxx wrote in an open letter to say that the department and the nation’s transit agencies “have yet to recognize the full potential” of a data standard called the General Transit Feed Specification that Google promoted in order to integrate transit routing on its maps. Foxx described two problems that arose out of not using “GTFS”.

  1. Transit vehicles have significantly greater capacity than passenger cars, but are often considered just vehicles because we are unable to show where and when the transit vehicles are scheduled to operate. The realistic treatment of transit for planning, performance measures, and resiliency requires real data on transit system operations.
  2. One of the most important social values of transit is that it makes transportation available to people who do not have access to private automobiles, and provides transportation options for those who do. Yet, we cannot describe this value at a national level and in many regions because we do not have a national map of fixed transit routes.

“The solution is straightforward”, Foxx continued, “[is] a national repository of voluntarily provided, public domain GTFS feed data that is compiled into a common format with data from fixed route systems.”

The letter went on to explain exactly how the DOT would compile the GTFS files, and said the first “collection day” will be March 31, this week. As of this writing, the website to which transit agencies must submit their GTFS files is unavailable.

What Foxx is asking for has already been done to some degree. Two national transit maps and one data warehouse already exist and the DOT should engage those producers, and others who would use the map, to determine the best way to build a useful but inexpensive map and database. Each of the two existing maps and databases was created by volunteers and are already-funded projects so it would make sense to maximize the use of existing projects and data.

“Transitland” is a project to host transit maps and timetables for transit systems around the world. It was created by Mapzen, a company funded by Samsung to build open source mapping and geodata tools. Transitland is also built upon GTFS data from agencies all over the world. Its data APIs and public map can help answer the question: How many transit operators serve Bay Area residents, and what areas does each service?

For the United States, Transitland hosts and queries data from transit agencies in 31 states and the District of Columbia. In Washington, D.C., Transitland is aware of four transit agencies. It’s a great tool in that respect: Not all of the four transit agencies are headquartered in D.C. or primarily serve that city. The app is capable of understanding spatial overlaps between municipal and regional geographies and transit agencies.

Transitland has a “GUI” to show you how much transit data it has around the world.

“Transit Explorer” is an interactive map of all rail transit and bus rapid transit lines in the United States, Mexico, and Canada. Yonah Freemark, author of The Transport Politic, created the map using data culled from OpenStreetMap, the National Transit Atlas Database (administered by the DOT and which shows fixed-guideway transit), and his own research. I wrote the custom JavaScript code for the Leaflet-powered map.

No other agency or project has collected this much data about fixed-guideway transit lines in any of the three countries, since the map includes detailed information about line lengths, ridership, and other characteristics that are not included in GTFS data. Transit Explorer, though, does not include local bus service or service frequencies, which the DOT’s map may if it incorporates the full breadth of GTFS data.

Transit Explorer also goes a step further by providing data about under construction and proposed fixed-guideway transit lines, which is information that is very relevant to understanding future neighborhood accessibility to transit, but which is not available through GTFS sources.

Finally, “GTFS Data Exchange” is a website that has been storing snapshots of GTFS feeds from agencies around the world for almost a decade, or about as long as GTFS has been used in Google Maps. The snapshots allow for service comparisons of a single agency across time. For example, there are over 100 versions of the GTFS data for the Chicago Transit Authority, stretching back to November 2009; new versions are added – by “cta-archiver” – twice a month.

Josh Cohen, writing in Next City, highlighted the significance of Google’s invention of GTFS, saying, “Prior to the adoption of GTFS, creating such a map would’ve been unwieldy and likely produced an out-of-date product by the time it was completed.” The DOT’s own National Transit Atlas Database includes only fixed-guideway (a.k.a. trains) routes, and hasn’t been updated since 2004.

Not all GTFS feeds are created equal, though. Some transit agencies don’t include all of the data, some of which is optional for Google Map’s purpose, that would make the National Transit Map useful for the spatial analysis the DOT intends. Many agencies don’t include the “route shapes”, or the geographic lines between train stations and bus stops. Researchers are able to see where the vehicles stop, but not which streets or routes they take. Foxx’s letter doesn’t acknowledge this. It does, however, mention that transit agencies can use some federal funds to create the GTFS data.

David Levinson, professor at the University of Minnesota, believes the map will bias coverage (geographic reach of transit service) over frequency (how many buses are run each day that someone could ride).

The U.S. DOT’s chief data officer, Dan Morgan, whom I met at Transportation Camp 2015 in Washington, D.C., presented at the FedGIS Conference this year one idea to demonstrate coverage and frequency in Salt Lake City, using the GTFS data from the Utah Transit Authority.

Levinson also tweeted that it will be difficult for a national map to show service because of the struggles individual transit providers have symbolizing their own service patterns.

Foxx’s letter doesn’t describe how planners will be able to download the data in the collection, but whichever app they build or modify will cost money. Before going much further, and before spending any significant funds, Foxx should consult potential users and researchers to avoid duplicating existing projects that may ultimately be superior resources.

Foxx can also take advantage of “18F” a new agency within the General Services Administration to overcome government’s reputation for creating costly and difficult to use apps. The GSA procures all kinds of things the federal government needs, and 18F may be able to help the DOT create the National Transit Map (and database) in a modern, tech and user-friendly way – or write a good RFP for someone else to make it.

Look for the National Transit Map this summer.

How to make a map of places of worship in Cook County using OpenStreetMap data

The screenshot shows the configuration you need to find and download places of worship in Cook County, Illinois, using the Overpass Turbo website.

If you’re looking to make a map of churches, mosques, synagogues and other places of worship, you’ll need data.

  • The Yellow Pages won’t help because you can’t download that.
  • And Google Maps doesn’t let you have a slice of their database, either.
  • There’s no open data* for this because churches don’t pay taxes, don’t have business licenses, and aren’t required to register in any way

This where OpenStreetMap (OSM) comes in. It’s a virtual planet that anyone can edit and anyone can have for free.

First we need to figure out what tag people use to identify these places. Sometimes on OSM there are multiple tags that identify the same kind of place. You should prefer the one that’s either more accurate (and mentioned as such in the wiki) or widespread.

The OSM taginfo website says that editors have added over 1.2 million places of worship to the planet using amenity=place_of_worship.

Now that we know which tag to look for, we need an app that will help us get those places, but only within our desired boundary. Open up Overpass Turbo, which is a website that helps construct calls to the Overpass API, which is one way to find and download data from OSM.

Tutorial

In the default Overpass Turbo query, there’s probably a tag in brackets that says [amenity=drinking_fountain]. Change that to say [amenity=place_of_worship] (without the quotes). Now change the viewport of the map to show only the area in which you want Overpass Turbo to look for these places of worship. In the query this argument is listed as ({{bbox}}).

The map has a search bar to find boundaries (cities, counties, principalities, neighborhoods, etc.) so type in “Cook County” and press Enter. The Cook County in Illinois, United States of America, will probably appear first. Select that one and the map will zoom to show the whole county in the viewport.

Now that we’ve set the tag to [amenity=place_of_worship] and moved the map to show Cook County we can click “Run”. In a few seconds you’ll see a circle over each place of worship.

It’s now simple to download: Click on the “Export” button and click “KML” to be able to load the data into Google Earth, “GeoJSON” to load it into a GIS app like QGIS, or “save GeoJSON to gist” to create an instant map within GitHub.

*You could probably get creative and ask a municipality for a list of certificates of occupancy or building permits that had marked “religious assembly” as the zoning use for the property.