written by
Joris Palings

The state of parking in Leuven (or how we stole 7,5 million euros)

Events 9 min read

Imagine this: You have a meeting with a client in the city center, and since it's a cold and rainy Monday morning, you decide to go by car.

After twenty minutes of slowly and carefully driving through the streets of Leuven in search of a place to park near your destination, you finally find the perfect parking spot.

You have a feeling this is going to be a long meeting, so you have no choice but to pay a whopping eight euros for the maximum of four hours of parking.

Sound familiar?

Good. Because this scene describes some of the issues we've tried to tackle during the Raccoons Hackathon.

The issues

  1. Since there is no open data available about parking in Leuven, there is no way of knowing where you will or won't be able to park at a certain point in time. This means you'll either have to drive through Leuven's infamous bicycle-ridden city center in search of a place to park, or find and pay for a parking garage that has available parking spaces.
  2. Unlike in some other cities, the pay-and-display parking tickets in Leuven have no unique identifier whatsoever. No barcode, no license plate, no watermark, no nothing. As such, it is impossible for parking attendants to check whether or not a parking ticket is genuine, unless they have a list of all printed tickets and their exact date and time of issue.

The data

  • 4411, a mobile parking service provider in Belgium and the Netherlands, was kind enough to not only make their website easily scrapable, but to send the unique parking meter IDs from their server to their front-end as well.
    As such, we got a comprehensive list of parking meters in Belgium with their exact coordinates and unique IDs by scraping their website.
    Nowhere in their terms of use do they state that scraping the 4411 website is not allowed.
    Edit: the folks at 4411 appear to have noticed us scraping their website, and have disabled the city detail pages containing the maps with parking meters.
Data for a single meter. We've got over 8500 of these in Belgium alone.
  • On the website of Stad Leuven, we found a link to a map of the different parking zones in Leuven (no parking, maximum of two hours, maximum of four hours, or parking with parking disc).
    Since this map is hosted by Google, it has a "Download KML" option which gives us a file containing the geospatial data for these zones.
  • Because Stad Leuven has no (or hardly any) open data, we used open data from Stad Gent's Open Data Portaal. (Big shoutout to Stad Gent!)
  • Our own smartphone's GPS data.
  • Plenty of free fifteen-minute parking tickets.

Our solutions

Issue one: No information about parking garage availability

For our first issue, we contacted Stad Leuven to see whether they had any open parking data available. We knew they have parking data because of the signs all around the Ring, but couldn't find any of this data on the website.

A sign on the RIng with parking data.
A sign on the Ring with parking data.

Their response to our request was the following:

Unfortunately, we have a confidentiality clause with the parking operators stating that the city is not allowed to share the data from the parking guidance system with third parties. We looked at whether it would be possible to only share the data from our own car parks with you, but the system is not currently equipped to share information about separate car parks, which means that we cannot get it right in time.

Alas, no luck there, so for the purpose of this hackathon, we went and used Stad Gent's open parking availability data instead.

We set up an App Engine deployment that polled this endpoint with real-time JSON data every minute for about a month, and stored it in a MongoDB Atlas database (the cool folks at MongoDB provide a free tier of their DBaaS product).

By the time the hackathon started, we had gathered over 32.000 data points which we used to create a predictive model of how many available parking spaces each parking would have at a certain point in time in the future.

Now that we'd gathered the data, we were ready to start building our prediction model using state-of-the-art AI algorithms... Except for the small fact that we didn't have anyone on our team who knew how to do so.

And that's where Google's AutoML service came in!
You might recognise the name from the famous victory Google Deepmind achieved against Lee Sedol in the ancient Chinese game of Go with their AlphaGo algorithm.
Well, with their recently released AutoML Tables service, they've made it possible to load a tabular dataset, tweak a few parameters, and BAM: you've got yourself a powerful, production-ready AI model! Or in our case: an AI model ready for a coffee-and-sleep-deprivation-fueled demo at the end of a 24h coding spree.

The loaded data looked like this in the AutoML interface:

Google's AutoML Tables interface with the Gent parking data loaded.
The 'parking_capacity_available' column is our target column as we want our model to predict available parking spots.

The cool thing with AutoML is that you can deploy your newly trained model immediately and just use the API to predict new values. So we were able to directly integrate with our AI model during the hackathon without having to worry about its deployment. Neato!

What did we do with it, I hear you ask? We built a chatbot to interact with the model, because we believed that just being able to ask your digital assistant whether there would be a parking space available at some point in the future would be a killer feature. That interaction might look a little like this:

A predictive conversation with the AI model by using the conversational capabilities of Oswald!

Cool, right?

And that's how you do AI without knowing how to do AI!

In the app we built during the hackathon, we displayed our resulting real-time data in a list of parkings sorted by distance, we color-coded parkings by availablity, and we sprinkled in a little Waze integration for good measure.

Our app's "Park in a garage" screen
Our app's "Park in a garage" screen.

A simple app or webpage like this could potentially save many thousands of people thousands of hours of driving around in the city in search of a parking space, consequently improving air quality in and around the city and preventing dozens of accidents with cyclists from happening each year.


Issue two: Insecure pay-and-display parking tickets

For our second issue, we decided to try and find out exactly how difficult it would be to print our own pay-and-display parking tickets. (Spoiler: It's really easy.)

For the tickets themselves, we walked through the city and pressed the green button on just about every parking meter we encountered to get those sweet free fifteen-minute parking tickets. This quickly got us a big enough stack of parking tickets to extract just the ticket's background, as well as every number, a colon, a slash, a comma, a euro sign and the letters "P" and "A": enough to hack together our own tickets.

As stated in the "Data" section above, we already had most of the information we needed to display on our tickets:

  • The current time and date
  • The end time (calculated from the current parking zone and some information on the parking meters themselves)
  • The price (the maximum number of hours, times two euros per hour)
  • The nearest parking meter's unique ID (from our smartphone's GPS and the meter information on the 4411 website)

So we wrote a script that took a maximum number of hours (two or four) and a parking meter ID and generated a ticket that, when printed, looked nearly indistinguishable from a real ticket:

To print our homemade tickets, we bought a smartphone printer with thermal paper of about the same size as a parking ticket.

We tweaked the resolution a little, and PRESTO! We had printed our own seemingly genuine pay-and-display parking tickets!

Some parking tickets stuck to a transparent plastic lid
Some parking tickets stuck to a transparent plastic lid. Can you spot the fakes?

We merged all of this into another page of our app, which allowed us to print a ticket on the go, based on a user's current location.

Our app's "Park on the street" page
Our app's "Park on the street" page.

With the printer having cost us € 129 and the special thermal paper for each ticket approximately 50 cents, if every parking ticket could potentially save you € 7,50 (by paying 50 cents instead of € 8), you'd have reached your break-even point after a mere 18 fake tickets!

Additionally, if every person in Leuven (with a population of a little over one hundred thousand inhabitants) were to print and use only a single fake parking ticket, this would cost the city a whopping € 7.500.000 (and make for an amazing clickbait title)!

Luckily we have ethics, but how could the city stop bad people from doing the same?

One solution would be to force people to buy mobile parking tickets. They would be forced to enter their license plate, which could serve as a unique ID for their parking ticket.

Except for one small thing: not everybody has a (smart)phone. The city therefore cannot force people to pay for parking through SMS services such as 4411, as this would be discrimination against people who may not be able to afford or operate mobile devices.

A much more sensible solution would be to keep the current physical parking meters in addition to mobile parking tickets, but making people enter their license plate number. This approach is already used in other cities (such as Mechelen).

A more secure parking ticket from Mechelen
A more secure parking ticket from Mechelen.

Conclusion

  • We are in dire need of open data!
    Parking predictions such as the ones we made using Gent's open data could save Leuven and its inhabitants time (driving around searching), money (gas prices and road reparations), and even injury and death (cars in and around city full of cyclists, bad air).
  • Obviously, not all data should be open as this might lead to people printing their own parking tickets.
  • Parking tickets in Leuven aren't secure. Simply adding some unique value such as a license plate number to a parking ticket could save the city millions (literally).

Bonus

Here's a quick video of what printing a fake ticket might hypothetically look like:

Hypothetically printing a fake pay-and-display parking ticket.
Raccoons Craftworkz events
Newsletters suck... Ours don't! Get the best of Raccoons by email. We won't spam you!
Sign up for our newsletter